General system settings for WAPT
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

64 行
3.4 KiB

# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
# Service to disable
disabled_services = [
'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
]
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')
registry_setstring(HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows Script Host\Settings', 'Enabled', 0, REG_DWORD)
if iswin64():
registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', 'Enabled', 0, REG_DWORD)
print('Disabling P2P updates delivery')
registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization', 'DODownloadMode', 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')
registry_setstring(HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows Script Host\Settings', 'Enabled', 1, REG_DWORD)
if iswin64():
registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', 'Enabled', 1, REG_DWORD)
prin('Removing DeliveryOptimization settings')
with reg_openkey_noredir(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization', sam=KEY_WRITE) as reg_key:
reg_delvalue(reg_key, 'DODownloadMode')