Get Active Directory User with Specific Attribute
Posted on 2013-12-06
I need to get a report of active, meaning not disabled, user accounts and if they have a corresponding attribute called EmployeeID, I've been using the following powershell command, however it does not return a value for employeeID, which when I browse ADSIedit, it is listed as an attribute, some with values and some blank. What am I missing here?
Get-ADUser -LdapFilter "(&(!useraccountcontrol:1.2.840.1135184.108.40.2063:=2))" | Select-Object Name,UserPrincipalName,employeeID | Sort-Object UserPrincipalName > C:\export.txt