'How would you programmatically report which Windows Services are not running?

Given:

  • PowerShell 5.1 or above
  • Cmdlet Get-Service
  • Windows OS
  • Windows Services

How would you programmatically report if a Window Services is Stopped?

enter image description here



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mathias R. Jessen