Avatar of nav2567
nav2567
Flag for United States of America asked on

GET-ADUSER command result file has missing users.

Hello,

I am running the below command to list our domain users but there are accounts which are missing in the result file.

Get-Aduser -Filter  -Properties * |Select samAccountName,name,displayName,department,distinguishedName,givenName,mail,@{n='PasswordLastSet';e={[DateTime]::FromFileTime($_.PasswordLastSet)}},@{n='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon)}},@{n='LastLogonTimestamp';e={[DateTime]::FromFileTime($_.LastLogonTimestamp)}} |Export-CSV "C:\mydomainusers.csv" -NoTypeInformation -Encoding UTF8

Is there a limitation in displaying the number of users?  

Please advise.  

Thanks.
PowershellActive Directory

Avatar of undefined
Last Comment
yo_bee

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
footech

I've seen that tossed around before (the 1000 result limit), but I don't know where it came from, and I've never observed that to be the case.  On a lab machine I just returned more than 35,000 users without using the -ResultSetSize parameter.
PS C:\Users\Administrator.TEMPTEST> (get-aduser -Filter *).count
35037

Open in new window


Where are you running your Get-ADUser command?
If running on a DC, I've seen partial results if not running from an elevated prompt, and also when querying the same DC you're running on.  You could try specifying another DC with the -Server parameter.

If your query is taking a long time, it's possible to run into some timeouts.
yo_bee

I would also narrow your -properties * to  -properties only the attributes you want to select separated with a ,

-properties mail,userprincipalname,etc, etc.

This will speed it up if you are query a large set of users.
Your help has saved me hundreds of hours of internet surfing.
fblack61