diff --git a/.bin/Scripts/functions/windows_updates.py b/.bin/Scripts/functions/windows_updates.py index 3618fbb2..3d72f90b 100644 --- a/.bin/Scripts/functions/windows_updates.py +++ b/.bin/Scripts/functions/windows_updates.py @@ -1,5 +1,7 @@ # Wizard Kit: Functions - Windows updates +import pathlib + from functions.common import * @@ -63,7 +65,11 @@ def disable_windows_updates(): indent=indent, width=width, function=delete_folder, folder_path=folder_path) if not result['CS']: - raise GenericError('Failed to remove folder {}'.format(folder_path)) + try: + new_path = pathlib.path(folder_path).with_suffix('.bak') + os.rename(folder_path, new_path) + except OSError: + raise GenericError('Failed to remove folder {}'.format(folder_path)) def enable_service(service_name, start_type='auto'):