5

In order to be able to easily detect which of a group of security products is installed on a machine, I would like to be able to filter the Powershell Get-Service output by the Company Name attached to the service, but that information is not included in the Get-Service output. I've also tried using a Get-WmiObject query in place of Get-Service and still no Company Name.

I know the information is available somehow because Process Explorer shows it.

jscott
  • 24,484
  • 8
  • 79
  • 100
Keeloid
  • 105
  • 6
  • Feeling thick this morning ... the answer is to use Get-Process which _does_ output the Company. Severfault wouldn't let me answer my own question yet. – Keeloid Feb 17 '12 at 16:49
  • Don't forget you can also use something like Get-WMIObject -Query "SELECT PathName FROM Win32_Service WHERE Name = 'SmcService'" to get the executable path for a given service, which you can then run Get-Process on. :) – Ryan Ries Feb 17 '12 at 17:06

1 Answers1

3

You may use Get-Process and filter with Where-Object to list process with a specific Company Name:

Get-Process | Where-Object { $_.Company -eq "IBM" }

Would return any process with a company name of IBM exactly. You may also use any of the other comparison/regex operators to alter the fitlering:

Get-Process | Where-Object { $_.Company -like "*ymantec*" }

Would return process with a company name containing ymantec anywhere in the string.

jscott
  • 24,484
  • 8
  • 79
  • 100