I am wondering what it would be the best way to achieve the following.
To save the output of a command and being able to compare it at a later time to see if there is any diference between the running configuration and the one stored.
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:
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.
Hi, @jacobo
If you want to compare the name of files existing in a specific folder, at 2 specific times, then, the simplest way is this:
$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.
As i posted in the first post, the output it generates this cmdlet get-stfstoreservice is shows a list of values.
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.