Script Center > Scripting Forums > The Official Scripting Guys Forum! > Need VBScript help in finding all versions of SHOCKWAVE and Removing Old Versions
Ask a questionAsk a question
 

QuestionNeed VBScript help in finding all versions of SHOCKWAVE and Removing Old Versions

  • Friday, November 06, 2009 1:41 PMBullDOze Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I need HELP with finding a scrpt or creating a script to clean up our Shockwave installs. Most are not listed in the "Add and Remove Programs" (XP) or "Products and Features" (vista).
    I am finding multiple installs of Macromedia and Adobe ShockWave installed on our systems. Registery keys are all over the place and the system32 shockewave folders are in numerous locations.  Due to security issues with older versions I need to clean about 25k XP and Vista machines.  I see creating a script and deploying it with SCCM 2007 as my best possiblity.  I am brand new to SCCM.

All Replies

  • Wednesday, November 11, 2009 10:07 PMRob.Ford Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Bulldoze, this might help if the shockwave installs are msi based. I use this script to perform similar uninstalls when you don't know the exact guid, program version, uninstall command, etc.

    Pass the script the display name of the product you are looking for. You could customise it to look for other options, or run the specified uninstall command if it is not a windows installer command.

    ===================================

    'Removes a product via passed DisplayName

    Option Explicit

    On Error Resume Next

    Const HKLM = &H80000002

    Dim Shell
    Dim RQ
    Dim SubKeys
    Dim SubKey
    Dim TValue
    Dim TName
    Dim GUID
    Dim rc
    Dim DisplayName

    'Get/check passed DisplayName
    If WScript.Arguments.Count = 0 Then WScript.Quit(1)
    DisplayName = WScript.Arguments(0)

    'Create objects
    Set Shell = CreateObject("WScript.Shell")
    Set RQ = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

    'Enumerate subkeys of the uninstall key to find the GUID for the passed DisplayName
    RQ.EnumKey HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", SubKeys

    For Each SubKey In SubKeys

      TName = ""
      RQ.GetStringValue HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & SubKey, "DisplayName", TName

      If TName = DisplayName Then
      
     'We have found entry
     GUID = SubKey      
     Exit For

      End If

    Next

    WScript.Echo guid

    If GUID <> "" Then

       rc = Shell.Run("msiexec /uninstall " & GUID & " /quiet /norestart", 0, 1)

    Else

      rc = 10

    End If

    'Tidy up
    Set Shell = Nothing
    Set RQ = Nothing
    WScript.Quit(rc)

  • Thursday, November 12, 2009 12:32 PMBullDOze Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks Rob, The problem is some of the older versions are not listed in the uninstall registry.  My next attempt may be to just delete the folders and registry keys I can find... any thoughts????

    Const HKEY_LOCAL_MACHINE = &H80000002

    strComputer = "ComputerName"

    DeleteSWFolders(strComputer)
    DeleteRegSW8(strComputer)
    DeleteRegSW10(strComputer)
    DeleteRegSW11(strComputer)

    '=======================================================================
    '=======================================================================
    Function DeleteRegSW11(strComputer)
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
         strComputer & "\root\default:StdRegProv")
     strKeyPath = "SOFTWARE\Adobe\Shockwave 11"
     oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
    End Function
    '=======================================================================
    '=======================================================================
    Function DeleteRegSW8(strComputer)
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
         strComputer & "\root\default:StdRegProv")
     strKeyPath = "SOFTWARE\Macromedia\Shockwave 8"
     WScript.Echo "Delete: " & HKEY_LOCAL_MACHINE & "/" & strKeyPath
     oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
    End Function
    '=======================================================================
    '=======================================================================
    Function DeleteRegSW10(strComputer)
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
         strComputer & "\root\default:StdRegProv")     
     strKeyPath = "SOFTWARE\Macromedia\Shockwave 10"
     WScript.Echo "Delete: " & HKEY_LOCAL_MACHINE & "/" & strKeyPath
     oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
     Next
    End Function
    '=======================================================================
    '=======================================================================
    Function DeleteSWFolders(strComputer)
     ' List a Specific Set of Folders
     On Error Resume next
     Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     Set colFolders = objWMIService.ExecQuery _
         ("Select * from Win32_Directory where Name Like '%\\Shockwave%'")
     
     For Each objFolder in colFolders
      If InStr(UCase(objFolder.Name), "SHOCKWAVE 11") Or InStr(UCase(objFolder.Name), _
      "SHOCKWAVE PLAYER 11") Then
      'Skip It
     '  objFolder.Delete
     '     Wscript.Echo "Delete: " & objFolder.Name
      Else
          Wscript.Echo "Delete: " & objFolder.Name
          objFolder.Delete
         End If
         If err > 0 Then
         WScript.Echo Err.Number & " " & Err.Description
         End If
     Next
     On Error goTo 0
    End Function
    '=======================================================================

  • Tuesday, November 17, 2009 12:19 AMRob.Ford Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Well, I'm guessing that if you run your script to delete all the folders, etc, you should be good. If your primary reason is for security, if you have physically deleted the older versions then they can't be run, even if some remnants remain in the registry. If you then install the required version and a shockwave site works, you should be ok.