LucD
Leadership
Leadership

Have you tried this solution frlom the NetApp forum?

Import-Module DataONTAP

Connect-VIServer your.vcenter

Connect-NcController your.cdot.system


$naluns = Get-NcLun

$ds = Get-Datastore | ? { $_.Type -eq "VMFS" }


$ds | % {

   Write-Host "Finding LUNs for datastore $($_.Name)"

   $luns = $_ | Get-ScsiLun | ? { $_.CanonicalName -match "naa.600a0980*" }


   if ($luns.length -gt 0) {

   Write-Host "  Found $($luns.length) paths"

   $completed = @()


   $luns | % {

   if (!$completed.Contains($_.CanonicalName)) {

   $hexSerial = ($_.CanonicalName).Substring(12)

   $serial = for ($i = 0; $i -lt $hexSerial.length; $i += 2) {

   [char][int]::Parse($hexSerial.substring($i, 2), 'HexNumber')

   }


   $ntapSerial = $serial -join ""

   Write-Host "  NetApp LUN serial is: $($ntapSerial)"


   $ntapLun = $naluns | ? { $_.SerialNumber -eq $ntapSerial }

   Write-Host "  NetApp SVM: $($ntapLun.Vserver)"

   Write-Host "  LUN Path: $($ntapLun.Path)"

   $completed += $_.CanonicalName

   }

   }

   }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference