As my quest continues to find out more ways to get exceptions (see this last post for my first attempt), I have been sent this post at MSDN, which greatly helps me on my way. (Thanks Peter and Swaminathan)
Until now, it has been somewhat of a mystery to me how to generate the catch [class] to successfully catch the specific error you want. As demonstrated in the above link, the following command reveals all....
I will be noting all errors / exceptions I encounter so a future blog post will be in the making soon. I will also be seeing if the -force option reveals anything useful elsewhere!
Until now, it has been somewhat of a mystery to me how to generate the catch [class] to successfully catch the specific error you want. As demonstrated in the above link, the following command reveals all....
$Error[0] | fl * -forceAs shown in the link, it reveals Microsoft.ActiveDirectory.Management.ADPasswordComplexityException as the class to catch. so all you need to do is insert (or run) this line just after an error is generated and you will see what you need to catch!
I will be noting all errors / exceptions I encounter so a future blog post will be in the making soon. I will also be seeing if the -force option reveals anything useful elsewhere!
Comments
Post a Comment