Sunday, June 2, 2013

TIP: Get User Properties from AD

Sometimes you may want to get all of the properties associated with an active directory user.  This can be easily done using PowerShell.  Here's the script:
Get-AdUser -f {sn -eq 'name'} -properties * | Get-Member
Where:

-f is the filter
sn is the LDAP "sirname" or last name
-eq means equal to
-properties sets what properties you want about the user
* indicates that you want all of the properties for the selected user

If you want to search by first name, use the following script:
Get-AdUser -f {GivenName -eq 'name'} -properties * | Get-Member
 References

No comments: