我正在尝试检测远程计算机上的Internet Explorer版本。与谷歌搜索后,我写了这个。我正在本地机器上测试
$pc = "."
$key = "SOFTWARE\Microsoft\Internet Explorer"
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $pc)
$regKey = $reg.OpenSubKey($key)
$regkey.GetValue("Version")
但这会给我带来很多错误。
Eccezione durante la chiamata di "OpenRemoteBaseKey" con "2" argomento/i: "Impossibile trovare il percorso di rete.
"
In riga:3 car:56
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey <<<< ('LocalMachine', $pc)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Impossibile chiamare un metodo su un'espressione con valore null.
In riga:4 car:26
+ $regKey = $reg.OpenSubKey <<<< ($key)
+ CategoryInfo : InvalidOperation: (OpenSubKey:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Impossibile chiamare un metodo su un'espressione con valore null.
In riga:5 car:17
+ $regkey.GetValue <<<< ("Version")
+ CategoryInfo : InvalidOperation: (GetValue:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
我希望有人能给我一些建议。谢谢。
编辑。我找到了这个链接
http://archive.msdn.microsoft.com/PSRemoteRegistry
在远程计算机上查询注册表是否绝对需要此模块?
最佳答案
您可以查询没有该模块的远程注册表。 PSRemoteRegistry模块仅使它变得容易。但是,要求是启用远程注册表服务并在远程计算机上运行。例如,如果没有PSremoteRegistry模块,请查看我的博客文章:http://www.ravichaganti.com/blog/?p=1920
另外,请尝试使用提升的PowerShell控制台。您需要管理员权限才能查询远程注册表。这是我在系统上发现的。
关于powershell - 在远程计算机上检测Internet Explorer版本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5442024/