Hello, I have two lists of names that I need to compare and return True if every item in $CSVobj1 equals $CSVobj2
I can return results with compare-object, but I need to return True if Item1 and 2 exist in CSVobj2. And False if only Item1 exists in CSVobj2.
Any help would be appreciated.
#Here are my two CSV files as an example
$CSVobj1 = @(
[pscustomobject]@{
List1 = 'Item1'
}
[pscustomobject]@{
List1 = 'Item2'
}
)
$CSVobj2 = @(
[pscustomobject]@{
List1 = 'Item1'
}
[pscustomobject]@{
List1 = 'Item2'
}
[pscustomobject]@{
List1 = 'Item3'
}
)
$CSVobj1 | Export-Csv -LiteralPath "Path"
$CSVobj2 | Export-Csv -LiteralPath "Path"
#I import my CSV files
$RefCSV = Import-Csv -Path "Path"
$DifCSV = Import-Csv -Path "Path"
# I can get results from compare-object
Compare-Object $RefCSV $DifCSV -IncludeEqual -PassThru
List1 SideIndicator
----- -------------
Item1 ==
Item2 ==
Item3 =>