Home > Blogs > VMware PowerCLI Blog


Error handling with PowerCLI 4.1

Complex scripts need to handle errors and resolve common error scenarios without user interaction. A step in that direction is exposing the entire specter of vCenter server error hierarchy along with PowerCLI specific exceptions (for example when validating input parameters). 

This improvement makes possible to write scripts which handle expected errors and deal with them as it’s shown below:

In addition to this feature the full exception chain is available in the error records as inner exception.  So if the error is PowerCLI specific exception, the inner exception can be used to get the underlying vCenter Server error.

PowerCLI41 error

Thanks to that you can easily tune your script to check the returned by the server NoDiskSpace MethodFault and deal with it specifically.

Leave a Reply

Your email address will not be published. Required fields are marked *

*