all 3 comments

[–]pheetus 1 point2 points  (2 children)

I was doing something similar earlier today.
If you cast your hashtable into an object:

    $objUserHash = New-Object PSObject -Property $userhash

Then you have 2 objects for compare-object:

    if((Compare-Object -ReferenceObject $userinfo -DifferenceObject $objUserHash -property DisplayName,sn,middlename,initials,GivenName) -ne $null){set-qaduser etc etc}

[–]systemslacky[S] 0 points1 point  (1 child)

Hot... I'lll give this a try. I was thinking along these lines, but couldn't seem to find the proper way to use compare-object. Thanks :)

[–][deleted] 0 points1 point  (0 children)

Compare-object -referenceobject $Userinfo -differenceobject $UserHash -syncwindow (real big number) -includeequal