'Date : 14 Dec 2015 'The following code will remove Adobe Flash specific registries from that are not relevant to the currently installed version. ' "HKLM\SOFTWARE\Classes\Installer\Products\" ' "HKLM\SOFTWARE\Classes\Installer\Features\" ' "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" 'Logic : Getlist of GUID based on upgradecode. For each upgrade code, check if its installed, if not installed remove from registry strHklmSwClsInstProd= "SOFTWARE\Classes\Installer\Products\" strHklmSwClsInstFeat= "SOFTWARE\Classes\Installer\Features\" strHklmWowUninstall= "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" 'to find currently installed version 'the packed upgradecode for flash player activeX is 70836424B0797524CB59C543D816FDC1 strKeyPathActivX = "SOFTWARE\Classes\Installer\UpgradeCodes\70836424B0797524CB59C543D816FDC1" 'the packed upgradecode for flash player plugin is 95A1A58D25CD31D44954FEF373D9D45B strKeyPathPlugIn = "SOFTWARE\Classes\Installer\UpgradeCodes\95A1A58D25CD31D44954FEF373D9D45B" Const boolDbg=True 'True to turn on output Const HKEY_LOCAL_MACHINE = &H80000002 Const REG_SZ = 1 Const REG_EXPAND_SZ = 2 Const REG_BINARY = 3 Const REG_DWORD = 4 Const REG_MULTI_SZ = 7 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") cleanFlashRegistries(strKeyPathActivX) cleanFlashRegistries(strKeyPathPlugIn) set oReg = Nothing WScript.Quit(0) Function cleanFlashRegistries(strFlashUpgradeCode) write "Upgrade Code :" & strFlashUpgradeCode intResultEnumUpgradCode = -1 intResultEnumProdCode = -1 set arrValueNames = Nothing intResultEnumUpgradCode = oReg.EnumValues(HKEY_LOCAL_MACHINE, strFlashUpgradeCode, arrValueNames, arrValueTypes) if (intResultEnumUpgradCode=0) AND IsArrayDimmed(arrValueNames) then 'successfully executed oReg.EnumValues For i=0 To UBound(arrValueNames) write "Value Name: " & arrValueNames(i) write"GUID: " & strGUIDfromPackgedGUID(arrValueNames(i)) 'Logic to find currently installed version -> intResultEnumProdCode= oReg.EnumValues(HKEY_LOCAL_MACHINE, strHklmWowUninstall & strGUIDfromPackgedGUID(arrValueNames(i)), arrValueNamesUninstallAx, arrValueTypesUninstallAx) if intResultEnumProdCode= 0 then 'found write "found in uninstall" ' so its currently installed Else 'nuke the codes from the registry 'Logic to delete the not currently installed verison -> write "Deleting the following" write strHklmSwClsInstProd & arrValueNames(i) DeleteSubkeys HKEY_LOCAL_MACHINE, strHklmSwClsInstProd & arrValueNames(i) write strHklmSwClsInstFeat & arrValueNames(i) DeleteSubkeys HKEY_LOCAL_MACHINE, strHklmSwClsInstProd & arrValueNames(i) write strFlashUpgradeCode & ":" & arrValueNames(i) oReg.DeleteValue HKEY_LOCAL_MACHINE,strFlashUpgradeCode,arrValueNames(i) End if write " " Next Else write "no entires found" End If End Function 'input : [string] Packed Guid 'output: [string] GUID with Curley Brace {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} Function strGUIDfromPackgedGUID(strPackedGUID) dim str18,str24,str34,str42,str52,str62,str72,str82,str92,str102,str112 str18=StrReverse(MID(strPackedGUID,1,8)) str24=StrReverse(MID(strPackedGUID,9,4)) str34=StrReverse(MID(strPackedGUID,13,4)) str42=StrReverse(MID(strPackedGUID,17,2)) str52=StrReverse(MID(strPackedGUID,19,2)) str62=StrReverse(MID(strPackedGUID,21,2)) str72=StrReverse(MID(strPackedGUID,23,2)) str82=StrReverse(MID(strPackedGUID,25,2)) str92=StrReverse(MID(strPackedGUID,27,2)) str102=StrReverse(MID(strPackedGUID,29,2)) str112=StrReverse(MID(strPackedGUID,31,2)) strGUIDfromPackgedGUID="{" & str18 & "-" & str24 & "-" & str34 & "-" & str42 & str52 & "-" & str62 & str72 & str82 & str92 & str102 & str112 & "}" End Function 'script from the scripting guys site @ microsoft devleoper. Sub DeleteSubkeys(HKEY_LOCAL_MACHINE, strKeyPath) oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys If IsArray(arrSubkeys) Then For Each strSubkey In arrSubkeys DeleteSubkeys HKEY_LOCAL_MACHINE, strKeyPath & "\" & strSubkey Next End If oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath End Sub Function write(strIn) If boolDbg Then Wscript.echo strIn end if End Function 'Below code from http://wiki.mcneel.com/developer/scriptsamples/emptyarray Function IsArrayDimmed(arr) IsArrayDimmed = False If IsArray(arr) Then On Error Resume Next Dim ub : ub = UBound(arr) If (Err.Number = 0) And (ub >= 0) Then IsArrayDimmed = True End If End Function
View inventory records anonymously contributed by opt-in users of the K1000 Systems Management Appliance.