Reputation: 293
I am attempting to write a script that will uninstall a program when it is run. The problem is that the program will not have the exact same name each time, as it will have a version number attached. Is there anyway to grab the program name from a list, assuming it contains what I'm looking for? Then use that name to finish the uninstall?
The only uninstall function that I've found is:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where Name = 'Personnel database'")
For Each objSoftware in colSoftware
objSoftware.Uninstall()
Next
Upvotes: 1
Views: 6946