# -*- coding: utf-8 -*- from setuphelpers import * uninstallkey = [] # Service to disable disabled_services = [ 'RemoteRegistry', # Remote access to reg 'WMPNetworkSvc', # Windows Media Share 'Mcx2Svc', # Media Center Extender 'WerSvc', # Error reporting 'WPCSvc', # Parental control 'helpsvc', # Help service 'DPS', # Windows Diag service 'SysMain', # SuperFetcher ] def install(): print('Disabling unwanted services') for service in disabled_services: print('Disabling %s' % service) run(r'sc config %s start= disabled' % service, accept_returncodes=[0,1060]) print('Enabling ping response') run(r'netsh firewall set icmpsetting 8 enable') print('Create our local adamin account') run(r'net user rv /add', accept_returncodes=[0,2]) run(r'net localgroup Administrateurs rv /add', accept_returncodes=[0,2]) print('Disabling Windows host script engine') with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'Software\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: reg_setvalue(reg_key, 'Enabled', 0, REG_DWORD) if iswin64(): with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: reg_setvalue(reg_key, 'Enabled', 0, REG_DWORD) def uninstall(): print('Re enabling services') for service in disabled_services: print('Enabling %s' % service) run(r'sc config %s start= auto' % service, accept_returncodes=[0,1060]) print('Enabling Windows Host Script engine') with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'Software\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: reg_setvalue(reg_key, 'Enabled', 1, REG_DWORD) if iswin64(): with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: reg_setvalue(reg_key, 'Enabled', 1, REG_DWORD)