WizardKit/.bin/Scripts/windows_updates.py
2019-01-08 21:34:24 -07:00

48 lines
1.2 KiB
Python

# 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