PowerShell Genie

PowerShell Services

Find services that need investigation without treating every stopped service as a failure.

Lesson 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Overview

A stopped service is not automatically an incident. Some services start on demand, some are disabled intentionally, and some stop when their work finishes. Begin with the service the application depends on and its expected state.

The example lists stopped services with their names, display names and startup types. The short Name is useful for subsequent commands; DisplayName is intended for people. StartType tells you how startup is configured, not whether the application is currently healthy.

In the browser dataset, WinRM is stopped and configured for manual startup. That observation alone does not justify starting it. First establish whether this machine is meant to accept remote administration.

On a real system, correlate service state with application logs, dependencies and a health check. If a restart is justified, define how you will verify recovery and what evidence to collect before the restart removes the immediate symptom.

See the objects move

Inspect this authored example with fictional data in the bounded browser model. The numbered stages show how its objects change.

Get-Service | Where-Object Status -eq 'Stopped' | Select-Object Name
  1. Stage 1Get-ServicePositional values or no named parameters
  2. Stage 2Where-Object-eq
  3. Stage 3Select-ObjectPositional values or no named parameters

    What happens

    Run the stopped-service query. Change the condition to Running and compare the output. Try selecting only Name and Status, then explain what context you lose by removing StartType.

    Worth remembering

    Service state answers one question. Application health, startup policy and dependency availability need separate checks.

    Primary documentation

    Microsoft Learn: get-service

    Try it

    Browser simulation · fictional data; no changes to your computer.

    Your task: Return only the stopped service names. Keep Name in the result. Explain why this list alone does not prove those services should be started.

    Interactive simulation · fictional data
    Hint

    Filter on Status before selecting Name.

    Compare a solution
    Get-Service | Where-Object Status -eq 'Stopped' | Select-Object Name

    Finds automatic services that are not running.

    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name   DisplayName                StartType
    -----  -------------------------  ---------
    WinRM  Windows Remote Management  Manual   

    Practise this

    Find stopped automatic services

    Return Name and StartType for stopped services with StartType Automatic.

    Review the lesson

    Keep going

    Next: PowerShell Processes
    Genie guidePowerShell Services

    Find services that need investigation without treating every stopped service as a failure.