Key_Name = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, Key_Name, 0, winreg.KEY_ALL_ACCESS)
winreg.DeleteKey(key, 'DisableTaskMgr')

winreg.CloseKey(key)
Traceback (most recent call last):
  File "C:\Users\Tap1x\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Tap1x\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 444, in main
    run()
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "C:\Users\Tap1x\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 269, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\Tap1x\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\Tap1x\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Tap1x\source\repos\White_rabbit_AdminStart\White_rabbit_AdminStart.py", line 17, in <module>
    winreg.DeleteKey(key, 'DisableTaskMgr')
FileNotFoundError: [WinError 2] Не удается найти указанный файл
0

There are 0 best solutions below