powershell get-aduser extensionattribute12

Viewed 9975
$name="d4rkcell"
Get-ADUser -LDAPFilter "(sAMAccountName=$Name)" -Properties extensionAttribute12

I am using the above code but the result shows more than just extensionAttribute12 it shows other information such as:

DistinguishedName    : CN=d4rkcell,OU=Users,...DC=co,DC=uk
Enabled              : True
extensionAttribute12 : \\path\to\a\share
GivenName            : Joe
Name                 : U0023883
ObjectClass          : user
ObjectGUID           : a0562e97-cb58-463b-bae6-8e0087fa494b
SamAccountName       : d4rkcell
SID                  : S-1-5-21-1004336368-1374586140-1801574631-62475
Surname              : Bloggs
UserPrincipalName    : J.Bloggs@....co.uk

I would ideally just want the value stored in extensionAttribute12, can anyone help me here or help me split this string ? Bit stuck, help would be much appreciated.

3 Answers

This showed up when I googled how to show all attributes, so I'll add this here. Note that's it's not very efficient, but I couldn't get a 1-15 loop to work.

get-aduser john -Properties * | select extensionattribute* 

enter image description here

Related