Given:
- PowerShell 5.1 or above
- Cmdlet Get-Service
- Windows OS
- Windows Services
How would you programmatically report if a Window Services is Stopped?
>Solution :
If you want to start them all, use the Where-Object cmdlet to filter the list of services so you only get those that:
- Are not running, and
- Are not disabled
Then pipe the resulting set of services to Start-Service:
Get-Service |Where-Object Status -ne Running |Where-Object StartType -ne Disabled |Start-Service
