Compare services of two computers in PowerShell

This function “Compare-Services” will allow you to compare the running services of two computers. The first one is called the Reference Computer, the second is the Difference Computer. The output defaults to Compare-Object output. If you need an object to do further work with, this is what you want. If you don’t want to puzzle out what the “=>” and “<=” indicators mean, and you want a simple report, you can use the -FriendlyText switch will give you English text output, which will make more sense to many humans, at least the English speaking humans reading this blog. Windows remoting needs to be enabled on the computers being checked for this to work.

Example output:

And here is the function:


3 thoughts on “Compare services of two computers in PowerShell”

  1. Aloha! :)

    You wouldn’t believe how crazy the search results were just trying to find how to do this.
    However, I’m not quite sure exactly what you mean by ‘On’ one computer or another?

    What I’m looking for is a way to compare services between computers on same LAN as follows:
    1. Which services are present on each one.
    2. Status of services of each one (started, stopped)
    3. Config of each one (disabled, manual, auto, auto-delayed etc.)

    But if this lets you know which services are present & RUNNING,
    it would be enough of a blessing at this point.

    Manually comparing services can be a real pain.
    Wondering also if Precious Nir Sofer or Syinternals has something for this?

    Either way, your efforts are much appreciated.

    Mahalo (thank you very much) for your help!

  2. Ed, This script, as above will only consider Running (and therefor present) services on each computer. It could be modified to compare the config as will.


    This should get you what you want.

    Line 1 and 2 sets variables with the names of the computers.

    Lines 4 and 5 gets the details of the services of each, selecting properties DisplayName, Status, StartType. Display name is the nice “English” name of the service. Status is Running, Stopped, etc. StartType is Manual, Automatic, Disabled, etc. The resulting object with the selected properties from the services are assigned to variables.

    The last line compares the results. In PowerShell, look at the help for Compare-Object, but in a nutshell, SideIndicator “<=” refers to the Reference Computer, “=>” and refers to the Difference Computer.

    Does this help?

Leave a Reply

Your email address will not be published. Required fields are marked *