Match formatting when enabling Windows Updates
This commit is contained in:
parent
3f96a31e1e
commit
1e21b1bd59
2 changed files with 16 additions and 8 deletions
|
|
@ -71,7 +71,7 @@ def enable_service(service_name, start_type='auto'):
|
||||||
run_program(['sc', 'config', service_name, 'start=', start_type])
|
run_program(['sc', 'config', service_name, 'start=', start_type])
|
||||||
|
|
||||||
|
|
||||||
def enable_windows_updates():
|
def enable_windows_updates(silent=False):
|
||||||
"""Enable windows updates"""
|
"""Enable windows updates"""
|
||||||
indent=2
|
indent=2
|
||||||
width=52
|
width=52
|
||||||
|
|
@ -81,6 +81,13 @@ def enable_windows_updates():
|
||||||
start_type = 'auto'
|
start_type = 'auto'
|
||||||
if service == 'wuauserv':
|
if service == 'wuauserv':
|
||||||
start_type = 'demand'
|
start_type = 'demand'
|
||||||
|
if silent:
|
||||||
|
try:
|
||||||
|
enable_service(service, start_type=start_type)
|
||||||
|
except Exception:
|
||||||
|
# Try again
|
||||||
|
enable_service(service, start_type=start_type)
|
||||||
|
else:
|
||||||
result = try_and_print(
|
result = try_and_print(
|
||||||
'Enabling service {}...'.format(service),
|
'Enabling service {}...'.format(service),
|
||||||
indent=indent, width=width,
|
indent=indent, width=width,
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,8 @@ if __name__ == '__main__':
|
||||||
function=enable_system_restore, cs='Done')
|
function=enable_system_restore, cs='Done')
|
||||||
try_and_print(message='Create System Restore point...',
|
try_and_print(message='Create System Restore point...',
|
||||||
function=create_system_restore_point, cs='Done')
|
function=create_system_restore_point, cs='Done')
|
||||||
enable_windows_updates()
|
try_and_print(message='Enabling Windows Updates...',
|
||||||
|
function=enable_windows_updates, cs='Done', silent=True)
|
||||||
try_and_print(message='Updating Clock...',
|
try_and_print(message='Updating Clock...',
|
||||||
function=update_clock, cs='Done')
|
function=update_clock, cs='Done')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue