How to Uninstall Software With a VB Script

VB Script is a language used on a Windows machine to automate functions like installing software, setting registry values or configuring network components. Creating a VB Script file allows administrators to create one file and push it to hundreds of computers to control software automation. Creating a script file to uninstall software only takes a few lines of code.

Instructions

    • 1

      Click the Windows "Start" button and select "All Programs." Select "Accessories" and choose "Notepad" from the menu list.

    • 2

      Call the Windows Installer application. The Windows Installer controls the list of programs that show in the "Add/Remove Programs" section of the Control Panel. Calling the applications gives you the ability to silently uninstall applications using VB Script.
      strmyComputer = "myComputerName"
      Set objWMICall = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strmyComputer & "\root\cimv2")

    • 3

      Select the software to uninstall. The Windows Installer uses SQL language to select the software application. The following code selects "Microsoft Office 2007" from the Installer to uninstall:
      Set theSoftware = objWMICall.ExecQuery ("Select * from Win32_Product Where Name = 'Microsoft Office 2007'")

    • 4

      Uninstall the software and any dependent components. The following code uses the WMI object to uninstall the software:
      For Each SoftwareComponent in theSoftware
      SoftwareComponent.Uninstall()
      Next

    • 5

      Click the "File" menu in Notepad and select "Save As." Save the file with a .vbs extension. This file extension triggers windows to run the VB Script compiler when run.

Tips & Warnings

  • Do not run the script on your own computer unless you wish to uninstall software.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured