bertieuk
IS-IT--Management
- Jun 1, 2004
- 175
I have been playing about with a few ideas for software inventory script. I had a look through previous threads and MS script centre but I am having a problem with either nothing coming back or far too much info.
I ideally want a list of installed software that would be listed in the Add/Remove program list plus anything that may hide itself.
So far I have tried (note: I have found these inresearch)
There seems to be a problem with "Select * from Win32_Product" because Null is returned.
I have also tried
This is giving far too much info such as all the language files for Adobe which I'm not interested in (48 pages in total)
Can anyone point me in the right direction
Thanks
Si
I ideally want a list of installed software that would be listed in the Add/Remove program list plus anything that may hide itself.
So far I have tried (note: I have found these inresearch)
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(".\software.tsv", True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product")
objTextFile.WriteLine "Caption" & vbtab & _
"Description" & vbtab & "Identifying Number" & vbtab & _
"Install Date" & vbtab & "Install Location" & vbtab & _
"Install State" & vbtab & "Name" & vbtab & _
"Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
& "Version"
For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.Caption & vbtab & _
objSoftware.Description & vbtab & _
objSoftware.IdentifyingNumber & vbtab & _
objSoftware.InstallDate2 & vbtab & _
objSoftware.InstallLocation & vbtab & _
objSoftware.InstallState & vbtab & _
objSoftware.Name & vbtab & _
objSoftware.PackageCache & vbtab & _
objSoftware.SKUNumber & vbtab & _
objSoftware.Vendor & vbtab & _
objSoftware.Version
Next
objTextFile.Close
There seems to be a problem with "Select * from Win32_Product" because Null is returned.
I have also tried
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colFeatures = objWMIService.ExecQuery ("Select * from Win32_SoftwareFeature")
For Each objFeature in colfeatures
' Wscript.Echo "Accesses: " & objFeature.Accesses
' Wscript.Echo "Attributes: " & objFeature.Attributes
Wscript.Echo "Caption: " & objFeature.Caption
Wscript.Echo "Description: " & objFeature.Description
' Wscript.Echo "Identifying Number: " & objFeature.IdentifyingNumber
' Wscript.Echo "Install Date: " & objFeature.InstallDate
' Wscript.Echo "Install State: " & objFeature.InstallState
' Wscript.Echo "Last Use: " & objFeature.LastUse
Wscript.Echo "Name: " & objFeature.Name
Wscript.Echo "Product Name: " & objFeature.ProductName
Wscript.Echo "Vendor: " & objFeature.Vendor
Wscript.Echo "Version: " & objFeature.Version
Wscript.Echo
Next
Can anyone point me in the right direction
Thanks
Si