Reputation: 39
i run
$serv1=gwmi -Namespace Root\cimv2 -Class Win32_service
i stop some services manually and then run
$serv2=gwmi -Namespace Root\cimv2 -Class Win32_service
and then i compare these 2 objects
compare-object $serv1 $serv2
compare-object -referenceobject $serv1 -differenceobject $serv2
both doesn't return any difference however both have some values different
Upvotes: 0
Views: 144
Reputation: 174920
Compare-Object
compares the Path property of each wmi instance object in the input collections - they will be the same no matter whether the service is running or not.
Use the -Property
parameter to compare on specific properties, ie.
Compare-Object $serv1 $serv2 -Property Name,State
Upvotes: 1