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

0
Windows Services

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"

Found priceless insights in this blog? Support the author’s creativity – buy them a coffee!

Leave a Reply

Your email address will not be published. Required fields are marked *