Question

How comes that get-member does not show all available members? E.g.

PS > get-aduser john.doe | get-member -MemberType All -View All

   TypeName: Microsoft.ActiveDirectory.Management.ADUser

Name              MemberType            Definition
----              ----------            ----------
Contains          Method                bool Contains(string propertyName)
Equals            Method                bool Equals(System.Object obj)
GetEnumerator     Method                System.Collections.IDictionaryEnumerator GetEnumerator()
GetHashCode       Method                int GetHashCode()
GetType           Method                type GetType()
ToString          Method                string ToString()
Item              ParameterizedProperty Microsoft.ActiveDirectory.Management.ADPropertyValueCollection Item(string p...
DistinguishedName Property              System.String DistinguishedName {get;set;}
Enabled           Property              System.Boolean Enabled {get;set;}
GivenName         Property              System.String GivenName {get;set;}
Name              Property              System.String Name {get;}
ObjectClass       Property              System.String ObjectClass {get;set;}
ObjectGUID        Property              System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, ...
SamAccountName    Property              System.String SamAccountName {get;set;}
SID               Property              System.Security.Principal.SecurityIdentifier SID {get;set;}
Surname           Property              System.String Surname {get;set;}
UserPrincipalName Property              System.String UserPrincipalName {get;set;}

PS > get-aduser john.doe -Properties ScriptPath

DistinguishedName : [...],DC=ad,DC=nutex,DC=com
Enabled           : True
GivenName         : John
Name              : john.doe
ObjectClass       : user
ObjectGUID        : [...]
SamAccountName    : john.doe
ScriptPath        : LogonScript.vbs
SID               : [...]
Surname           : Doe
UserPrincipalName : john.doe@nutex.com

As you can see the property ScriptPath is not listed as a member. However the information is there.... what am i missing here? Thanks in advance.

Was it helpful?

Solution

Each of the PowerShell Active Directory module cmdlets, like Get-ADUser and Get-ADComputer, displays a default set of properties for all objects retrieved. You can specify other properties with the -Properties parameter, but the default set will always be included. There is another set of extended properties that can be specified. In addition, any Active Directory attribute appropriate to the class of objects can be included by specifying the LDAPDisplayName of the attribute in the -Properties parameter

You can find more details in technet : Active Directory: Get-ADUser Default and Extended Properties

If your question is how can I know all the attributs that a user (object from the user class) can have, I think that the Active-Directory Schema contains this information. To display all of the attributes that can be retreive on the object you can use :

get-aduser john.doe -Properties *
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top