Mike400
(Mike400)
1
I have turned off Spiceworks scanning. Since I’m a guest on another network I have to be very careful about the scanning. I probably could have fixed the scanning issues but the reason I was scanning was to monitor our software installations and with Spiceworks constantly reporting previously uninstalled software as currently installed there was no reason to fix the scanning.
1 Spice up
jonm
(Jon (Spiceworks))
2
Hey Mike,
It’s Monday, so I’m probably missing something here. What’s the exact issue we’re looking at here? Are you wanting to figure out why uninstalled software is showing as installed?
Sorry, Mondays make my brain hurt…
Mike400
(Mike400)
3
Jon,
There have been several threads about Spiceworks improperly reporting previously installed, and now uninstalled software as still installed. Until recently I thought this was restricted to just Microsoft Office, but it appears that it’s a much wider problem than just MS Office. Basically since I was scanning only for inventory management and I couldn’t depend on Spiceworks to show the currently installed software on our machines the scanning feature is useless. I can fix the scanning issues with our network host but why bother given the inability to reflect the removal of software.
Examples of software that have been removed and still show as installed - MS Office - all versions, Java Runtime, TweakUAC (I’m really trying to get rid of this one), various browser toolbars. This isn’t a complete list, just the ones I have run into and can remember off the top of my head. This occurs even using the Spiceworks uninstaller - the software uninstalls according to the Add/Remove Programs interface but even after rescanning the machine still shows in Spiceworks.
jonm
(Jon (Spiceworks))
4
Hey Mike,
Gotcha. As a test, have you tried running a registry cleaner to see if cleaning up some old registry entries helps out? That may not be the issue, but I always like to start with that since some uninstalls leave behind bits of info that WMI picks up on.
Mike400
(Mike400)
5
I can try that at home but it will be later this week.
1 Spice up
jonm
(Jon (Spiceworks))
6
Okay, just keep us posted!
Mike400
(Mike400)
7
OK, I finally had a chance to run a WMI script against my own machine and also changed the login in Spiceworks to use the same account. The WMI script ran in about half the time the Spiceworks inventory of the same machine did, but I know Spiceworks is doing a lot more than just the software inventory. The results are the same for both my script and Spiceworks. Spiceworks did finally remove the uninstalled software from the list.
Directly reading the registry is a different story - the two lists are NOT the same. I am attaching the output and source code for both.
WMI Source Code:
strComputer = "."
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("Select * from
Win32_Product")
For Each objSoftware in colSoftware
wscript.echo objSoftware.Caption
& ", " & objSoftware.installDate & ", " &
objSoftware.installDate2
Next
VB.Net Registry Add/Remove Programs Read Source Code
Public Function GetInstalledSoftware(computerName As String) As IEnumerable(Of SoftwareDetails)
' Use a HashSet as I have seen the same software reported by both registry keys. Only need one instance
Dim l As New HashSet(Of SoftwareDetails)
l.UnionWith(SearchReg(computerName, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
l.UnionWith(SearchReg(computerName, "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"))
Return l
End Function
Private Function SearchReg(computerName As String, regPath As String) As HashSet(Of SoftwareDetails)
Dim l As New HashSet(Of SoftwareDetails)
Using regHive As RegistryKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, computerName), _
regKey As RegistryKey = regHive.OpenSubKey(regPath)
If regKey Is Nothing Then Return l
For Each KeyName As String In regKey.GetSubKeyNames()
Using subKey As RegistryKey = regKey.OpenSubKey(KeyName)
Dim obj As Object = subKey.GetValue("DisplayName")
If obj Is Nothing Then Continue For
l.Add(New SoftwareDetails(CStr(obj), _
subKey.GetValue("DisplayVersion"), _
subKey.GetValue("InstallDate"), _
subKey.GetValue("Publisher")))
End Using
Next
End Using
Return l
End Function
I have also attached the output of both as csv files. Admininventory is the results of the WMI script.
admininventory.csv (16.5 KB)
Mike400
(Mike400)
8
Here’s the result of the direct registry read.
AddRemovePrograms.csv (25.4 KB)
Mike400
(Mike400)
9
Since the two are different, as administrators we need to know which software items are uninstallable via add/remove programs and which have no direct uninstaller. The former is needed for license compliance and the latter tells us how much residual garbage is on the machine.