PowerShell Script to Delete any or all SVMs

Software Versions: 
  • Clustered DataONTAP 8.3.2
  • NetApp PowerShell ToolKit 4 
  • PowerShell v3 or higher
Got tired of zeroing out my FAS 2552 (Option 4) and just needed to wipe out all the SVMs.  This script amazingly does the trick ;) Only tested on iSCSI and NFS SVMs. I'd think it'd work for SMB.  Not sure about FC SAN - if someone tries it let me know! 
Be VERY careful  - it's quite destructive!
Use at your own risk!

Param (
   [Parameter(Mandatory = $true)][IPAddress]$ClusterIP,
   [string]$SVM = "*"

# Set console background to Black and font to White

$a = (Get-Host).UI.RawUI
$a.BackgroundColor = "Black"
$a.ForegroundColor = "White"

# Warning Message

Write-Host -ForegroundColor Gray " ------------------------------------------------------------- "
Write-Host -ForegroundColor White " This script will completely delete a specific SVM or ALL SVMs "
Write-Host -ForegroundColor White " including the associated volumes, LUNs, and LIFs !!! "
Write-Host -ForegroundColor Magenta " ALL DATA WILL BE LOST "
Write-Host -ForegroundColor Gray " ------------------------------------------------------------- "
Write-Host -ForegroundColor Yellow " Enter YES at the prompt to continue : " -NoNewline
$yesno = Read-Host
If ( $yesno -ne "YES" ) { EXIT }

Write-Host -ForegroundColor Gray " ------------------------------------------------------------- "
Write-Host -ForegroundColor Cyan " Cluster IP : " -NoNewline
Write-Host -ForegroundColor White $ClusterIP
Write-Host -ForegroundColor Cyan " SVM : " -NoNewline
If ($SVM -eq "*")
   Write-Host -ForegroundColor White "ALL Data SVMs "
   Write-Host -ForegroundColor White $SVM
Write-Host -ForegroundColor Gray " ------------------------------------------------------------- "

# Ping Cluster IP - Exit if not reachable

Write-Host -ForegroundColor Yellow " Testing connection to $ClusterIP "
$reachable = Test-Connection $ClusterIP -Quiet
If (!($reachable)) { Write-Host -ForegroundColor Red "`n Cluster Management Interface Not Reachable `n"; EXIT }

# Get Available Modules - check for DataONTAP

Write-Host -ForegroundColor Yellow " Verifying DataONTAP module installed "
$modList = get-module -ListAvailable
if (!($modlist.Name -Contains "DataONTAP")) { Write-Host -ForegroundColor Red "`n NetApp PowerShell Toolkit / DataONTAP Module Not Installed `n"; EXIT }
Import-Module DataONTAP -Force

# Connect to Cluster

Write-Host -ForegroundColor Yellow " Connecting to Cluster IP "
$connection = Connect-NcController $ClusterIP

# Get list of data SVMs
Write-Host -ForegroundColor Yellow " Building SVM List `n"
$v = get-NcVserver -Template
$v.VserverType = "data"
If ($SVM -ne "*") { $v.Vserver = $SVM }
$dataSVMs = get-NcVserver -Query $v

Write-Host -ForegroundColor Gray " ------------------------------------------------------------- `n"

# See if any data SVMs were found

If ( $dataSVMs.Count -eq 0 ) { Write-Host -ForegroundColor Red " Data SVM Not Found `n`n"; EXIT }

# Unmount, offline, and delete each volume for each SVM then DELETE the SVM

foreach ($dataSVM In $dataSVMs)
     $svmName = $dataSVM.Vserver
     Write-Host -ForegroundColor Cyan " SVM : " -NoNewline
     Write-Host -ForegroundColor White $svmName

     # Get list of volumes

     $vols = get-NcVol -Vserver $dataSVM.Vserver

     # Delete the volume

     foreach ( $vol In $vols )

          $volName = $vol.Name

          # Root volume must be deleted last

          If ($vol.JunctionPath -ne "/" )
               Write-Host -ForegroundColor Cyan " -- Volume " -NoNewline
               Write-Host -ForegroundColor White ": $volName : " -NoNewline
               Dismount-NcVol -VserverContext $dataSVM.Vserver -Name $vol.Name -Force | Out-Null
               set-NcVol -VserverContext $dataSVM.Vserver -Offline -Name $vol.Name | Out-Null
               Remove-NcVol -VserverContext $dataSVM.Vserver -Name $vol.Name -Confirm:$false | Out-Null

               Write-Host -ForegroundColor Magenta " DELETED "
               $rootVol = $vol

     # Delete the root volume to the SVM

     If ( $rootVol )
          $volName = $rootVol.Name
          Write-Host -ForegroundColor Cyan " -- Volume " -NoNewline
          Write-Host -ForegroundColor White ": $volName : " -NoNewline
          set-NcVol -VserverContext $dataSVM.Vserver -Offline -Name $rootvol.Name | Out-Null
          Remove-NcVol -VserverContext $dataSVM.Vserver -Name $rootvol.Name -Confirm:$false | Out-Null

          Write-Host -ForegroundColor Magenta " DELETED "

     # Delete the SVM

     Write-Host -ForegroundColor Cyan " SVM " -NoNewline
     Write-Host -ForegroundColor White ": $svmName : " -NoNewline
     Remove-NcVserver -VserverName $dataSVM.Vserver -Confirm:$false | Out-Null
     Write-Host -ForegroundColor Magenta " DELETED `n "

Write-Host -ForegroundColor Gray " ------------------------------------------------------------- `n`n "



VSC 6 UI Integration Missing from vSphere 6 Web Client

After installing NetApp Virtual Storage Console v6.0 or 6.1, the installation is functional and working until a reboot of the vCenter Server.

Software Versions: 
  • vSphere 6.0 Update 1b
  • VSC 6.1 (or 6.0) 
  • Windows 2012 R2, Windows 2012, Windows 2008 R2

faultString:'org.springframework.remoting.RemoteConnectFailureException: Could not connect to HTTP invoker remote service at [null]; nested exception is java.net.ConnectException: Connection refused: connect'faultDetail:'null'
The issue seems to be the VSC service (Virtual Storage Console for VMware vSphere Server - NVPF) doesn’t start after a reboot.  It is set to [Automatic] but it attempts to start before the necessary vCenter services are running and gives up. This explains why it would work after installation but after a reboot it'd stop and throw the fault error.  I manually started the VSC service then opened a new web client session and no errors when accessing the VSC summary page.

The fix I used to handle the reboot was to add a service dependency to the VSC service.  I chose the vSphere Web Client service which is one of the last vCenter services to start. 
Open a PowerShell window using ‘Run As Administrator’ then enter the following command: 
 & sc.exe config NVPF depend= vspherewebclientsvc  
Note there is a [space] after the equal sign 
I have rebuilt and rebooted the vCenter multiple times and it has worked every time.  Tested on Windows 2012 R2, Windows 2012, and Windows 2008 R2 - all showed the same issue.
Also posted on VMware Communties (https://communities.vmware.com/message/2565159)