I am trying to use powershell to access a remote registry:
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine", $server)
$key = $reg.OpenSubkey($subkeyPath)
Depending on some factors that I still can’t determine, I either get
Raising the OpenSubKey exception with argument "1": "Requested registry access is not allowed."
or
System.UnauthorizedAccessException: Attempted to perform an unauthorized operation. at Microsoft.Win32.RegistryKey.Win32ErrorStatic (Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey (RegistryHive hKey, String machineName)
It seems pretty clear that this is due to the fact that the user I am running the powershell script, since it does not have the appropriate credentials to access the remote registry. I would like to be able to provide a set of credentials to use for remote access to the registry, but I cannot find any documentation anywhere for this. I also do not quite understand exactly where to specify which users can remotely access the registry.
source
share