[SOLVED] registry_set not working?
Published: June 5, 2019 - 11:39
Hello everyone,
Currently on servers
WAPT Server version: 1.7.4
WAPT Agent version: 1.7.4.6077
WAPT Setup version: 1.7.4.6077
WAPT Deploy version: 1.7.4.6077
Database status: OK (1.7.4.0)
I have this new script to block automatic Windows 10 restarts with Windows Update
I've tried changing the path using backslashes (\\) and removing the 'r' in front (which, by the way, I don't understand the purpose of), but I still get this error when trying to run it locally via Pyscripter:
And I get a similar error if I try to deploy it via the console afterwards:
Thank you, best regards,
Renaud.
Currently on servers
WAPT Server version: 1.7.4
WAPT Agent version: 1.7.4.6077
WAPT Setup version: 1.7.4.6077
WAPT Deploy version: 1.7.4.6077
Database status: OK (1.7.4.0)
I have this new script to block automatic Windows 10 restarts with Windows Update
Code: Select all
from setuphelpers import *
#list de paquets à oublier tout simplement.
uninstallkey = []
#def main():
def install():
if(windows_version() >= Version('10.0')):
print('is windows 10')
#reg
registry_set('HKEY_LOCAL_MACHINE',r'SOFTWARE/Policies/Microsoft/Windows/WindowsUpdate/AU','NoAutoRebootWithLoggedOnUsers',1,type=REG_DWORD)
# registry_set(HKEY_LOCAL_MACHINE, r'SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System','MaxGPOScriptWait',180,type=REG_DWORD)
print('key set. reboot required to be taken in count.')
else:
print('not w10')
if __name__ == '__main__': #run debug
install()
def uninstall():
if(reg_key_exists('HKEY_LOCAL_MACHINE',r'SOFTWARE/Policies/Microsoft/Windows/WindowsUpdate/AU','NoAutoRebootWithLoggedOnUsers')):
registry_set('HKEY_LOCAL_MACHINE',r'SOFTWARE/Policies/Microsoft/Windows/WindowsUpdate/AU','NoAutoRebootWithLoggedOnUsers',0,type=REG_DWORD)*** Remote Interpreter Reinitialized ***
is windows 10
Traceback (most recent call last):
File "C:\waptdev\ymg-WU10-autorebootblock-wapt\setup.py", line 23, in
install()
File "C:\waptdev\ymg-WU10-autorebootblock-wapt\setup.py", line 17, in install
registry_set('HKEY_LOCAL_MACHINE',r'SOFTWARE/Policies/Microsoft/Windows/WindowsUpdate/AU','NoAutoRebootWithLoggedOnUsers',1,type=REG_DWORD)
File "C:\Program Files (x86)\wapt\setuphelpers.py", line 1654, in registry_set
with reg_openkey_noredir(root,path,sam=KEY_WRITE,create_if_missing=True) as key:
File "C:\Program Files (x86)\wapt\setuphelpers.py", line 1431, in reg_openkey_noredir
result = _winreg.OpenKey(rootkey,subkeypath,0, sam | _winreg.KEY_WOW64_64KEY)
TypeError: The object is not a PyHKEY object
And I get a similar error if I try to deploy it via the console afterwards:
Could this be a permissions error?is windows 10Traceback (most recent call last):
File "C:\Program Files (x86)\wapt\common.py", line 3818, in install_wapt
exitstatus = setup.install()
File "c:\users\rcu\appdata\local\temp\waptx2yigf\setup.py", line 17, in install
File "C:\Program Files (x86)\wapt\setuphelpers.py", line 1654, in registry_set
with reg_openkey_noredir(root,path,sam=KEY_WRITE,create_if_missing=True) as key:
File "C:\Program Files (x86)\wapt\setuphelpers.py", line 1431, in reg_openkey_noredir
result = _winreg.OpenKey(rootkey,subkeypath,0, sat | _winreg.KEY_WOW64_64KEY)
TypeError: The object is not a PyHKEY object
TypeError: The object is not a PyHKEY object
Thank you, best regards,
Renaud.