Identifying Services by ProcessID

by Sep 14, 2015

Group-Object is a great cmdlet to create lookup tables. If you wanted to identify a Windows service by its process ID, here is a way:

$serviceList = Get-WmiObject -Class Win32_Service | Group-Object -Property ProcessID -AsString -AsHashTable

Once the variable is filled, simply use the process ID as property:

PS> $serviceList.672

ExitCode  : 0
Name      : WSearch
ProcessId : 672
StartMode : Auto
State     : Running
Status    : OK

Twitter This Tip! ReTweet this Tip!