Functions/Util/Compare-FullObject.ps1

1
2
3
4
5
6
7
8
9
10
11
12
function Compare-FullObject {
    param([object]$ReferenceObject,
            [object]$DifferenceObject)

    $properties = $ReferenceObject | Get-Member -MemberType Properties | Select-Object -ExpandProperty Name
    $properties += $DifferenceObject | Get-Member -MemberType Properties | Select-Object -ExpandProperty Name
    $properties = $properties | Sort-Object -Unique

    foreach($property in $properties) {
        Compare-Object -ReferenceObject $ReferenceObject -DifferenceObject $DifferenceObject -Property $property
    }
}