Monday

Read Registry on remote machines VbScript

 

Here is a simple code to read any part of the registry from any machine , provided you have admin rights on the target machine:
  1. Const HKEY_LOCAL_MACHINE = &H80000002
  2. Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "Machine Name" & "\root\default:StdRegProv")
  3. strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
  4. strValueName = "BU"
  5. oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
  6. msgbox strValue
Modify the strKeyPath and the strValueName and you can read any value in the registry!

No comments:

Post a Comment