I am running an invoke-vmscript command and assigning it to an object, but I am getting an 'Object reference not set to an instance of an object' error. I am presuming that my script in invoke-vmscript is returning null, but I am pretty confident that my script should output something, even if they are error messages. I set the error action preference to stop, and I have the whole script surrounded in a try-catch where the exception message is written in the catch block. Yet, that Object reference error persists. What is going on, and what troubleshooting measures can I take to find the solution? Thank you
You can add the Verbose switch to check if that returns more info.An alternative option is to try my Invoke-VMScriptPlus which is a bit more talkative.And has more options than the original.