From 8fef0a8e2f4c12a1a67adbaf2f8c84a5055ba1ef Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 8 Jan 2019 21:34:24 -0700 Subject: [PATCH] Added windows_updates.py --- .bin/Scripts/settings/launchers.py | 14 +++++++++ .bin/Scripts/windows_updates.py | 48 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .bin/Scripts/windows_updates.py diff --git a/.bin/Scripts/settings/launchers.py b/.bin/Scripts/settings/launchers.py index a1f29683..ae5db2e3 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -77,6 +77,20 @@ LAUNCHERS = { 'L_ITEM': 'user_checklist.py', 'L_ARGS': 'd7mode', }, + 'Disable Windows Updates': { + 'L_TYPE': 'PyScript', + 'L_PATH': 'Scripts', + 'L_ITEM': 'windows_updates.py', + 'L_ARGS': '--disable', + 'L_ELEV': 'True', + }, + 'Enable Windows Updates': { + 'L_TYPE': 'PyScript', + 'L_PATH': 'Scripts', + 'L_ITEM': 'windows_updates.py', + 'L_ARGS': '--enable', + 'L_ELEV': 'True', + }, }, r'Data Recovery': { 'PhotoRec (CLI)': { diff --git a/.bin/Scripts/windows_updates.py b/.bin/Scripts/windows_updates.py new file mode 100644 index 00000000..53ab7172 --- /dev/null +++ b/.bin/Scripts/windows_updates.py @@ -0,0 +1,48 @@ +# Wizard Kit: Windows updates + +import os +import sys + +# Init +sys.path.append(os.path.dirname(os.path.realpath(__file__))) +from functions.windows_updates import * +init_global_vars() +os.system('title {}: Windows Updates Tool'.format(KIT_NAME_FULL)) +set_log_file('Windows Updates Tool.log') + +if __name__ == '__main__': + try: + clear_screen() + print_info('{}: Windows Updates Tool\n'.format(KIT_NAME_FULL)) + + # Check args + if '--disable' in sys.argv: + result = try_and_print( + message='Disabling Windows Updates...', + function=disable_windows_updates) + elif '--enable' in sys.argv: + result = try_and_print( + message='Enabling Windows Updates...', + function=enable_windows_updates) + else: + print_error('Bad mode.') + abort() + + # Check for errors + if not result['CS']: + for line in str(result['Error']).splitlines(): + print_standard(line) + print_standard(' ') + print_error('Error(s) encountered, see above.') + print_standard(' ') + pause('Press Enter to exit... ') + exit_script(1) + + # Done + exit_script() + except SystemExit: + pass + except: + major_exception() + +# vim: sts=2 sw=2 ts=2