22 lines
531 B
PowerShell
22 lines
531 B
PowerShell
|
# Retrieve all respective services (by ID)
|
||
|
$GetServiceSplat = @{
|
||
|
Name = @(
|
||
|
'wuauserv'
|
||
|
'W3SVC',
|
||
|
'XboxGipSvc',
|
||
|
'XblGameSave'
|
||
|
)
|
||
|
ErrorAction = 'SilentlyContinue'
|
||
|
}
|
||
|
$Services = Get-Service @GetServiceSplat
|
||
|
|
||
|
# Stop and disable all respective services
|
||
|
ForEach ($Service in $Services) {
|
||
|
$SetServiceSplat = @{
|
||
|
Name = $Service.Name
|
||
|
Status = 'Stopped'
|
||
|
StartupType = 'Disabled'
|
||
|
ErrorAction = 'SilentlyContinue'
|
||
|
}
|
||
|
Set-Service @SetServiceSplat
|
||
|
}
|