Friday, January 21, 2005

Unattended uninstallation using vbscript

"How can I uninstall applications automatically without having to use Windows Add/Remove Programs?"

Here is a tips for how to do. This works for uninstalling most applications. In this example I will show how AutoCAD 2005 can be uninstalled using a VBScript. Open Regedit and look in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall search for the application and find a the product code that is in GUID format looking like this: {5783F2D7-0301-0409-0002-0060B0CE6BBA} It might be something else for you. The code below will uninstall AutoCAD 2005 as well as Express Tools. Copy the code below into Notepad and give the file the extension vbs.

on error resume next
Set WshShell = CreateObject("WScript.Shell")
' Uninstall Express Tools
WshShell.Run "msiexec /x {5783F2D7-0311-0409-0000-0060B0CE6BBA} /q",1,true
' Uninstall AutoCAD 2005
WshShell.Run "msiexec /x {5783F2D7-0301-0409-0002-0060B0CE6BBA} /q",1,true

2 comments:

  1. Restored comments
    Anonymous said...

    By using this coding i can uninstall applications with reference to their registry uninstall id. But i am looking for, uninstall the application using names in the add and remove programs.
    March 18, 2006

    JTB World said...

    In that case if you don't want to in the registry search the name and identify the id you either have to create a program that mimics what "add and remove" does or purchase one.
    March 18, 2006

    Anonymous said...

    The above code works fine.But I would like to knwo what is this /x & /q used for?That doesn't appear in the product code in registry.What is this used for?
    I am a learner in QTP.so i don't know why this used.Can you please explain?
    April 03, 2008

    JTB World said...

    These are the command-line options for Msiexec.
    /x Uninstalls a product.
    /q Displays no user interface.
    More can be found here:
    http://technet2.microsoft.com/windowsserver/en/library/9361d377-9011-4e21-8011-db371fa220ba1033.mspx?mfr=true
    April 03, 2008

    ReplyDelete
  2. You are a genious Sir. It worked great. Now I have to figure out how to execute it for 30 laptops.

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.