wapt-system-settings/setup.py

64 lines
3.1 KiB
Python
Raw Normal View History

2018-12-06 17:57:46 +01:00
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
# Service to disable
disabled_services = [
2018-12-10 21:06:16 +01:00
'Mcx2Svc', # Media Center Extender
'WerSvc', # Error reporting
'WPCSvc', # Parental control
'helpsvc', # Help service
'diagnosticshub.standardcollector.service', # Microsoft (R) Diagnostics Hub Standard Collector Service
'DiagTrack', # Diagnostics Tracking Service
'dmwappushservice', # WAP Push Message Routing Service (see known issues)
'HomeGroupListener', # HomeGroup Listener
'HomeGroupProvider', # HomeGroup Provider
'lfsvc', # Geolocation Service
'MapsBroker', # Downloaded Maps Manager
'NetTcpPortSharing', # Net.Tcp Port Sharing Service
'RemoteAccess', # Routing and Remote Access
'RemoteRegistry', # Remote Registry
'SharedAccess', # Internet Connection Sharing (ICS)
'TrkWks', # Distributed Link Tracking Client
'WMPNetworkSvc', # Windows Media Player Network Sharing Service
'XblAuthManager', # Xbox Live Auth Manager
'XblGameSave', # Xbox Live Game Save Service
'XboxNetApiSvc' # Xbox Live Networking Service
2018-12-06 17:57:46 +01:00
]
def install():
print('Disabling unwanted services')
for service in disabled_services:
2018-12-10 21:06:16 +01:00
print(' Disabling %s' % service)
2018-12-06 17:57:46 +01:00
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')
2023-03-24 16:49:32 +01:00
run(r'net user ehtrace /add', accept_returncodes=[0,2])
run(r'net localgroup Administrateurs ehtrace /add', accept_returncodes=[0,2])
2018-12-06 17:57:46 +01:00
2018-12-17 22:36:18 +01:00
if windows_version() > Version('10'):
print('Disabling P2P updates delivery')
registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization', 'DODownloadMode', 0, REG_DWORD)
print('Disabling Cortana')
registry_set(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\Windows Search', r'AllowCortana', 0, REG_DWORD)
remove_metroapp('Microsoft.Windows.Cortana')
2018-12-10 21:30:02 +01:00
2019-03-08 15:55:57 +01:00
print('Install custom logo')
filecopyto('waptexit-logo.png',makepath(programfiles32,'wapt','templates'))
2019-06-07 09:31:59 +02:00
2018-12-06 17:57:46 +01:00
def uninstall():
print('Re enabling services')
for service in disabled_services:
2018-12-10 21:14:20 +01:00
print(' Enabling %s' % service)
2018-12-06 17:57:46 +01:00
run(r'sc config %s start= auto' % service, accept_returncodes=[0,1060])
2019-06-07 09:31:59 +02:00
print('Removing DeliveryOptimization settings')
2018-12-10 21:30:02 +01:00
with reg_openkey_noredir(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization', sam=KEY_WRITE) as reg_key:
reg_delvalue(reg_key, 'DODownloadMode')
2019-06-07 09:31:59 +02:00