Posted in
Windows Powershell |
No Comment | 4,657 views | 04/02/2016 22:46
You can use [Microsoft.Win32.RegistryKey] to get remote registry values.
1
2
3
4
5
6
7
| $ComputerName = "Server";
# Create Registry Connection
$RegistryConn = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"LocalMachine", $ComputerName)
# Get Sub Key Names
$GetSubKeyNames = $RegistryConn.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\X\").GetSubKeyNames() |
$ComputerName = "Server";
# Create Registry Connection
$RegistryConn = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"LocalMachine", $ComputerName)
# Get Sub Key Names
$GetSubKeyNames = $RegistryConn.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\X\").GetSubKeyNames()
That will give you results.