Is there a way to find out using Powershell which running services are non-native to Windows ? In other words, services that aren't part Windows OS and are non-Microsoft. I want to find out all the services that were installed by our vendors.
Finding out running services is easy:
Get-Service | Where-Object {$_.Status -eq "Running"}
You can't do with it
Get-Service
alone, because even though the service-info objects it outputs have a.BinaryPathName
property, that property is available in PowerShell Core only and it is not necessarily the true service binary, which is often a DLL hosted by the genericsvchost.exe
service host.To find the binary file path in all cases, you must (also) query the service definitions in the registry. Once you have the file path, you can use
Get-Item
and the.VersionInfo
property of the file-info objects returned to extract information such as the product and company name.The
Get-ServiceFileInfo
function at the bottom does just that; it allows you to run commands such as:Get-ServiceFileInfo
source code (PSv5+, but could be adapted to work with lower versions):