Created
February 26, 2026 18:44
-
-
Save st1vms/db493ea7f32117679bdc12e2446c8e9e to your computer and use it in GitHub Desktop.
Save&Restore Windows Disabled Services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Save&Restore Windows Disabled Services |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $myList = Import-Csv "$env:USERPROFILE\Desktop\DisabledServices.csv" | |
| foreach ($item in $myList) { | |
| $serviceName = $item.Name | |
| # Check if the service actually exists before disabling it | |
| if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) { | |
| Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\$serviceName" -Name "Start" -Value 4 | |
| Write-Host "Disabled service: $serviceName" -ForegroundColor Green | |
| } else { | |
| Write-Host "Skipping service: $serviceName (not found)" -ForegroundColor Red | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-Service -ErrorAction SilentlyContinue | Where-Object {$_.StartType -eq 'Disabled'} | Select-Object Name, DisplayName | Export-Csv -Path "$env:USERPROFILE\Desktop\DisabledServices.csv" -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment