diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index 915e8407..c24a7cd3 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -180,6 +180,43 @@ def config_classicstart(): sleep(1) popen_program(cs_exe) +def config_explorer_system(): + """Configure Windows Explorer for all users via Registry settings.""" + write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True) + +def config_explorer_user(): + """Configure Windows Explorer for current user via Registry settings.""" + write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False) + +def enable_system_restore(): + """Enable System Restore and set disk usage to 5%""" + cmd = [ + 'PowerShell', + '-Command', 'Enable-ComputerRestore', + '-Drive', '{}\\'.format(global_vars['Env']['SYSTEMDRIVE'])] + run_program(cmd) + + # Set disk usage + cmd = [ + r'{}\System32\vssadmin.exe'.format(global_vars['Env']['SYSTEMROOT']), + 'resize', 'shadowstorage', + '/on={}'.format(global_vars['Env']['SYSTEMDRIVE']), + '/for={}'.format(global_vars['Env']['SYSTEMDRIVE']), + '/maxsize=5%'] + run_program(cmd) + +def update_clock(): + """Set Timezone and sync clock.""" + run_program(['tzutil' ,'/s', WINDOWS_TIME_ZONE], check=False) + run_program(['net', 'stop', 'w32ime'], check=False) + run_program( + ['w32tm', '/config', '/syncfromflags:manual', + '/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"', + ], + check=False) + run_program(['net', 'start', 'w32ime'], check=False) + run_program(['w32tm', '/resync', '/nowait'], check=False) + def write_registry_settings(settings, all_users=False): """Write registry values from custom dict of dicts.""" hive = HKCU @@ -199,26 +236,6 @@ def write_registry_settings(settings, all_users=False): for name, value in v.get('SZ Items', {}).items(): winreg.SetValueEx(key, name, 0, winreg.REG_SZ, value) -def config_explorer_system(): - """Configure Windows Explorer for all users via Registry settings.""" - write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True) - -def config_explorer_user(): - """Configure Windows Explorer for current user via Registry settings.""" - write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False) - -def update_clock(): - """Set Timezone and sync clock.""" - run_program(['tzutil' ,'/s', WINDOWS_TIME_ZONE], check=False) - run_program(['net', 'stop', 'w32ime'], check=False) - run_program( - ['w32tm', '/config', '/syncfromflags:manual', - '/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"', - ], - check=False) - run_program(['net', 'start', 'w32ime'], check=False) - run_program(['w32tm', '/resync', '/nowait'], check=False) - # Installations def install_adobe_reader(): """Install Adobe Reader.""" diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index a70d3e3d..fed6e458 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -47,6 +47,8 @@ if __name__ == '__main__': function=config_explorer_system, cs='Done') try_and_print(message='Updating Clock...', function=update_clock, cs='Done') + try_and_print(message='Enabling System Restore...', + function=enable_system_restore, cs='Done') # Cleanup print_info('Cleanup')