Script to Parse Registry and Uninstall / Install software

  • 13 years ago

    Hi guys,

    We have multiple versions of Acrobat Reader from 5.x to 8.x, ( as there was no SOE When i started here ) I want to create a script to check to see if the registry key for the versions exists, and if so uninstall it, then install the lasest version.

    I have all the registry key locations and the commands to uninstall the software, just need to put it all together...

    ;Acrobat Reader 8.1 - Latest Version - Check to see if exists - Uninstall anything below 8.1
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A81000000003}


    ;Acrobat Reader 8.0
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A80000000002}
    msiexec /uninstall {AC76BA86-7AD7-1033-7B44-A80000000002} REBOOT=SUPRESS /qn



    ;Acrobat Reader 7.0.9
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A70900000002}
    msiexec /uninstall {AC76BA86-7AD7-1033-7B44-A70900000002} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0.8
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-0000-7760-100000000002}
    msiexec /uninstall {AC76BA86-1033-0000-7760-100000000002} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0.7
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-F400-7760-100000000002}
    msiexec /uninstall {AC76BA86-1033-F400-7760-100000000002} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0.5
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A70500000002}
    msiexec /uninstall {AC76BA86-7AD7-1033-7B44-A70500000002} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0.3
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-0000-7EC8-7489-000000000704}
    msiexec /uninstall {AC76BA86-0000-7EC8-7489-000000000704} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0.2
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-0000-7EC8-7489-000000000703}
    msiexec /uninstall {AC76BA86-0000-7EC8-7489-000000000703} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0.1
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-0000-7EC8-7489-000000000702}
    msiexec /uninstall {AC76BA86-0000-7EC8-7489-000000000702} REBOOT=SUPRESS /qn

    ;Acrobat Reader 7.0
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A70000000000}
    msiexec /uninstall {AC76BA86-7AD7-1033-7B44-A70000000000} REBOOT=SUPRESS /qn

    ;Acrobat Reader 6.0.3
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-0000-7EC8-7489-000000000603}
    msiexec /uninstall {AC76BA86-0000-7EC8-7489-000000000603} REBOOT=SUPRESS /qn

    ;Acrobat Reader 6.0.2
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-0000-0000-0000-6028747ADE01}
    msiexec /uninstall {AC76BA86-0000-0000-0000-6028747ADE01} REBOOT=SUPRESS /qn

    ;Acrobat Reader 6.0 & 6.0.1
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-000000000001}
    msiexec /uninstall {AC76BA86-7AD7-1033-7B44-000000000001} REBOOT=SUPRESS /qn

    ;Acrobat Reader 5.x
    C:\WINDOWS\ISUNINST.EXE -y -x -f"C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu" -c"C:\Program Files\Common Files\Adobe\Acrobat</span> <span style="font-family: Courier New">5.0\NT\Uninst.dll"

    After it uninstalls the above, I need the script to install the latest version using the custom command line....

    ;Acrobat Reader 8.1
    MSIEXEC /I AcroRead.msi ALLUSERS=TRUE REBOOT=SUPRESS TRANSFORMS=Reader81BaseNoOnlineNoUpdaterNoSyncroniser.MST /qn

    I dont have access to Visual Basic  at work, and my programming expirence doesnt go much beyond kix32 scripts Embarrassed [:$]

    Cheers

    Chris...

  • 13 years ago

    Hey GTiRolla How are u?

    i have a bit idea for u na,

    pls copy that code below and save as "FindInstalledSoftware.vbs"

    ' Windows Server 2003 : Yes
    ' Windows XP : Yes
    ' Windows 2000 : Yes
    ' Windows NT 4.0 : Yes
    ' Windows 98 : Yes




    Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
    strComputer = "."
    strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
    strEntry1a = "DisplayName"
    Dim Title
    Set objReg = GetObject("winmgmts://" & strComputer & _
     "/root/default:StdRegProv")
    objReg.EnumKey HKLM, strKey, arrSubkeys
    WScript.Echo "Installed Applications" & vbCrLf
    Title=InputBox("Enter the similar Application Title to Find ","Find Installed Application","Flash")
    For Each strSubkey In arrSubkeys
      intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
       strEntry1a, strValue1)
      If InStr(UCase(strValue1),UCase(Title)) Then
       MsgBox "Yes Already Installed  " & strValue1
      End If
    Next
















    after that pls copy that code below and save as "Uninstall.vbs"

    strComputer = "."
    Dim Title
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Title = InputBox("Input The specific Application Title that u 1 2 Uninstall", "Üninstall", "Vbsedit")
    Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product where name='" & Trim(Title) & "'")
    For Each objSoftware In colSoftware
        objSoftware.Uninstall
    Next







    pls copy that code below and save as "Install.vbs" u can install only *.msi file

    ' Install Software on the Local Computer

    ' Windows Server 2003 : Yes
    ' Windows XP : Yes
    ' Windows 2000 : Yes
    ' Windows NT 4.0 : Yes
    ' Windows 98 : Yes



    Const ALL_USERS = True
    Dim Path
    Set objService = GetObject("winmgmts:")
    Set objSoftware = objService.Get("Win32_Product")
    Path=InputBox("Enter the correct path of file that 1 2 install","Installation","c:\scripts\database.msi")
    errReturn = objSoftware.Install(Path, , ALL_USERS)
    MsgBox errReturn





     

    that 's all sorry if something wrong !

    regard from

    Spider Anatha

     

  • 13 years ago

    Thanks Spider,

    I'm after more something that is one script that does all 3 actions with no user interaction so I could run this in a login script etc...

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor