question

Ozz-4746 avatar image
0 Votes"
Ozz-4746 asked michev answered

Output extension9 and Name for all users in specified OU in AD via powershell script

 $ou = "OU=Whatever,DC=MYDomain,DC=local"
  Get-ADUser -Filter * -SearchBase $ou -Properties extensionattribute9 | Select-Object -ExpandProperty extensionattribute9

Hello, is someone able to help me with displaying extension attribute9 and next to it the users display name for everyone in the specified OU. The above code displays extension9 but I need help with getting it to also display the canonical name or display name also.



azure-active-directorywindows-server-powershellwindows-active-directorymicrosoft-365-apps-publishing-devazure-ad-licensing
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

michev avatar image
1 Vote"
michev answered

Simply add the desired properties, and drop the -ExpandProperty switch.

 Get-ADUser -Filter * -SearchBase $ou -Properties DisplayName,extensionattribute9 | Select-Object DisplayName,extensionattribute9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.