A script to return the value of extension attribute 9 in a specific OU

Ozz 21 Reputation points
2021-06-18T10:10:34.007+00:00

Hello,

I am searching for a PowerShell script that will return the value of extension attribute 9 in a specific OU in active Directory. Could someone assist me with this?

Thanks!

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,932 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,389 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,664 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 97,566 Reputation points MVP
    2021-06-18T14:02:40.647+00:00

    Hi @Ozz ,

    please try this:

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

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


1 additional answer

Sort by: Most helpful
  1. Andreas Baumgarten 97,566 Reputation points MVP
    2021-06-18T11:05:36.697+00:00

    Hi @Ozz ,

    are you talking about the extensionattribute9 of AD users in a specific OU in your domain?

    Than may this helps to get started (not tested by myself):

    $ou = "OU=Whatever,DC=MYDomain,DC=local"  
    Get-ADUser -SearchBase $ou -Properties extensionattribute9  
    

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten