How to retrieve registry values remotley using vbs or batch files
I want to know, can I run a script on my computer that will return the value of a registry entry from another PC on the same network?
For instance if I wanted to know if a PC had AVG anti-virus installed, could I run a script to return the version number of AVG installed on that PC, and if it's not installed to just say it can't f开发者_运维问答ind it?
If it helps I know the IP, MAC address, Service TAG and computer name of the remote PC.
It would be good to reference Connecting to WMI on a Remote Computer (MSDN) and Scripts to manage Registry
Sample code would look something like this (taken from ActiveXperts):
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon"
strValueName = "UIHost"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
StdOut.WriteLine "The Windows logon UI host is: " & strValue
Where strComputer
value would be replaced with the name / address of the machine.
精彩评论