Is it possible to do the order comparison of items in arrays with Compare-Object aka diff in PowerShell? if not, suggest a workaround.
Compare-Object
diff
Use -SyncWindow 0:
-SyncWindow 0
$a1=@(1,2,3,4,5) $b1=@(1,2,3,5,4) if (Compare-Object $a1 $b1 -SyncWindow 0) { Write-Host 'Wrong order ' } else { Write-Host 'OK' }
More info: Comparing Arrays in Windows PowerShell.