Hi colleagues. I am comparing 2 text files, one on a server and the other on different hosts.
To accomplish this I use compar-object, and as output I get the hostname and below the differences between files (RESULTS.TXT).
$SEP="--------------------------------------" | out-file $RESULTS -append get-content env:computername | out-file $RESULTS -append compare-object (get-content $SERVER) (get-content $HOST) | where { $_.SideIndicator -eq '<='} | % { $_.InputObject } | out-file $RESULTS -append $SEP="-------------- END -----------------" | out-file $RESULTS -append
I would like to get output on 2 files, not 1. On one file computers that have differences between files, and on the other file computer with no differences.
How can I do this? Is if possible to use an IF statement?
Thanks.