winreg

Finding perfmon counter id via winreg

I have an app that collects Perfmon counter values through the API exposed in winreg.h - in order to collect Perfmon counter values I must make a call to RegQueryValueExW passing in the id of the Perfmon counter I'm interested in, and in order to obtain that ID I need to query the registry for the list of Perfmon counter names and go thr...

Read a single registry key value on a remote machine using python 3

I am having a very tough time achieving this one seemingly very simple goal... I have to gather the value of a single registry key on several machines for the sake of auditing whether the machines scanned need to be patched with newer versions of software. I am only permitted to use python 3 as per our company policy (which is on drugs...

Python: WindowsError when editing Registry values using _winreg on Windows 7

I am trying to execute this script by Ned Batchelder to switch .py file association between my two Python installations on Windows. This Python script uses the _winreg module (winreg in Python 3.x) to edit certain Registry values (the path and value pairs modified can be seen in the todo list in the script). I execute this script as fol...

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

Hi, 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 computer in active_directory.search ("objectCategory='Computer'"): print computer.dis...

Python 2.6 - I can not write dwords greater than 0x7fffffff into registry using _winreg.SetValueEx()

using regedit.exe I have manually created a key in registry called HKEY_CURRENT_USER/00_Just_a_Test_Key and created two dword values dword_test_1 and dword_test_2 I am trying to write some values into those two keys using following program import _winreg aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_CURRENT_USER) aKey = _winreg.O...

python: _winreg problem

the windows registry may contain keys whose names with embedded nulls when i call _winreg.OpenKey(key, subkey_string_with_embbeded_null) i get the following error: TypeError: OpenKey() argument 2 must be string without null bytes or None, not str Q1: is the meaning of the error that python _winreg module has a limitation that it cann...

Getting registry information using Python

I am trying to pull registry info from many servers and put them all into one txt file. I got the code working fine in a .bat file. I hear that there is a way simpler way to do this in Python. I am intrigued and delighted to hear this. Can anyone help finish my code: My working bat file: echo rfsqlcl01app >> foo.txt reg query "\\rfsqlc...

Loop through values or registry key.. _winreg Python

How would I loop through all the values of a Windows Registry Key using the Python module _winreg. I have code that will do what I want, but it is for the subkeys of the specified registry key. Here Is The Code: from _winreg import * t = OpenKey(HKEY_CURRENT_USER, r"PATH TO KEY", 0, KEY_ALL_ACCESS) try: i = 0 while True: ...

Registry Entries for all users in Python

I wrote an application that stores several things in the registry. When I first started, I added them to HKEY_LOCAL_MACHINE, but kept getting permission errors writing to the. So, it was suggested that I use HKEY_CURRENT_USER, that worked until I realized that I am not able to access them from another account. How can I write to the regi...