Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uninstall script problem 1

Status
Not open for further replies.

zarkon4

MIS
Dec 16, 2003
641
US


I have a question about the following script I found in here.
Why doesn't it show all the software? I am wanting to use this or something similar to remove software, but the particular software does not show up in the collection.

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.name
next
 
This method only shows products that were installed using the Windows Installer Service. A combination of this and listing the contents of the Add/Remove programs list from the registry will give you a pretty good picture of what is installed on the computer.

I say pretty good because with a little effort, a product can be hidden from both of these discovery methods.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Makes sense to me. How would I script this to uninstall this particular software? I am a beginner at using WMI, or would I execute this through a different object.
 
If it is a specific piece of software, then the first question is "How was it installed?" If it was installed using the Windows Installer Service, then the uninstall is probably going to be relatively simple. If it was not, the uninstall can get pretty hairy.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I am not sure, I do know that the software shows up in add/remove programs and has entries in HKLC/Software.
 
I don't know of any standardized method for uninstalling software that just shows up in add/remove programs. If it shows up in add/remove programs, then check te registry. There should be an entry in HKLM\Software\Mocrosoft\WIndows\CurrentVersion\Uninstall\{SOME CLASSID}. Within this hopefully there is a string value called UninstallString. This should point you in the right direction for uninstalling it.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks, I found out it uses installshield, getting it to do a silent uninstall is a real pain in the rear end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top