-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisable-UnneededServices.ps1
More file actions
executable file
·59 lines (50 loc) · 2.09 KB
/
Copy pathDisable-UnneededServices.ps1
File metadata and controls
executable file
·59 lines (50 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#requires -RunAsAdministrator
<#
Script: Disable-UnneededServices.ps1
License: MIT
Purpose: Disable or set to manual services that are unnecessary for most standalone Windows 11 systems.
Params:
-DryRun : Only shows what would be changed, does not apply
#>
param([switch]$DryRun)
$ScriptRoot = $PSScriptRoot
if (-not $ScriptRoot) { $ScriptRoot = "." }
. "$ScriptRoot\Utils.ps1"
Assert-Admin
Start-Log "Disable-UnneededServices"
# --- Candidate services to disable (safe on most personal machines) ---
$DisableList = @(
'DiagTrack', # Connected User Experiences / Telemetry
'dmwappushsvc', # Device Management Wireless App Push
'MapsBroker', # Downloaded Maps Manager
'Fax',
'RetailDemo', # Demo mode
'RemoteRegistry',
'SharedAccess', # ICS (Internet Connection Sharing)
'WMPNetworkSvc', # Windows Media Player Network Sharing
'XblAuthManager', # Xbox Live Auth
'XblGameSave', # Xbox Live Game Save
'XboxNetApiSvc', # Xbox Networking
'XboxGipSvc', # Xbox Accessory Management
'PrintNotify', # Print Spooler Notification (if no printer)
'Spooler' # Print Spooler (disable if you never print)
)
# --- Candidate services to set Manual (they start only if needed) ---
$ManualList = @(
'WerSvc', # Windows Error Reporting
'WSearch', # Windows Search (indexing) – Manual if you want lighter disk usage
'SysMain', # Superfetch – Manual for SSD systems
'TabletInputService', # Touch Keyboard / handwriting panel
'TrkWks', # Distributed Link Tracking Client
'PhoneSvc', # Phone Service
'OneSyncSvc*' # Contact/Calendar sync
)
Write-Step "Applying service hardening..."
foreach($svc in $DisableList){
Set-ServiceState -Name $svc -StartupType 'Disabled' -Stop -DryRun:$DryRun
}
foreach($svc in $ManualList){
Set-ServiceState -Name $svc -StartupType 'Manual' -DryRun:$DryRun
}
Write-Step "Done."
Stop-Log