Start all Automatic Services that are currently stopped or not running using PowerShell

After a server reboot I often find that some services don’t start correctly so this script set as a start-up script or manually ran can make sure all services do get started correctly.

1
2
3
4
5
6
7
$computer = (Get-Item env:\Computername).Value
#Start all non-running Auto services
Get-WmiObject win32_service -ComputerName $computer -Filter "startmode = 'auto' AND state != 'running' AND name != 'sppsvc'" | Invoke-WmiMethod -Name StartService

#Output any services still not running
$stoppedServices = Get-WmiObject win32_service -ComputerName $computer -Filter "startmode = 'auto' AND state != 'running' AND name != 'sppsvc'" | select -expand Name
Write-Host "$env:ComputerName : Stopped Services: $stoppedServices"

If you found this article helpful, would you consider buying me a Coffee?