Why stopped is before running for the service status in Powershell?


List all services, including only the service names and statuses. Have running services listed before stopped services.


When I run:
Get-Service | Select –Property Name,Status | Sort –Property Status

I get Stopped services before Running services. Remember that Sort in Powershell is the same as that in other places, ascending by default. Running should be before Stopped, right?


I dig into the status property ServiceController.Status Property and 

ServiceControllerStatus Enumeration, and find the table below. The table shows Stopped is 0x00000001,and running is 0x00000004. I suspect the sorting on status is based on these values, rather than based on the literals.

Member nameDescription
ContinuePendingThe service continue is pending. This corresponds to the Win32 SERVICE_CONTINUE_PENDING constant, which is defined as 0x00000005.
PausedThe service is paused. This corresponds to the Win32 SERVICE_PAUSED constant, which is defined as 0x00000007.
PausePendingThe service pause is pending. This corresponds to the Win32 SERVICE_PAUSE_PENDING constant, which is defined as 0x00000006.
RunningThe service is running. This corresponds to the Win32 SERVICE_RUNNING constant, which is defined as 0x00000004.
StartPendingThe service is starting. This corresponds to the Win32 SERVICE_START_PENDING constant, which is defined as 0x00000002.
StoppedThe service is not running. This corresponds to the Win32 SERVICE_STOPPED constant, which is defined as 0x00000001.
StopPendingThe service is stopping. This corresponds to the Win32 SERVICE_STOP_PENDING constant, which is defined as 0x00000003.