Uninstall software from a computer using a script

If you want to uninstall a piece of software using a vbscript then this is the page for you. This works with windows 7 and previous versions of os as i have tested it. The script uses the name of the software in the "add/remove" programs to uninstall it silently.To create a script file. Copy the text below into notepad and save the file as a *.vbs rather than *.txt.

Where items have <> you need to enter your details in there to make it work.

The Code

strmyComputer = "."
Set objWMICall = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strmyComputer & "\root\cimv2")

Set theSoftware = objWMICall.ExecQuery ("Select * from Win32_Product Where Name = '<Software Name>'")

For Each SoftwareComponent in theSoftware
SoftwareComponent.Uninstall()
Next

 

You need to r eplace <Software Name> with the name of the software you wish to uninstall.

 

Uninstall Software from a computer on the network. Bulk uninstall software. Uninstall software remotely.

The script above can be manipulated to help you uninstall software remotely over a network. To do this it is quite simple. Use the code above in a vbscript. Create a group policy and attached the script to the startup section of the group policy. This will allow the script to run on the objects in the organisational unit you have attached it to at startup. If you wish to do it for a specific computer. You can change the section of the code strmyComputer = "." to strmyComputer = "<computername>" where the <computername> is the specific name of the computer you wish to install the software from.

 




Disclaimer: By using any of the software mentioned in this document you are adhering to their terms and conditions of use. I do not accept any responsibility for any loss, damage or disruption to your data or computer system that may occur while using the software mentioned in this document.
Site Map | Privacy Policy | Contact Us
| Best viewed in 1024 * 768 or above | ©2008 www.MyPcHealth.co.uk