I have recently migrated to windows 7 from Windows XP. My organization enables UAC (level 3) at the group policy level and therefore I cannot disable it. I would like to know where there is a method to make registry changes using a python script without disabling UAC. For example, I can read registry hives and keys but I cannot write to them:
import _winreg # Successful read RegConn = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) keyStr = r'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1033' key = _winreg.OpenKey(RegConn, keyStr, 0, _winreg.KEY_READ | _winreg.KEY_WOW64_32KEY) print _winreg.QueryValueEx(key, "Version")[0] # Unsuccessful write x = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) y = _winreg.OpenKey(x, r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", 0, _winreg.KEY_ALL_ACCESS) _winreg.SetValueEx(y, "path", 0, _winreg.REG_EXPAND_SZ,path + ";C:\\test") _winreg.CloseKey(y) _winreg.CloseKey(x) I have compiled my code as an EXE and created a manifest and using the trustinfo xml node, but this will also not work for me. I am always logged in as an administrator. Can anyone provide me with some suggestions on how I can work through this. Also, on a personal Windows 7 64bit machine, if I disable UAC, I can successfully write to the registry. Thank you, Mike _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32