Microsoft Virtualization Discussions

No Get-NaLun data returned in DataOnTap scripts

kylecummings
2,481 Views

I am having trouble with several PowerShell scripts when it comes to getting data from the Get-NaLun routine.  It seems like the routine is not populating the variable when called in my case.

Most of the scripts I have saved from this site have the following line in them:

$LunList = Get-NaLun

Later in the scripts they use code like this:

Foreach ($LUN in $LunList)
             {     $Sour=$LUN.Path
                  
Write-Host "Sour:  " $Sour
                   $spath = $Sour.Split("/")

                   if ($spath[2].equals($vol.name))

---> etc

I added the code in bold to see if anything is ever set in the variable and I always get a null value.

I am able to get plenty of other information from the NetApp and the credentials allow me to get in with no problems.  The error messages I get are always:

Sour:
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Documents\NetApp_ThinProv.ps1:42 char:45
+                         $spath = $Sour.Split <<<< ("/")
    + CategoryInfo          : InvalidOperation: (Split:String) [], RuntimeExce
   ption
    + FullyQualifiedErrorId : InvokeMethodOnNull

Cannot index into a null array.
At C:\Users\Administrator\Documents\NetApp_ThinProv.ps1:43 char:36
+                         if ($spath[ <<<< 2].equals($vol.name))
    + CategoryInfo          : InvalidOperation: (2:Int32) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Sour:

Any idea why this is happening?

1 REPLY 1

kylecummings
2,481 Views

Ok, here is what happened.

The NetApp filer I was given to test on did not have any freakin' LUNs.

Great.

Public