This is my first foray into trying to trap a specific error in powershell with try/catch and I am stuck. I can't seem to figure out what exactly I need to use to trap this error. I have a loop that is checking a collection of filers, this section of the code is looking for un-failed, un-owned disks. Four of our filers have hardware ownership rather than software ownership so this command fails when run against them. I want to trap for this specific error and just simply continue. The code below is as far as I have gotten, I can't even trap the error and get it to write to the console. What am I doing wrong?
I used this command to get the Sytem.InvalidOperationException; $error.Exception.psobject.typenames