Subscribe
Accepted Solution

Get-NCVol Returns "Object reference not set to an instance of an object."

Has anyone got this error before when trying to run get-ncvol? the command passes back some of the volumes before failing.

 

get-ncvol : Object reference not set to an instance of an object.
At line:1 char:1
+ get-ncvol
+ ~~~~~~~~~
+ CategoryInfo : InvalidOperation: (n1fsc1.nas.cat.com:NcController) [Get-NcVol], NullReferenceException
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Volume.GetNcVol

Re: Get-NCVol Returns "Object reference not set to an instance of an object."

Actually looking further into it, I'm getting it on a bunch of commands. It seems specific to that cluster, and it is not just the server running the script.  I tried it on my PC, and got the same error.

 

This cluster is running 8.2.2p1

Re: Get-NCVol Returns "Object reference not set to an instance of an object."

I have seen this when I am testing newly developed code.  Could you post the complete section of code that you believe is generating the error?

 

Mike

Re: Get-NCVol Returns "Object reference not set to an instance of an object."

I had a similar problem with the clone create applet. It seems like there's a 60 second timeout, after which the applet throws this error. In my case the action was actually completing though, despite the error. I was able to work around the issue similar to this:

 

$CloneVolume = $Null
$LoopCounter = 0

Get-WFALogger -Info -Message $("--- Creating volume clone $($CloneVolName) of parent volume $($ParentVolname) with backing snapshot $($ParentVolName).")

Try { New-NcVolClone -VserverContext $VserverName -CloneVolume $CloneVolName -ParentVolume $ParentVolname -ParentSnapshot $ParentSnapname -SpaceReserve none -ErrorAction SilentlyContinue }
Catch { Get-WFALogger -Warn -Message $("=== Caught an error in previous command.") }

While (!$CloneVolume -And ($LoopCounter -le 3)) {

  $CloneVolume = Get-NcVolClone -Vserver $VserverName -Name $CloneVolName -ErrorAction SilentlyContinue
  
  If (!$CloneVolume) {
    Get-WFALogger -Warn -Message $("=== Timed out waiting for $($CloneVolName) to arrive - waiting another 10 seconds.")
    Sleep 10
    $LoopCounter++
  }  

}

 I'm sure there's a better way to address the issue, but this is has been working in my case for over a week now.

Re: Get-NCVol Returns "Object reference not set to an instance of an object."

Sorry guys, I left you alll hanging on this thread. For me it ended up being that one of the nodes was down. When the node issue was resolved the error went away. I believe the cluster at the time was running 8.2.1, but I could be mistaken. 

 

Thanks for all your input.