rdp
rdp

Reputation: 2088

Read remote registry in python

I am able to read the registry key on a local machine using the following code

key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\somename1\\somename2")
path=  _winreg.QueryValueEx(key, "PATH")[0]

I would like to do the same for a remote machine, i.e read the registry entries on a remote machine.

Upvotes: 0

Views: 3737

Answers (1)

Gary Walker
Gary Walker

Reputation: 9134

You have to connect to the remote computers registry and access it via that object. See the ConnectRegistry function on the doc page.

e.g.,

rem_reg = ConnectRegistry("remotename", HKEY_LOCAL_MACHINE)
rem_reg.OpenKey( ...

ADDED

As long you you have a valid UNC name, have permissions, and have not been blocked by a firewall along the way you should have able to do what you want to the remote registry

Upvotes: 3

Related Questions