Script – Create VMware vSphere NetApp NFS Volume

A few weeks ago I started to write a PowerShell Function that creates an optimized VMware vSphere NetApp NFS Volume and mounts this new volume to all VMware ESXi hosts within a vSphere Cluster. During the scripting process, I found, that a lot of NetApp specific inputs are required to process these steps. This was the perfect project to finally play with Dynamic ValidateSets in Dynamic Parameters.  Fabian Wendlandt already created a great example for the usage of Dynamic ValidateSets in Dynamic Parameters with his Switch-VMSwitch script.

Top vBlog 2018 Voting

Take the survey to cast your ballot and reward the best bloggers for their hard work and dedication by letting them know that you appreciate them.

Create VMware vSphere NetApp NFS Volume - PowerShell Console

Create VMware vSphere NetApp NFS Volume Function

The New-VsphereNetappVolume PowerShell Function automates the following steps:

  1. Create a NetApp Volume
  2. Create an Export Policy if required
  3. Set recommended VMware settings for the new Volume
  4. Set Snapshot Policy for the new Volume
  5. Select the right IP of the NetApp SVM
  6. Mount the new NetApp Volume on all ESXi hosts within a vSphere Cluster

The function is designed to create or use a NetApp Export Policy per vSphere Cluster. The Export Policy is named like the vSphere Cluster. If the Export Policy does not exist on the NetApp SVM, a new one is created and all ESXi IPs are added as Export Rule.

Create VMware vSphere NetApp NFS Volume - PowerShell Dynamic Parameters with Dynamic ValidateSet

All Inputs are created as Dynamic Parameters with Dynamic ValidateSet, this means that it is possible to tab through valid inputs for e.g. the vSphere Cluster or the NetApp SVM.

Note:

The inputs are not validated against each other, so you are able to select an interface that does not exist on the selected SVM.


Created NetApp objects

Volume

PowerShell:

CLI:

Export Policy

PowerShell:

CLI:

Export Rule

PowerShell:

CLI:

VMware Datastore

PowerShell:

Get the Module

The function is part of my new vSphere NetApp Toolkit PowerShell Module. At the moment it`s the only only function in the module, but more function will follow!

PowerShell Gallery Read The Docs GitHub Project

 

Preview of upcoming functions of the module (and Blog Posts):

Create VMware vSphere NetApp NFS Volume - Preview: Get-VsphereNetappVolume

Contribute

Feel free to share your NetApp Best Practice to make this PowerShell function even better.

  • Do you set any additional Volume options?
  • Do you use any special Snapshot settings or options?

You are welcome to leave a comment or raise a GitHub issue.

Leave a Reply