parent
a643b38bbe
commit
171eb0722f
2 changed files with 39 additions and 20 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Reference in a new issue