How to remove the Blaster registry key through scripting

How to remove the Blaster registry key through scripting

Joel Johnson, SearchSecurity.com Expert

This handy WMI script can be called from your login scripts to clean up the Blaster registry key. Of course, you may want to add a Reg backup line to backup the registry first.

The basics behind this script are pretty simple. The first five lines lay out the standard Windows registry tree. The next five lines define what we are looking for. The "." stands for local computer. If you want to target a single computer you can add that computer name instead of the ".". The "SMethod" means we are using the "Delete Value" command. The next two lines lay out the location of the value we are looking for. And finally the "SValue" is the value that nasty Blaster added to user registries. The rest of the script calls the variables we just defined.

You can run this within netlogon and save yourself valuable cleanup time.


Const HKEY_CLASSES_ROOT  = &H80000000
Const HKEY_CURRENT_USER  = &H80000001
Const HKEY_Local_Machine  = &H80000002
Const HKEY_Users   = &H80000003
Const HKEY_Current_Config  = &H80000005

sComputer  = "."
sMethod  = "DeleteValue"
hTree   = HKEY_Local_Machine
sKey   = "SoftwareMicrosoftWindowsCurrentVersionRun"
sValueName  = "windows auto update"

Set oRegistry  = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
   sComputer & "/root/default:StdRegProv")

Set oMethod  = oRegistry.Methods_(sMethod)
Set oInParam  = oMethod.inParameters.SpawnInstance_()

oInParam.hDefKey = hTree
oInParam.sSubKeyName = sKey
oInParam.sValueName = sValueName

Set

    Requires Free Membership to View

    SearchSecurity.com members gain immediate and unlimited access to breaking industry news, virus alerts, new hacker threats, highly focused security newsletters, and more -- all at no cost. Join me on SearchSecurity.com today!

    Michael S. Mimoso, Editorial Director

    By submitting your registration information to SearchSecurity.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSecurity.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

oOutParam = oRegistry.ExecMethod_(sMethod, oInParam)


This was first published in August 2003

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.