wastedtime wrote: » They key is not pulling them into powershell before searching. I'm guessing the DC has all of these fields in a hash table or similar structure that is already optimized. This site shows how to use Get-ADUser with filter.PowerShell Get-AdUser -filter | Active Directory Cmdlet LDAPfilter From what that is saying "Get-ADUser -Filter {(Givenname -eq "WAH") -And (Surname -eq "Devel")}" is more then likely the command you can use.
GSXR750K2 wrote: » wastedtime is right. Unless there is something else you want to do with the data other than view it (like pass it as one or more parameters for another cmdlet), there's no need to assign it to an object. You can, it just makes a little more work for you.
Compare-Object $adlist $O365list -IncludeEqual
DevilWAH wrote: » risk of data getting out of sync when a write to one DC is not synced before a new get request hits a different DC.
get-aduser -server 10.10.10.8 -Filter * -SearchBase "OU=<ou name>,DC=<contoso>,DC=<com> | Select GivenName,Surname
Qord wrote: » For comparisons, I normally make two ordered lists and run them through compare-object. As an example, I had to sync our O365 distribution group memberships to AD, I used this to look at it first: Compare-Object $adlist $O365list -IncludeEqual You can force a query to a specific DC using the -server option, something like... get-aduser -server 10.10.10.8 -Filter * -SearchBase "OU=<ou name>,DC=<contoso>,DC=<com> | Select GivenName,Surname
Foreach ($userH in $hruserlist) { Foreach($userA in $adlist) { if((userH.firstname -like $userA.firstname) -and ($userH.surname -like $userA.surname)) { Put some code here...... } } }