Page 1 of 1 1
Topic Options
#212670 - 2017-09-08 08:11 PM Office inventory add
MackMan Offline
Just in Town

Registered: 2016-03-09
Posts: 4
Loc: Kentucky
Hello! I am trying to get my login script to add if computers have MS Office installed and I can't figure it out. I'm still learning kixtart every day and it has been a while since I've messed with my inventory section.

Currently I have the inventory section getting FName LName, username, IP address, make of pc, model of pc, serial number, and default printers. I'd like to add another column for Office (maybe a Y or N)

Here's what I have so far, but it isn't working... (sorry had to use quotes instead of code tags because it was pulling my table through html)

I noticed if I run the wmi script in cmd it gives me what I need
 Code:
wmic product where "name like '%office professional%%'" get name


 Quote:

; Inventory Script
If Ingroup ("05407")
? " Running inventory script..."
$ = ReDirectOutput ("\\server\public\IS\kixtartlogs\"+ @WKSTA+".html", 5)
$wmiColl1 = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_ComputerSystem ")
$wmiColl2 = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_BIOS ")
$wmiColl3 = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_Printer ")
$wmiColl4 = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_Product where "name like '%office professional%'"")
? "<HTML>"
? "<BODY>"
? "<center>"
? "<table border="1">"
? "<tr>"
? " <th>Full Name</th>"
? " <th>UserID</th>"
? " <th>IP Address</th>"
? " <th>Make</th>"
? " <th>Model</th>"
? " <th>Serial Number</th>"
? " <th>Default Printer</th>"
? " <th>Office</th>"
? "</tr>"
? "<tr>"
? "<td>$firstname $lastname</td>"
? "<td>@USERID</td>"
? "<td>" + @IPADDRESS0
? "</td>"



For Each $wmiObj in $wmiColl1
? "<td>" $wmiObj.Manufacturer
? "</td>"
? "<td>" $wmiObj.Model
? " </td>"
Next
For Each $wmiObj in $wmiColl2
? "<td>" Trim($wmiObj.SerialNumber)
? "</td>"
? "<td>" join(split(readvalue("HKEY_USERS\"+@sid+"\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),',',1),'')
? "</td>"
? "</tr>"
Next
For Each $wmiObj in $wmiColl4
? "<td>" $wmiObj.Name
? "</td>"
? "</table></font>"
? "<br />"
? "Inventory taken on " @DATE " at " @TIME ". </center>"
? "</BODY>"
? "</HTML>"
$ = RedirectOutput('')
EndIf


Any help would be appreciated! I can work my way through cmd but transposing it into kix is where I get confused.


Edited by MackMan (2017-09-08 08:15 PM)

Top
#212671 - 2017-09-11 11:39 AM Re: Office inventory add [Re: MackMan]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
Have you looked at the UDF library? There already is a function to return the MS Office type: MS Office Type
Top
#212672 - 2017-09-11 04:09 PM Re: Office inventory add [Re: BradV]
MackMan Offline
Just in Town

Registered: 2016-03-09
Posts: 4
Loc: Kentucky
I did look at the UDF library and found an option for MSOffice, but it isn't pulling through for some reason.

I did find something that works for what I need though
 Code:
$MSVer = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\ProductVersion", "LastProduct")
$MSVer


This pulls through the version number (ex. 15.0.x.x for Office 2013) which is fine with me as long as it states it has office.

Top
#212673 - 2017-09-11 05:50 PM Re: Office inventory add [Re: MackMan]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
There's also a fairly thorough example in the script Vault on how to collect inventory data. You might find some or all of it useful.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 728 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.029 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org