Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Microsoft Virtualization Discussions

No Get-NaLun data returned in DataOnTap scripts


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:

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
    + 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


Any idea why this is happening?



Ok, here is what happened.

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


NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner