SOLVED: Active Directory PowerShell Get-ADUser returns computer accounts and special accounts as well as normal accounts
By default the Active Directory PowerShell cmdlet Get-ADUser returns special accounts such as trust accounts.
If you only want normal user accounts you need to use the user account control flags which are documented here:
Specifically you need the following flag
NORMAL_ACCOUNT
0x0200
512
The easiest way to provide this is to use the filter parameter and the bitwise AND which determines whether flag 512 is set.
Get-ADUser -Filter "userAccountControl -band 512"
Comments
Post a Comment