2010-11-19 78 views
0

我想知道,我可以在我的计算机上运行脚本,该脚本将从同一网络上的另一台PC返回注册表项的值?如何使用vbs或批处理文件检索注册表值remotley

例如,如果我想知道PC是否安装了AVG防病毒软件,我可以运行一个脚本来返回安装在该PC上的AVG的版本号,并且如果它没有安装,只是说它不能找到它?

如果它帮助我知道远程PC的IP,MAC地址,服务标签和计算机名称。

+1

“不”和“知道”是两个非常不同的词。 – 2010-11-20 08:53:30

回答

1

这将是很好的参考Connecting to WMI on a Remote Computer (MSDN)Scripts to manage Registry

示例代码会是这个样子(从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 

strComputer价值将会随着的名称/地址替换机。