Map Windows services to processes, accounts, and start modes
Build a paste-ready command, then review its compatibility and effects before running it.
Get-CimInstance Win32_Service | Sort-Object State,Name | Select-Object Name,State,StartMode,StartName,ProcessId,@{N='Process';E={(Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue).ProcessName}} | Format-Table -AutoSizeread-onlyno known side effects Compatibility
WindowsVerified for Windows using powershell syntax.
Operational knowledgereview due 2027-01-19
RequirementsGet-CimInstanceGet-CimInstance must be installed and available on PATH.
Version supportGet-CimInstance Current supported releasesVerified for windows using powershell syntax; consult compatibility notes for platform-specific differences.
Expected signalsName State StartMode StartName ProcessId ProcessRepresentative successful output; values vary with the selected target and system state.
Known errorsGet-CimInstance: command not foundGet-CimInstance is missing or is not available on PATH.
VerifyGet-CimInstance Win32_Service | Sort-Object State,Name | Select-Object Name,State,StartMode,StartName,ProcessId,@{N='Process';E={(Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue).ProcessName}} | Format-Table -AutoSizeThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01Get-CimInstanceCommandRuns the Get-CimInstance stage of this one-liner.
02Win32_ServiceArgumentPasses Win32_Service to Get-CimInstance.
03|PipelinePasses the output on the left to the command on the right.
04Sort-ObjectCommandRuns the Sort-Object stage of this one-liner.
05State,NameArgumentPasses State,Name to Sort-Object.
06|PipelinePasses the output on the left to the command on the right.
07Select-ObjectCommandRuns the Select-Object stage of this one-liner.
08Name,State,StartMode,StartName,ProcessId,@{N='Process'ArgumentPasses Name,State,StartMode,StartName,ProcessId,@{N='Process' to Select-Object.
09;Command separatorEnds this shell statement before the next one begins.
10E={(Get-ProcessVariable assignmentSets a value used by the commands that follow.
11-IdCommandRuns the -Id stage of this one-liner.
12$_.ProcessIdVariableExpands a value from the current shell environment or loop.
13-ErrorActionOptionConfigures -Id with the -ErrorAction option.
14SilentlyContinue).ProcessName}}ArgumentPasses SilentlyContinue).ProcessName}} to -Id.
15|PipelinePasses the output on the left to the command on the right.
16Format-TableCommandRuns the Format-Table stage of this one-liner.
17-AutoSizeOptionConfigures Format-Table with the -AutoSize option.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
Get-CimInstance Win32_Service | Sort-Object State,Name | Select-Object Name,State,StartMode,StartName,ProcessId,@{N='Process';E={(Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue).ProcessName}} | Format-Table -AutoSize
Example output
Name State StartMode StartName ProcessId Process
---- ----- --------- --------- --------- -------
Dnscache Running Auto NT AUTHORITY\NetworkService 1184 svchost
Spooler Running Auto LocalSystem 1620 spoolsv
Illustrative output — exact values vary by system and data.
Official sources