Questions tagged [winreg]

_winreg is the python module for Windows registry access. This module provides a low-level interface to the Windows registry database. The interface directly mirrors the underlying Windows API.

_winreg (renamed to winreg in Python 3) is the python module for Windows registry access. The functions in this module expose the Windows registry API to Python. Rather than using an integer as the registry handle, a handle object is used to ensure that the handles are closed correctly, even if the programmer neglects to explicitly close them.

For a complete reference, please see the python documentation at docs.python.org.

160 questions
0
votes
1 answer

Using winreg for getting GPU details

I'm using winreg in python 3.4 to get windows registry values. I already set up a system to get CPU informations (cpu name, max frequency, etc.) and i'm trying to adapt it to get GPU informations. The only problem is that the key that contain the…
0
votes
1 answer

python 27, _winreg() not fully supports read/write Unicode string to registry

I did some tests as the image attached. test result image I could create a new folder named "新資料夾" on the OS. and new a new REG_SZ, the value is "新資料夾" in registry editor manually. But it writes a question mark string ????? by python 27, …
0
votes
1 answer

_winreg.EnumKey(key, i) does not workng?

Hy, I trying to reconstruate a script. And in python 3 I used _winreg and the script was working, but I need it in python 2 and now I get this erorr: File "discoverNetworks.py", line 14, in printNets guid = _winreg.EnumKey(key, i) WindowsError:…
Junior
  • 1
  • 2
0
votes
1 answer

_winreg CreateKey function in Python doesn't work

I have a piece of code that creates a registry key and changes value in it. Although it work perfectly fine in my system but it fails when ran on any other system. keyVal= r'Software\Microsoft\Windows\CurrentVersion\Policies' key2change=…
Akash Singh
  • 63
  • 2
  • 12
0
votes
0 answers

Robot ValueError: Cannot represent value as binary

i need help I have a problem with getting dictionary of registry (name and value) Robot Framework return this error ValueError: Cannot represent u'"=f\xd8\u0152\xc4R\xd9\xd4\u2021\xb20\xd0\xf5\xef\x0fx\xbc\x0b\x06' as binary. i have a function which…
0
votes
0 answers

Python Read Registry - QueryValueEx value_name options

I'm trying to collect a list of available value_names to query with QueryValueExas in this post: Python code to read registry The value_name string options I've seen are DisplayName (which works), Description, InstallRoot, DeviceID, DeviceGUID (all…
ionalchemist
  • 398
  • 2
  • 17
0
votes
1 answer

access denied when reading remote registry on the windows domain with _winreg in Python

I have domain administrator access to the remote computer that I'm trying to read registry on with the following code: import _winreg rem_reg = _winreg.ConnectRegistry(r"\\REMOTECOMPUTER", _winreg.HKEY_LOCAL_MACHINE) regKey =…
Onedot618
  • 273
  • 2
  • 13
0
votes
1 answer

Python _winreg folder

I am currently trying to use python to search through registry entries using _winreg. This is my code: from _winreg import * import getpass compName = raw_input("What is the name of the PC you wish to get a list of?: ") currentUser =…
user1145909
0
votes
3 answers

Unable to access registry under HKLM/SOFTWARE on a 64 bit platform

I was trying to access a custom registry on Win 7 64 bit machine, but every time I try to do that it throws an error saying that WindowsError: [Error2] The system cannot find the file specified The registry that I was trying to access…
Umang Agrawal
  • 475
  • 1
  • 5
  • 15
0
votes
3 answers

NameError: name 'OpenKey' is not defined using winreg

In Python, I'm trying to open a regedit Key to add String value to it. However, it's somehow not recognizing the OpenKey() or ConnectRegistry method. import winreg import sys #Create 2 keys with unique GUIDs as Names KeyName1 =…
jerryh91
  • 1,777
  • 10
  • 46
  • 77
0
votes
1 answer

How do you print network history using _winreg in Python?

I'm trying to print out the network history saved in the Windows Registry and am running into a snag. I have two functions. One to convert the binary text, and the second to get the actual data. Here is what I have: def val2addr(val): addr =…
RabidGorilla
  • 107
  • 2
  • 10
0
votes
1 answer

Python _winreg error accessing windows version on windows 8

I can see the value in my registry editor and the path is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion. I want to print the product name which I can see is Windows 8, but when I am running my program to get the…
rishabhr0y
  • 838
  • 1
  • 9
  • 14
0
votes
2 answers

How to use Python to get local admins from a computer on the Network?

I need to get a list of all people in the company who have local admin rights on their computers. We have a group on each machine called "Administrators." I can get a list of all computers from active directory with: import active_directory for…
Adrian
  • 1
  • 1
0
votes
2 answers

Python 'import X as Y' results in 'NameError global name 'Y' is not defined

I'm new to python and trying to wrap my head around this error from the code below: try: import _winreg as winreg except ImportError: pass ... path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM' try: key =…
Erik
  • 898
  • 2
  • 8
  • 28
0
votes
0 answers

regedit still shows deleted keys even after rebooting

I am using winreg.DeleteKey to delete keys from the registry. I have no problems using the API; however I'm getting a weird problem where, if I delete a key from HKEY_LOCAL_MACHINE\SOFTWARE, the code successfully runs and deletes (and if i run it…
sugarmuff
  • 435
  • 5
  • 17
1 2 3
10
11