powershell get-aduser extensionattribute12 powershell get-aduser extensionattribute12 powershell powershell

powershell get-aduser extensionattribute12


The -Properties parameter of Get-ADUser seems a little misleading. According to its documentation:

Properties

Specifies the properties of the output object to retrieve from the server. Use this parameter to retrieve properties that are not included in the default set.

So it seems any properties you specify will be returned in addition to the default set. If you want to further isolate a property from that set, you could try:

$name="d4rkcell"Get-ADUser -LDAPFilter "(sAMAccountName=$Name)" -Properties extensionAttribute12 |Select-Object -ExpandProperty extensionAttribute12

If you always expect to get a single object containing properties, you could shorten this by wrapping the Get-ADUser command in parenthesis, and then appending the property name with a dot:

(Get-ADUser -LDAPFilter "(sAMAccountName=$Name)" -Properties extensionAttribute12).extensionAttribute12


You should just be able to select extensionAttribute12, for example:

Get-ADUser -LDAPFilter "(sAMAccountName=$Name)" -Properties extensionAttribute12 | Select extensionAttribute12 


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