Still really new to Python and I'm trying to write a script that will allow me to change specific registry keys on a remote machine and I'm having some trouble with it. Basically the code I have runs with no errors, but the key value is also not set. I'm running it from Windows command prompt as Administrator, using an account that has admin rights on the target machine. Here's the relevant code:
registry = winreg.ConnectRegistry(fullSysName, winreg.HKEY_LOCAL_MACHINE)
wholeKey = winreg.OpenKey(registry, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", 0, winreg.KEY_ALL_ACCESS)
print('Setting AutoAdminLogon\n')
winreg.SetValue(wholeKey, 'AutoAdminLogon', winreg.REG_SZ, '1')
winreg.CloseKey(wholeKey)
winreg.CloseKey(registry)
fullSysName is a variable that contains the target machine name derived from earlier in the script. The script runs with no errors, and I have admin rights, so I am at a loss as to why it's not working. Ended up with some Powershell to do it, but it bothers me that I can't get this to work and would at least like to understand why. I've confirmed that it doesn't have an effect even when I manually replace 'fullSysName' with the machine name. Appreciate any tips you're able to provide!