Search and Delete a registry key

This vbscript will search and delete a key with input provided.
Input can be provided in  strValueName = "ProductName". Also this script can be pushed to large number of machines via SCCM, Landesk,Altiris tool.

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

set wshshell=Wscript.CreateObject("Wscript.Shell")

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 

    strComputer & "\root\default:StdRegProv")

 strKeyPath = "SOFTWARE\Classes\Installer\Products\"

oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

 strValueName = "ProductName"

For Each subkey In arrSubKeys

    strKy= strKeyPath&subkey

oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKy, _


if  Left(strValue,5)="Adobe" THEN

'Wscript.Echo strValue

'wscript.echo strKy&"\SourceList\Net\"

oReg.DeleteKey HKEY_LOCAL_MACHINE, strKy&"\SourceList\Net"

oReg.Deletekey  HKEY_LOCAL_MACHINE,strKy&"\SourceList\Media"

oReg.Deletekey HKEY_LOCAL_MACHINE,strKy&"\SourceList"

oReg.Deletekey HKEY_LOCAL_MACHINE,strKy

end if 



This post is locked
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ