使用Powershell获取远程用户HKLM

时间:2013-04-07 18:10:02

标签: powershell

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

1 个答案:

答案 0 :(得分:9)

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

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)您可以使用Scripting Guy博客中显示的PSDrive http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/07/use-the-powershell-registry-provider-to-simplify-registry-access.aspx

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