I am wondering what it would be the best way to achieve the following.
What I have attempted so far was to do a export-clixml and then do a compare-object but this doesnt seem to work with the type of output i am getting from this command.
The output generated by this cmdlet is in the following format:
EnabledOnDirectAccess : False
thanks in advance
I am using a similar way to check if a folder with installation files contains the expected files. I create a list with the relative path and file name and a hash value and compare it with the same list I created before and exported with export-clixml.
Why shouldn't it work? If you'd show your code we might help.
$1 = @(dir $folderA -file).fullname # this is the reference object $2 = @(dir $folderA -file).fullname # this is the difference object, computed at any later time diff $1 $2 # the difference between the 2 objects is computed, and presented on the display
If you need to, you can use the -PassThru switch PARAMETER to keep processing the result, maybe, in a pipeline. Also, you don't need any further processing, after you grab the name of the files ( just compare them ).
Maybe, you can apply the same technique to your problem.
Thanks for your replies.
I run the saved config against the run config with compare-object without parameters i take the following output, but it doesnt show where the difference is.
diff ((Import-Clixml .\gateway4.xml).gateways) (Get-STFStoreService | select -ExpandProperty gateways) InputObject SideIndicator ----------- ------------- TransferNSGW => TransferNSGW < =
If i select particular properties, for instance i see they match and they are the same.
diff ((Import-Clixml .\gateway4.xml).gateways) (Get-STFStoreService | select -ExpandProperty gateways) -Property key,id,EnabledOnDirectAccess -IncludeEqual key id EnabledOnDirectAccess SideIndicator --- -- --------------------- ------------- 18d0d30f-3843-4da3-9547-44a164210758 18d0d30f-3843-4da3-9547-44a164210758 False ==
How i could run it so it goes thru all the properties and highlights those which are different?
You could try this:
$1=@(gc .\MyFirstExport.XML) $2=@(gc .\MySecondExport.XML) diff $1 $2
Notice that the XML files are read as TXT.
In the end it was managed using the following
diff (((Import-Clixml .\gateway4.xml).gateways | convertto-json ) -split "`n" ) ((Get-STFStoreService | select -ExpandProperty gateways | convertto-json ) -split "`n")
thanks everyone for the replies.
You must be logged in to reply to this topic.