Active IQ Unified Manager Discussions

Object reference not set to an instance of an object error


We are itermittently recieving the error, Error: Object reference not set to an instance of an objec, when invoking the following powershell cmdlets via WFA 3.1? Does anyone have diagnosis, it looks like the commands are applying changes to the storage systems so we are a little confused on the return message from WFA/Powershell.







I've had a chance to review solutons in existence on the community, including rolling back the powershell toolkit version and the error still persists.  I'm primarly seing the error when executing the cmdlet Start-NaSnapvaultSecTransfer from WFA. Are there any other suggested solutions?




"Object reference not set to an instance of an object" is a very generic error from powershell and can come in many unique cases. We first need to zero down the source of the problem. In WFA the source can be:


1. Windows Powershell

2. DataONTAP Powershell Toolkit

3. The Command's powershell code.


And all the 3 can throw this very error "Object reference not set to an instance of an object" I assume its a custom command.. You can send your command dar file for me to have a look.


Also, you can start some debugging from your end:



 At the end of the command code, add the below code and save the command. Run your workflow and wait for it to fail with the mentioned error.



trap {


$at_line= $_.InvocationInfo.ScriptLineNumber

$at_char = $_.InvocationInfo.OffsetInLine

$at_code = $_.InvocationInfo.Line

Get-WfaLogger -Error -Message "Error Occurred at Code `"$at_code`" Line: $at_line Char: $at_char"





In WFA, debugging a powershell code it very difficult since it only throws the exception, but NOT the location where the exception happened. Bigger the code, so it the problem. The above trap solves it for you.


This should now allow us to predict where is the error cmming from.


Next steps depends on the outcome. Awaiting your response.








If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.




I sent you a couple of messages requesting an email address where I could forward you the results from a failure. Did you see those?