Methods and Properties

Hello Powershell Gods :).

I have been looking into methods and properties. Now I learned there is a command to get the methods and properties of any cmdlet. For example

get-aduser | gm i can get the various properties and methods for example

However when i ran this it gave me a list of properties and methods but there was one missing ‘lastlogondate’

The usual command line for this would be

 

get-aduser -Identity userlogonname -Properties ‘lastlogondate’

 

So my question is why doesnt lastlogondate show up in the methods and properties

 

Thanks

 

Fish and Chips

Get-ADUser exposes a limited set of properties by default. To see all, use the -Properties * parameter as in:

Get-ADUser samb -Properties * | gm 

and you’ll get

   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 propertyName) {get;}                                    
AccountExpirationDate                Property              System.DateTime AccountExpirationDate {get;set;}                                                                                   
accountExpires                       Property              System.Int64 accountExpires {get;set;}                                                                                             
AccountLockoutTime                   Property              System.DateTime AccountLockoutTime {get;set;}                                                                                      
AccountNotDelegated                  Property              System.Boolean AccountNotDelegated {get;set;}                                                                                      
adminCount                           Property              System.Int32 adminCount {get;set;}                                                                                                 
AllowReversiblePasswordEncryption    Property              System.Boolean AllowReversiblePasswordEncryption {get;set;}                                                                        
AuthenticationPolicy                 Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection AuthenticationPolicy {get;set;}                                     
AuthenticationPolicySilo             Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection AuthenticationPolicySilo {get;set;}                                 
BadLogonCount                        Property              System.Int32 BadLogonCount {get;}                                                                                                  
badPasswordTime                      Property              System.Int64 badPasswordTime {get;set;}                                                                                            
badPwdCount                          Property              System.Int32 badPwdCount {get;set;}                                                                                                
CannotChangePassword                 Property              System.Boolean CannotChangePassword {get;set;}                                                                                     
CanonicalName                        Property              System.String CanonicalName {get;}                                                                                                 
Certificates                         Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection Certificates {get;set;}                                             
City                                 Property              System.String City {get;set;}                                                                                                      
CN                                   Property              System.String CN {get;}                                                                                                            
codePage                             Property              System.Int32 codePage {get;set;}                                                                                                   
Company                              Property              System.String Company {get;set;}                                                                                                   
CompoundIdentitySupported            Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection CompoundIdentitySupported {get;set;}                                
Country                              Property              System.String Country {get;set;}                                                                                                   
countryCode                          Property              System.Int32 countryCode {get;set;}                                                                                                
Created                              Property              System.DateTime Created {get;}                                                                                                     
createTimeStamp                      Property              System.DateTime createTimeStamp {get;}                                                                                             
Deleted                              Property              System.Boolean Deleted {get;}                                                                                                      
Department                           Property              System.String Department {get;set;}                                                                                                
Description                          Property              System.String Description {get;set;}                                                                                               
DisplayName                          Property              System.String DisplayName {get;set;}                                                                                               
DistinguishedName                    Property              System.String DistinguishedName {get;set;}                                                                                         
Division                             Property              System.String Division {get;set;}                                                                                                  
DoesNotRequirePreAuth                Property              System.Boolean DoesNotRequirePreAuth {get;set;}                                                                                    
dSCorePropagationData                Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection dSCorePropagationData {get;}                                        
EmailAddress                         Property              System.String EmailAddress {get;set;}                                                                                              
EmployeeID                           Property              System.String EmployeeID {get;set;}                                                                                                
EmployeeNumber                       Property              System.String EmployeeNumber {get;set;}                                                                                            
Enabled                              Property              System.Boolean Enabled {get;set;}                                                                                                  
Fax                                  Property              System.String Fax {get;set;}                                                                                                       
GivenName                            Property              System.String GivenName {get;set;}                                                                                                 
HomeDirectory                        Property              System.String HomeDirectory {get;set;}                                                                                             
HomedirRequired                      Property              System.Boolean HomedirRequired {get;set;}                                                                                          
HomeDrive                            Property              System.String HomeDrive {get;set;}                                                                                                 
HomePage                             Property              System.String HomePage {get;set;}                                                                                                  
HomePhone                            Property              System.String HomePhone {get;set;}                                                                                                 
Initials                             Property              System.String Initials {get;set;}                                                                                                  
instanceType                         Property              System.Int32 instanceType {get;}                                                                                                   
isDeleted                            Property              System.Boolean isDeleted {get;}                                                                                                    
KerberosEncryptionType               Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection KerberosEncryptionType {get;set;}                                   
LastBadPasswordAttempt               Property              System.DateTime LastBadPasswordAttempt {get;}                                                                                      
LastKnownParent                      Property              System.String LastKnownParent {get;}                                                                                               
lastLogon                            Property              System.Int64 lastLogon {get;set;}                                                                                                  
LastLogonDate                        Property              System.DateTime LastLogonDate {get;}                                                                                               
lastLogonTimestamp                   Property              System.Int64 lastLogonTimestamp {get;set;}                                                                                         
LockedOut                            Property              System.Boolean LockedOut {get;set;}                                                                                                
logonCount                           Property              System.Int32 logonCount {get;set;}                                                                                                 
LogonWorkstations                    Property              System.String LogonWorkstations {get;set;}                                                                                         
Manager                              Property              System.String Manager {get;set;}                                                                                                   
MemberOf                             Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection MemberOf {get;}                                                     
MNSLogonAccount                      Property              System.Boolean MNSLogonAccount {get;set;}                                                                                          
MobilePhone                          Property              System.String MobilePhone {get;set;}                                                                                               
Modified                             Property              System.DateTime Modified {get;}                                                                                                    
modifyTimeStamp                      Property              System.DateTime modifyTimeStamp {get;}                                                                                             
msDS-User-Account-Control-Computed   Property              System.Int32 msDS-User-Account-Control-Computed {get;}                                                                             
Name                                 Property              System.String Name {get;}                                                                                                          
nTSecurityDescriptor                 Property              System.DirectoryServices.ActiveDirectorySecurity nTSecurityDescriptor {get;set;}                                                   
ObjectCategory                       Property              System.String ObjectCategory {get;}                                                                                                
ObjectClass                          Property              System.String ObjectClass {get;set;}                                                                                               
ObjectGUID                           Property              System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] ObjectGUID {get;set;}
objectSid                            Property              System.Security.Principal.SecurityIdentifier objectSid {get;}                                                                      
Office                               Property              System.String Office {get;set;}                                                                                                    
OfficePhone                          Property              System.String OfficePhone {get;set;}                                                                                               
Organization                         Property              System.String Organization {get;set;}                                                                                              
OtherName                            Property              System.String OtherName {get;set;}                                                                                                 
PasswordExpired                      Property              System.Boolean PasswordExpired {get;set;}                                                                                          
PasswordLastSet                      Property              System.DateTime PasswordLastSet {get;set;}                                                                                         
PasswordNeverExpires                 Property              System.Boolean PasswordNeverExpires {get;set;}                                                                                     
PasswordNotRequired                  Property              System.Boolean PasswordNotRequired {get;set;}                                                                                      
POBox                                Property              System.String POBox {get;set;}                                                                                                     
PostalCode                           Property              System.String PostalCode {get;set;}                                                                                                
PrimaryGroup                         Property              System.String PrimaryGroup {get;}                                                                                                  
primaryGroupID                       Property              System.Int32 primaryGroupID {get;set;}                                                                                             
PrincipalsAllowedToDelegateToAccount Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection PrincipalsAllowedToDelegateToAccount {get;set;}                     
ProfilePath                          Property              System.String ProfilePath {get;set;}                                                                                               
ProtectedFromAccidentalDeletion      Property              System.Boolean ProtectedFromAccidentalDeletion {get;set;}                                                                          
pwdLastSet                           Property              System.Int64 pwdLastSet {get;set;}                                                                                                 
SamAccountName                       Property              System.String SamAccountName {get;set;}                                                                                            
sAMAccountType                       Property              System.Int32 sAMAccountType {get;set;}                                                                                             
ScriptPath                           Property              System.String ScriptPath {get;set;}                                                                                                
sDRightsEffective                    Property              System.Int32 sDRightsEffective {get;}                                                                                              
ServicePrincipalNames                Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection ServicePrincipalNames {get;set;}                                    
SID                                  Property              System.Security.Principal.SecurityIdentifier SID {get;set;}                                                                        
SIDHistory                           Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection SIDHistory {get;}                                                   
SmartcardLogonRequired               Property              System.Boolean SmartcardLogonRequired {get;set;}                                                                                   
sn                                   Property              System.String sn {get;set;}                                                                                                        
State                                Property              System.String State {get;set;}                                                                                                     
StreetAddress                        Property              System.String StreetAddress {get;set;}                                                                                             
Surname                              Property              System.String Surname {get;set;}                                                                                                   
Title                                Property              System.String Title {get;set;}                                                                                                     
TrustedForDelegation                 Property              System.Boolean TrustedForDelegation {get;set;}                                                                                     
TrustedToAuthForDelegation           Property              System.Boolean TrustedToAuthForDelegation {get;set;}                                                                               
UseDESKeyOnly                        Property              System.Boolean UseDESKeyOnly {get;set;}                                                                                            
userAccountControl                   Property              System.Int32 userAccountControl {get;set;}                                                                                         
userCertificate                      Property              Microsoft.ActiveDirectory.Management.ADPropertyValueCollection userCertificate {get;set;}                                          
UserPrincipalName                    Property              System.String UserPrincipalName {get;set;}                                                                                         
uSNChanged                           Property              System.Int64 uSNChanged {get;}                                                                                                     
uSNCreated                           Property              System.Int64 uSNCreated {get;}                                                                                                     
whenChanged                          Property              System.DateTime whenChanged {get;}                                                                                                 
whenCreated                          Property              System.DateTime whenCreated {get;}   

Thankyou Sam for your prompt assistance.