2013-04-07 78 views

回答

8

有幾種方法可以做到這一點,但你怎麼做取決於你有的環境。

1)也許最簡單的方法是使用調用命令

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來如圖所示的腳本專家博客 http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/07/use-the-powershell-registry-provider-to-simplify-registry-access.aspx

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

+0

嘗試.NET路由,但它不斷給我一個GetValue錯誤,說它不是一個有效的方法。 – 2017-11-28 16:46:53