Monday, May 31, 2010

Editing Registry Entries with VBS

Editing Registry Entries with VBS is simple. Here is some code to do just that:



Const HKEY_LOCAL_MACHINE = &H80000002 
on error resume next


strComputer = "LOCALHOST"


    Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")
   strKeyPath = "SOFTWARE\Bentley\Licensing\1.1"
   strEntryName = "Country"
   strValue = "Afghanistan"
   objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue








WScript.Quit 

No comments:

Post a Comment