ActiveDirectory module: Format output of get-aduser

Hi,

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,

Detlev

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:

https://4sysops.com/archives/formatting-object-output-in-powershell-with-format-ps1xml-files/

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):

[Type] 
[Name]Microsoft.ActiveDirectory.Management.ADUser[/Name]
[TypeAdapter] [TypeName]Microsoft.ActiveDirectory.Management.ADEntityAdapter[/TypeName] [/TypeAdapter]
[/Type]
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!

 

 

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 : Samantha1@varadan.com

Please provide me best solution…