Querying Unix Attributes from Active Directory with PowerShell

This is just a quick blurb, but you may have wanted a nice way to query the Unix Attributes tab of AD accounts. Using PowerShell, and the ActiveDirectory Module, you can pull these values quite easily. The AD property names are listed above each box in this example:


You can use the following PowerShell code:

Import-Module ActiveDirectory
Get-ADUser john.doe -Properties *
  | select SamAccountName,msSFU30NisDomain,unixHomeDirectory,loginShell,uidNumber,gidnumber,
  @{Label='PrimaryGroupDN';Expression={(Get-ADGroup -Filter {GIDNUMBER -eq $_.gidnumber}).DistinguishedName}}

You will get the properties to appear as so:


My custom expression for PrimaryGroupDN will also resolve to the Distinguished Name tied to the gidnumber found.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s