PowerShell can access the registry on a remote computer. There doesn’t appear to be built-in cmdlets to do it, so we have to do it the old fashioned way.
The example below will return some important information about a domain controller:
Note: make sure the lines below are on a single line.
This example does the same thing, but it uses a foreach loop to iterate through the keys and values stored in an array: