Link to home
Start Free TrialLog in
Avatar of Carlo-Giuliani
Carlo-GiulianiFlag for Canada

asked on

Format-List shows object properties, but I cannot access any of those properties?? (object from NetApp DataOnTap module)

Here is a listing from a PowerShell ISE session where I have an object, $e, with a few properties.  Format-List shows values for some of the properties.  But if I try to access any of the properties in the usual way as $e.propertyname, I get a null result every time.

Can anybody explain how this is  possible??

The object in question is output from a NetApp DataOnTap powershell module Get-NaNfsExportStoragePath command.  But I don't think that is really relevant.  The Powershell version is the 2.0 on Windows 7+SP1.
 



________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $e | get-member


   TypeName: DataONTAP.Types.Nfs.SecurityRuleInfo

Name            MemberType Definition                                                                                                                        
----            ---------- ----------                                                                                                                        
Equals          Method     bool Equals(System.Object obj)                                                                                                    
GetHashCode     Method     int GetHashCode()                                                                                                                 
GetType         Method     type GetType()                                                                                                                    
ToString        Method     string ToString()                                                                                                                 
Validate        Method     System.Void Validate()                                                                                                            
Anon            Property   System.String Anon {get;set;}                                                                                                     
Nosuid          Property   System.Nullable`1[[System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] Nosuid {get;set;}
NosuidSpecified Property   System.Boolean NosuidSpecified {get;set;}                                                                                         
ReadOnly        Property   DataONTAP.Types.Nfs.ExportsHostnameInfo[] ReadOnly {get;set;}                                                                     
ReadWrite       Property   DataONTAP.Types.Nfs.ExportsHostnameInfo[] ReadWrite {get;set;}                                                                    
Root            Property   DataONTAP.Types.Nfs.ExportsHostnameInfo[] Root {get;set;}                                                                         
SecFlavor       Property   DataONTAP.Types.Nfs.SecFlavorInfo[] SecFlavor {get;set;}                                                                          



________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $e


Anon            : 
Nosuid          : True
ReadOnly        : 
ReadWrite       : {all-hosts}
Root            : 
SecFlavor       : {sys}
NosuidSpecified : True




________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $e.nosuid

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $e.ReadWrite

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $e.nosuid | get-member
Get-Member : No object has been specified to the get-member cmdlet.
At line:1 char:23
+ $e.nosuid | get-member <<<< 
    + CategoryInfo          : CloseError: (:) [Get-Member], InvalidOperationException
    + FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand
 

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1      



________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Windows\system32> $PSVersionTable

Name                           Value                                                                                                                                                                                                                               
----                           -----                                                                                                                                                                                                                               
CLRVersion                     2.0.50727.5485                                                                                                                                                                                                                      
BuildVersion                   6.1.7601.17514                                                                                                                                                                                                                      
PSVersion                      2.0                                                                                                                                                                                                                                 
WSManStackVersion              2.0                                                                                                                                                                                                                                 
PSCompatibleVersions           {1.0, 2.0}                                                                                                                                                                                                                          
SerializationVersion           1.1.0.1                                                                                                                                                                                                                             
PSRemotingProtocolVersion      2.1  

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's correct, footech.

 ,$e | gm
is said to tell the real type of container vars instead of the array elements.
I remember switching between something like
$e | gm
#and 
gm -Inputobject $e

Open in new window

to check out the properties and methods in various circumstances.  Looks like the way you mentioned is equivalent to using the -inputobject parameter (and I can see why).
Avatar of Carlo-Giuliani

ASKER

Duh.  That's what it is.    I should have realized that.

Thanks!