Microsoft Virtualization Discussions

NetApp Powershell Toolkit - Get-NcSnapshot : Object reference not set to an instance of


Hello Community,


We currently try to update to PSTK But when you use 

Get-NcSnapshot -volume $volume 


You get an exception: Object reference not set to an instance of an object.


Same when you use New-NcSnapshot command.


Did anyone here get a solution or is PSTK only usable with "-zapi" legacy switch?






Any solution or comment? I have the exact same problem. Thank you!


I am not sure but looks like it is a very generic error so difficult to pin-point the actual cause. I found one thread while researching this generic error which may be helpful.  You can give it a try.


Could you try the suggestion given in the thread below by Stefan.

He is suggesting to increase the global time-out for the commands (Default:60seconds).


"On some controllers this timeout is not sufficient. If you issue: $gobal:CurrentNaController.TimeoutMsec=600000 the timeout is increased for the current controller"





I recently tried your suggestion:

PS C:\Users\########> $global:CurrentNcController

Name                 Address           Vserver              Version
----                 -------           -------              -------
systemname                         NetApp Release 9.10.1P11: Thu Feb 23 06:55:33 UTC 2023

PS C:\Users\########> $global:CurrentNcController.TimeoutMsec = 600000
PS C:\Users\########> Get-NcSnapshot -Volume vol0_SVM01
Get-NcSnapshot : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-NcSnapshot -Volume vol0_SVM01
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-NcSnapshot], ArgumentException
    + FullyQualifiedErrorId : Object reference not set to an instance of an object.,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.GetNcSnapshot


For a ONTAP 9.12.1 System you get the message "WARNING: Record doesn't exist" even if there are Snapshots on the System.



The issue occurs on systems with low load and with high load equally. Even the model plattform can be varied.


I see the same problem with a different command, Get-NcQuotaReport, in a custom volume, qtree, aggregate report after an upgrade from PSTK 9.8 to 9.12.  I'm trying to get ready for the end of ONTAPI calls, but it seems not everything is working.   The temporary solution for me was found in another topic, which was to do a Connect-NcController with the -ONTAPI switch at the end.   Not much of a workaround, but at least it proves I'm not crazy.   ONTAP version 9.11.1P4.


Recently, I have performed some extensive testing to get our current set of Powershell scripts working with REST API.  Using PSTK v9.13.1.2306


I have thus far been disappointed by the results. 


On the positive side, the very basic functionality is there.  You can use the same cmdlets with REST and ONTAPI  and they work at a basic level.  PSTK hides the complexity of the underlying calls and provides a consistent set of cmdlets.


On the not-so-great side, many common cmdlets (get-ncvol, get-ncvserver to name a few) do not return all of the properties with REST which they do with ONTAPI.  Since my scripts require these properties to be returned, I am unable to use the REST API and have to specify -ONTAPI for many of my calls.


There are other issues with REST, among them:

  • REST calls in some cases are noticeably slower than ONTAPI,
  • The help pages for the cmdlets in many cases have not been fully updated to match the cmdlet (example the -ONTAPI option is not even mentioned),
  • Some cmdlets behave differently with REST than with ONTAPI

I would be happy to share specific cmdlets which I have tested and which are inconsistent between REST and ONTAPI


In short, if Netapp expects us to migrate to REST, they are going to have to develop their cmdlets for more consistent functionality and performance between REST and ONTAPI


Hello, i have also the same problem after upgrade to 9.12.1P5 get-ncsnapshot like before.  i use for exemple this command Get-NcSnapshot -Volume *P*  to find snapshot on volume with "P" . It doesn't work  anymore

Get-Ncvol -Volume '*_P*' -Vserver '!*-mc' |Get-NCSnapshot
Get-NCSnapshot : Volume parameter neither specified nor set
Au caractère Ligne:1 : 44
+ Get-Ncvol -Volume '*_P*' -Vserver '!*-mc' |Get-NCSnapshot
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-NcSnapshot], ArgumentException
+ FullyQualifiedErrorId : Volume is empty,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.GetNcSnapshot