Skip to content

Instantly share code, notes, and snippets.

@vpetrigo
Created June 19, 2015 11:10
Show Gist options
  • Save vpetrigo/eb8d3104cbbec6a52017 to your computer and use it in GitHub Desktop.
Save vpetrigo/eb8d3104cbbec6a52017 to your computer and use it in GitHub Desktop.
Python retrieve data from windows registry
"""
Passing through a Windows registry key entry
Provide a needed registry key and a sub_key you want to retrieve values from
"""
path = r'HARDWARE\DEVICEMAP...'
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path) as key:
sub_keys, values, modified = winreg.QueryInfoKey(key)
for i in range(values):
print(winreg.EnumValue(key, i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment