4

有没有办法在您的网络 HKLM 上获得另一台机器?我想你会为此使用 pdrive,但我无法让命令成功运行

4

1 回答 1

11

有几种方法可以做到这一点,但你如何做到这一点取决于你所拥有的环境。

1)可能最简单的方法是使用invoke-command

Ex.
Invoke-command -computer RemoteComputerName {Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\run}

如果您在远程计算机上有足够的权限,这将起作用,WinRM 已配置为您连接到它。

2)您可以使用 .net 注册表类查看此链接:http: //msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.aspx

$registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', 'RemoteComputerName')
$registryKey= $registry.OpenSubKey("Software")

3) 您使用 PSDrive,如 Scripting Guy 博客 http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/07/use-the-powershell-registry-provider-to-simplify-registry-访问.aspx

4) 您可以使用 WMI Registry http://itknowledgeexchange.techtarget.com/powershell/wmi-and-the-registry/

于 2013-04-07T18:57:08.240 回答