Home > Midmarket CIO Tips > > WMI script to clean up worms and virus registry keys
CIO Midmarket Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 


WMI script to clean up worms and virus registry keys


Joel Johnson
05.25.2004
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


This tip originally appeared on SearchWin2000.com, a sister site of SearchSmallBizIT.com.

Submitted to the SearchWin2000.com tip exchange by member Joel Johnson. Please let other users know how useful it is by rating it below.


This handy WMI script can be called from your login scripts to clean up the viruses that write to the Windows registry Run key. Of course, you may want to add a Reg backup line to backup the registry first. This is an example with the most recent Netsky.D worm which was a recent category 4.

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  = "ICQ Net" = "%Windir%winlogon.exe -stealth"


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 oOutParam = oRegistry.ExecMethod_(sMethod, oInParam)

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 virus added to user registries. You can adjust the SValue to meet your particular cleanup needs.

The rest of the script calls the variables we just defined.


Do you have comments on this tip? Let us know.


Rate this Tip
To rate tips, you must be a member of SearchCIO-Midmarket.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Information security management for the midmarket
Mobile device management: From business apps to device security
Test your knowledge: IT quizzes for midmarket CIOs
Droid does, but will IT support it?
Information security program revamp adds outsourcer oversight and more
From data breaches to risk management frameworks: Test your knowledge
The challenge of managing risk when IT budgets tighten
Why cybersecurity awareness is everyone's responsibility
Information technology management e-book downloads for midmarket CIOs
10 must-have steps for an effective SMB information security program
Your IT security budget: How to get more bang for the buck

Risk management for the midmarket
CIO resources: Top five technology topics of 2009
Information security program revamp adds outsourcer oversight and more
From data breaches to risk management frameworks: Test your knowledge
Adopting a beta tool: Risks vs. rewards for a midsized enterprise
The challenge of managing risk when IT budgets tighten
Why cybersecurity awareness is everyone's responsibility
How to decide if changing technology vendors is worth the time, risk
A guide to managing the risk assessment process
Free risk management tools and resources for the enterprise
CIOs taking risk of cutting vendor maintenance contracts to save money

Security tools for the midmarket
Why CIOs need to get real about identity and access management in 2010
Free risk management tools and resources for the enterprise
IT security spending a bright spot in '09, with more growth predicted
Security and risk management in the midmarket
Identity and access management planning guide for the midmarket
A CIO's advice for implementing single sign-on solutions
Options for outsourcing security grow, offer IT budget savings
Network access control: Pointers for getting the knack of NAC
Unified communications: Securing access to OCS
Unified communications security: How safe is it?

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Mid-market CIO Business Solutions on Data Integrity, Unified Communications, and Virtualization
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2007 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts