Hi everyone,
I am trying to compare the situation of my windows services before updates and after updates.
It seems a good idee to export the current state of the services to an XML file and later compare this with the running situation. I want to check if there is a differance in the state, startup type, new or removed services, etc… It seems that the XML files provides me with that information.
So, I run this command first.
Get-Service | Export-Clixml -Path C:\temp\service-ref.xml
The XML file is populated with all the information I need.
Next I do my “things” on the computer and After this I want to check if there are any differances.
For this I run the next commands.
Compare-Object -ReferenceObject (Import-Clixml C:\temp\service-ref.xml) -DifferenceObject (get-service)
I would expect it returns the differances. The result is however blanc.
The following shows the result of the XML compare. The result with get-content shows that the files are different.
PS C:\> get-service VeeamDeploySvc
Status Name DisplayName
------ ---- -----------
Running VeeamDeploySvc Veeam Installer Service
PS C:\> Get-Service | Export-Clixml -Path C:\temp\service-ref.xml
PS C:\> get-service VeeamDeploySvc | Stop-Service
PS C:\> get-service VeeamDeploySvc
Status Name DisplayName
------ ---- -----------
Stopped VeeamDeploySvc Veeam Installer Service
PS C:\> Get-Service | Export-Clixml -Path C:\temp\service-dif.xml
PS C:\> Compare-Object -ReferenceObject (Import-Clixml C:\temp\service-ref.xml) -DifferenceObject (Import-Clixml C:\temp\service-dif.xml)
PS C:\> Compare-Object -ReferenceObject (Get-Content C:\temp\service-ref.xml) -DifferenceObject (Get-Content C:\temp\service-dif.xml)
InputObject SideIndicator
----------- -------------
false =>
Stopped =>
false =>
Stopped =>
false =>
Stopped =>
false =>
Stopped =>
1 =>
false =>
Stopped =>
true <=
Running <=
true <=
Running <=
true <=
Running <=
true <=
Running <=
4 <=
true <=
Running
What am I missing here?