Subscribe

Using Powershell to get Volumes from a specific vFiler

Afternoon,

We have several Netapps in a multistor environment to seperate out clients.  We are often asked to audit the volumes on a vfiler and want to speed this process up.  Been studying the Netapp Powershell Toolkit and before I run the following was hoping if someone could tell me if this would work or is there an easier way of getting the volumes specific to only a particular vfiler only:

# Connecting to Netapp Controller

$netapp = Read-Host "Which Netapp Controller do you want to connect to?"

$vfiler = Read-Host "Which client vfiler do you want to check?"

$nacred = Get-Credential

$nacontroller = Connect-NaController -Name $netapp -Credential $nacred

$VfilerVolumes = Get-NaVfiler -name $vfiler | Get-NaVol | select Name, SizeTotal, SizeUsed, SizeAvailable

$VfilerVolumes | out-gridview

#Set global connection variable to 'null' to properly end current session

$CurrentNaController = null

Re: Using Powershell to get Volumes from a specific vFiler

you can do it a little differently

and you aren't creating a credential object.  You should do that

## Define Global PWD

$password = read-host "Enter Root password" -assecurestring

#$password = ConvertTo-SecureString "*" -AsPlainText -Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "root",$password

And dont' have to connect directly to the vfiler to get the volumes, you can connect to the filer and use where-object to filter for your vfiler

$nacontroller = connect-nacontroller -name $netapp -cred $cred

get-navol | ? {$_.vfiler -eq "$vfiler"}

Do a search, i have posted an excel dashboard that should dump this out

Re: Using Powershell to get Volumes from a specific vFiler

That's excellent.  Thank you.  Much appreciated. 

Re: Using Powershell to get Volumes from a specific vFiler

Hi JGPSNTAP,

 

i Have the same  problem but if i do:

 

$vfiler = "xxxxx"

get-navol | ? {$_.vfiler -eq "$vfiler"}
 
is not retuning me any thing !!!
 
any clue ??
 
 

Re: Using Powershell to get Volumes from a specific vFiler

[ Edited ]

@bleblanc71    'vFiler' is not a valid property that is passed through the pipeline, which is probably why you aren't seeing anything.

 

I think the property you want is 'OwningVfiler'

 

However, if you are set on 'vFiler', you can create a custom hash table that will rename a proper property name into a custom name, like such:

 

$vFilerName = @{ Label='vFiler'; Expression={ $_.OwningVfiler } }

$vFiler = "xxxxx"

Get-NaVol | Select Name,SizeUsed,SizeTotal,$vFilerName | ? {$_.vfiler -eq "$vfiler"}

(I use custom hash tables quite a bit in a NetApp vol detail script I wrote, which you can download/view in one of my GitHub repos HERE )

 

You can get a list of valid properties being passed through the pipeline by piping Get-NaVol to Get-Member, like such:

 

Get-NaVol | Get-Member -MemberType Properties

Name                                                                                                                             
----                                                                                                                             
Aggregate                                                                                                                        
Autosize                                                                                                                         
Available                                                                                                                        
BlockType                                                                                                                        
ChecksumStyle                                                                                                                    
CloneChildren                                                                                                                    
CloneParent                                                                                                                      
Compression                                                                                                                      
ContainingAggregate                                                                                                              
Dedupe                                                                                                                           
DedupeEnabled                                                                                                                    
DiskCount                                                                                                                        
ExpiryDate                                                                                                                       
ExpiryDateDT                                                                                                                     
ExpiryDateSpecified                                                                                                              
FilesPrivateUsed                                                                                                                 
FilesTotal                                                                                                                       
FilesUsed                                                                                                                        
FilesystemSize                                                                                                                   
FormattedExpiryDate                                                                                                              
FormattedSnaplockVolumeComplianceClock                                                                                           
HybridCacheEligibility                                                                                                           
HybridCacheWriteCachingIneligibilityReason                                                                                       
InodefilePrivateCapacity                                                                                                         
InodefilePublicCapacity                                                                                                          
IsChecksumEnabled                                                                                                                
IsDedupeEnabled                                                                                                                  
IsInconsistent                                                                                                                   
IsInSnapmirrorJumpahead                                                                                                          
IsInSnapmirrorJumpaheadSpecified                                                                                                 
IsInvalid                                                                                                                        
IsInvalidSpecified                                                                                                               
IsSnaplock                                                                                                                       
IsUnrecoverable                                                                                                                  
IsUnrecoverableSpecified                                                                                                         
IsWraparound                                                                                                                     
IsWraparoundSpecified                                                                                                            
MirrorStatus                                                                                                                     
Name                                                                                                                             
OwningVfiler                                                                                                                     
PercentageUsed                                                                                                                   
PercentageUsedSpecified                                                                                                          
PlexCount                                                                                                                        
Plexes                                                                                                                           
QuotaInit                                                                                                                        
RaidSize                                                                                                                         
RaidStatus                                                                                                                       
RemoteLocation                                                                                                                   
Reserve                                                                                                                          
ReserveRequired                                                                                                                  
ReserveUsed                                                                                                                      
ReserveUsedActual                                                                                                                
Sis                                                                                                                              
SizeAvailable                                                                                                                    
SizeTotal                                                                                                                        
SizeUsed                                                                                                                         
SnapAutodelete                                                                                                                   
SnaplockType                                                                                                                     
SnaplockVolumeComplianceClock                                                                                                    
SnaplockVolumeComplianceClockSpecified                                                                                           
SnapshotBlocksReserved                                                                                                           
SnapshotPercentReserved                                                                                                          
SpaceReserve                                                                                                                     
SpaceReserveEnabled                                                                                                              
SpaceReserveEnabledSpecified                                                                                                     
State                                                                                                                            
TotalSize                                                                                                                        
Transition                                                                                                                       
Type                                                                                                                             
Used                                                                                                                             
Uuid                                                                                                                             
VmAlign                                                                                                                          
Volume64bitUpgrade                                                                                

 

 

Hope that makes more sense.