0

I have this script that remotely gets the value of a registry subkey:

$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey'LocalMachine',$Computer)
$key = $reg.OpenSubKey('SOFTWARE\Wow6432Node\SomeVendor\SomeApp')

$key.getvalue('Value1')

There are 2 servers which I need to run this against, that are both setup to perform the same functions (load balanced), so theoretically they should be the same.

Reading the value on server1 is OK, but the problem I get is that on Server2, I keep getting an error relating to the "OpenSubKey":

Exception calling "OpenSubKey" with "1" argument(s): "Requested registry access is not allowed."

I am a local administrator on each of the servers, I can run the exact same script locally on each server and run the script against server1 or server2 without a problem, and when running against both servers from an alternative server, but not from the remote server that I wish to run it from and against server2 - to re-iterate, the script will always work against server1 wherever I run this from in my domain. Could there be a computer policy restriction of some description that could be causing this?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
TOGEEK
  • 711
  • 4
  • 15
  • 34

1 Answers1

0

Check firewall rules in remote servers. I had the same problem and it was solved

marele
  • 1
  • What ports were opened or closed on the firewall? Please provide a more detailed answer to how you solved the issue! – Mike Glenn Aug 14 '17 at 15:14