Extract NFS Export rules From a NetApp Controller and its V-Filers using PowerShell ToolKit

PowerShell Toolkit is very flexible and provides us with way's to Execute very complex tasks.

 

Here's a PowerShell Script which i created that can be used to Returns the rules associated with exports for Both Controller and the Vfiler associated with them.

 

Here i have taken the assumption that the Storage infrastructure runs in HA configuration, as most of our customers have NetApp Controllers in HA Mode.

 

In order to extract the primarysystem and partner system im using the Get-NaSystemInfo cmdlet which gives me both the information.

 

Using this format i can get both the system names and iterate through the vfiler's present in them to extract the rules associated with exports, below there is a cmdlet screenshot example

 

The PoweShell Module script has intelligence embedded in a way that it can differentiate between controller names and vfiler names

 

The Script Return's the Following Parameters related to NFS exports Name,Is Controller(True/False), ActualPathname, Pathname, Anon, Nosuid, ReadOnly, ReadWrite, Root and SecFlavor

 

Here's an sample output of the script which i fed into a array called $array.

 

 

Once you run the script it would also output an csv file to the specified folder.

 

 

Here's how you can run the script

 

PS C:\Users\vinith> .\NFS_Export_Controller_Vfiler.ps1 -ControllerName <ControllerName> -Username <UserName> -Password <Password> -OutputDirectory "c:\vinith" -OutputFileName "nfs-controller-vfiler.csv"

 

 

Below you can find attached the script and its output .csv to .xlsx converted file.

 

Happy PowerShelling

 

Thanks,

Vinith

Comments

Hello Vinith,

thanks a lot for your code, it is a cool replacement for rdfile /etc/exports:-)

Kind regards from Munich

Christian Meuser