How to Uninstall Software With a VB Script

Written by lysis
  • Share
  • Tweet
  • Share
  • Email

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.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

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

  2. 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. 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 the Software = objWMICall.ExecQuery ("Select * from Win32_Product Where Name = 'Microsoft Office 2007'")

  4. 4

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

  5. 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 and warnings

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

Don't Miss

References

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.