My latest article on PowerShell Magazine is on how to access the registry on a remote system. This is a technique I have used in a number of my scripts, for example: Get-RemoteProgram. The full article containing tips on how to use the Microsoft.Win32.Registry class is available on PowerShell Magazine : Access remote registry using PowerShell

The following example will retrieve the SubKeyNames of HKLM:\System\CurrentControlSet on the Server1 system:

1 2 3 $Reg = [ Microsoft.Win32.RegistryKey ] ::OpenRemoteBaseKey ( [ Microsoft.Win32.RegistryHive ] ::LocalMachine , 'Server1' ) $RegSubKey = $Reg .OpenSubKey ( "System\CurrentControlSet" ) $RegSubKey .GetSubKeyNames ( ) $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,'Server1') $RegSubKey = $Reg.OpenSubKey("System\CurrentControlSet") $RegSubKey.GetSubKeyNames()

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Like this: Like Loading...