ActiveDirectory module: Format output of get-aduser

Welcome Forums General PowerShell Q&A ActiveDirectory module: Format output of get-aduser

This topic contains 2 replies, has 2 voices, and was last updated by

9 months ago.

  • Author
  • #126042

    Topics: 1
    Replies: 1
    Points: 14
    Rank: Member


    if  users have a jpegPhoto defined in Active Directory, the output of

    get-aduser MyUser -properties *

    is becoming unwieldy since the full binary data of the picture is printed out. In contrast, the thumbnailPhoto property only shows the first 8 bytes of the respective picture. How can I tell PowerShell to reduce the output of the jpegPhoto property to 8 bytes as well?

    Thanks a lot for your help.


    Best regards,


  • #126086

    Topics: 8
    Replies: 1191
    Points: 646
    Helping Hand
    Rank: Major Contributor

    Your first option is to not use -Properties *. Personally, I only use that on 1 object to see the properties I need and then define the exact properties. Another option is:

    Get-ADUser MyUser -properties * | Select * -ExcludeProperty jpegPhoto 

    As far as how an attribute is concatenated, that is handled with a Type definition in a PS1XML file. Typically, this is done in a module when you want to display cleaner object information versus one output like this, but you could still define a custom display for Get-ADUser. Take look at these if you'd like to research further:

    Formatting object output in PowerShell with Format.ps1xml files

    • #126225

      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      Thank you very much! This information was very helpful. Unfortunately, I'm still stuck. I worked through the documentation of the Format.ps1xml and the Types.ps1xml and I think I have come to a reasonable understanding of how this is supposed to work.  However, I still can't find where the formatting of the jpegPhoto property is defined.

      It seems the type returned by get-aduser is Microsoft.ActiveDirectory.Management.ADUser

      get-aduser * | get-member
      # TypeName: Microsoft.ActiveDirectory.Management.ADUser
      get-command get-aduser | select * 
      # OutputType          : {}

      which in ActiveDirectory.Types.ps1xml seems to get mapped to a type adapter (replaced XML brackets with square brackets):

      [TypeAdapter] [TypeName]Microsoft.ActiveDirectory.Management.ADEntityAdapter[/TypeName] [/TypeAdapter]

      Here I'm stuck. I could not find where PowerShell is getting the formatting information for this type.

      Does someone have a pointer on how to continue from here? Thanks a lot!



  • #126258

    Topics: 0
    Replies: 1
    Points: -15
    Rank: Member

    Hello Seniors

    I have few questions

    1. How do i check user SIP address via Powershell ( For Skype for business )
    2. How do i create/setup SIP address for new user in powershell
    3. How do i check user's hostname or IP address via his Login Credentail in powershell.

    I'm a new user in powersell.

    AD username : Samantha1

    AD Password : Welcome1

    Email address :

    Please provide me best solution..




The topic ‘ActiveDirectory module: Format output of get-aduser’ is closed to new replies.