Root Loop
Root Loop

Reputation: 3162

Difference between Get-Member vs -Properties *

I am wondering what the differences are between Get-Member vs -Properties * in PowerShell.

I do Get-ADUser AAA | Get-Member and Get-ADUser AAA -Properties *.

Why does -Properties * give me way more results than Get-Member.

What is the difference? I thought Get-Member is for listing all properties of a object which is the same as -Properties *.

Upvotes: 2

Views: 927

Answers (1)

jrider
jrider

Reputation: 1640

-properties is to specify additional properties that are not part of the default set of user object properties: MS Get-ADuser.

Get-Member just gets the properties and methods of objects MS Get-Member

When you are piping your Get-ADUser into Get-Member it is just getting the default properties of the user object. If you specify additional/all properties using -properties * it will return all the AD user's properties (assuming you have rights).

Example:

  • Default Properties:

    Get-ADuser AAA | Get-Member

  • All AD User Properties:

    Get-ADUser AAA -Properties * | Get-Member

Upvotes: 6

Related Questions