winreg

Python winreg looping through sub-keys

眉间皱痕 提交于 2020-07-03 02:24:41
问题 I'm able to successfully retrieve the 5 sub-keys from my windows 7 machine registry hive "HKEY_LOCAL_MACHINE" with the code below. from _winreg import * try: i = 0 while True: subkey = EnumKey(HKEY_LOCAL_MACHINE, i) print subkey i += 1 except WindowsError: pass My question is, how do I then enumerate the keys under those? I want to end up listing all the keys in the SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged folder but I can't figure out how to step my way

python: how to delete registry key (and subkeys) from HKLM (getting error 5)

别说谁变了你拦得住时间么 提交于 2020-06-27 16:15:32
问题 I'm trying to delete certain registry keys, via python script. i have no problems reading and deleting keys from the "HKEY_CURRENT_USER", but trying to do the same from the "HKEY_LOCAL_MACHINE", gives me the dreaded WindowsError: [Error 5] Access is denied . i'm running the script via the IDLE IDE, with admin privileges. here's the code: from _winreg import * ConnectRegistry(None,HKEY_LOCAL_MACHINE) OpenKey(HKEY_LOCAL_MACHINE,r'software\wow6432node\App',0,KEY_ALL_ACCESS) DeleteKey(OpenKey

winreg.OpenKey throws filenotfound error for existing registry keys

扶醉桌前 提交于 2020-01-22 07:38:22
问题 I am facing difficulties in reading a registry key created by my software. However with the same code, I am able to read other keys. installdir = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\MediaPlayer\\Player\\Extensions\\Types" ) #this works perfect #installdir1 = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\MySoftware\\MyEvent\\IS" ) #this gives Filenotfound error # list values owned by this registry key try: i = 0 while 1: name, value, type = winreg.EnumValue

winreg.OpenKey throws filenotfound error for existing registry keys

依然范特西╮ 提交于 2020-01-22 07:38:06
问题 I am facing difficulties in reading a registry key created by my software. However with the same code, I am able to read other keys. installdir = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\MediaPlayer\\Player\\Extensions\\Types" ) #this works perfect #installdir1 = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\MySoftware\\MyEvent\\IS" ) #this gives Filenotfound error # list values owned by this registry key try: i = 0 while 1: name, value, type = winreg.EnumValue

importError: no module named _winreg python3

巧了我就是萌 提交于 2019-12-30 07:53:28
问题 Where can I download _winreg for python3 if I can at all. I have my 'windir' on E:\Windows. I do not know if cx_Freeze did not notice that. I am using cx_Freeze to create an msi installer. 回答1: As it says in the _winreg documentation, it has been renamed to winreg in Python 3.0. You should run the 2to3 tool if you're converting code that was written for Python 2.x. 回答2: I know this is an old question, but this was the first search result when Googling for ModuleNotFoundError: No module named

Python COM server with VBA late biding + skip win register (no admin rights)

瘦欲@ 提交于 2019-12-23 01:18:09
问题 I'm trying to import Python code into in VBA. The code below works but requires admin rights . Is there a way to go around the win register need (assume I just don't have admin rights) but keep the 'late biding' behavior (dont want to Tools>>Reference every time I compile something new) class ProofOfConcept(object): def __init__(self): self.output = [] def GetData(self): with open('C:\Users\MyPath\Documents\COMs\SourceData.txt') as FileObj: for line in FileObj: self.output.append(line) return

How do I add a python script to the startup registry?

江枫思渺然 提交于 2019-12-21 04:57:22
问题 I'm trying to make my python script run upon startup but I get the error message windowserror access denied, but I should be able to make programs start upon boot because teamviewer ( a third-party program I downloaded ) runs every time I restart my computer so I know that I should be able to make my program run at startup (I might be doing something different though, so if you could shed some light on what teamviewer is doing differently to get its script to run at startup that would be

Loop through values or registry key.. _winreg Python

▼魔方 西西 提交于 2019-12-19 15:06:07
问题 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: subkey = EnumValue(t, i) print subkey i += 1 except WindowsError: # WindowsError: [Errno 259] No more data is available pass Oh, figured it out. But, if anyone knows of

ImportError while importing winreg module of python

╄→гoц情女王★ 提交于 2019-12-19 04:52:08
问题 I wanted to use winreg module of python for working with windows registry. But when I try to import winreg module, it gives ImportError. Python 2.4.3 (#1, Dec 11 2006, 11:39:03) [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import __winreg Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named __winreg >>> import _winreg Traceback (most recent call last): File "<stdin>", line 1

Disable registry redirection to Wow6432Node in Python

匆匆过客 提交于 2019-12-11 10:56:27
问题 I'm trying to access registry keys under HKEY_LOCAL_MAHINE\SOFTWARE... on a 64 bits system. I have following code but judging by the results it gets redirected to Wow6432Node even though I have _winreg.DisableReflectionKey(_winreg.OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE")) in my code. import _winreg import wmi c = wmi.WMI(computer="localhost", namespace="root/default").StdRegProv _winreg.DisableReflectionKey(_winreg.OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE")) result, names = c.EnumKey(hDefKey=