Sep-05-2017, 06:48 PM
Hey everyone, I am a total noob when it comes to programming but I try when asked. I am currently looking at a new software package and it uses python to push out scripts. I tried to make my own script to change the startup type from Automatic to Automatic (delayed), but even though the software program shows that the script was successful the service type never changes. I was able to put together most of the script from here "https://stackoverflow.com/questions/15128225/python-script-to-read-and-write-a-path-to-registry (thanks to hugo24) and then pieced some other parts together. At first it was failing at various points (line 5, 6, etc.) but I was able to research and figure out those errors.
Can someone help me determine why the script is showing success but not doing anything? Thank you in advance.
Phil
Can someone help me determine why the script is showing success but not doing anything? Thank you in advance.
Phil

def set_reg(name, value): try: winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\*Service*", 0, winreg.KEY_ALL_ACCESS) key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\*Service*", 0, winreg.KEY_ALL_ACCESS) winreg.SetValueEx(key, Start, 0, winreg.REG_DWORD, 0x00000001) winreg.CloseKey(key) return True except WindowsError: return False def get_reg(name): try: key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\*Service*", 0, winreg.KEY_ALL_ACCESS) value, regtype = winreg.QueryValueEx(key, name) winreg.CloseKey(key) return value except WindowsError: return None