Quantcast
Channel: Just Uber » sysadmin
Viewing all articles
Browse latest Browse all 3

How to read data from a remote Windows registry using Python

$
0
0

It is easy to connect to a remote Windows machine and retrieve information from the registry using the Python Windows registry access module _winreg

from _winreg import *

reg = ConnectRegistry('computer123222', HKEY_LOCAL_MACHINE)
key = OpenKey(reg, 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate',0,KEY_READ)
value = QueryValueEx(key, 'SusClientId')

ConnectRegistry() allows you to specify the remote computer and one of the HKEY constants like HKEY_LOCAL_MACHINE or HKEY_USERS.

OpenKey() specifies the remote registry as the location of the hive), the sub key, an integer of 0 (it  must be 0!) followed by the registry key access rights.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images