VMware

Deploying a VM with Static IP in 3 Steps | Main | Dealing with the inevitable events in life – reporting problems with PowerCLI

July 23, 2010

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.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c328153ef0133f27df5e2970b

Listed below are links to weblogs that reference Error handling with PowerCLI 4.1:

Comments

Post a comment

If you have a TypeKey or TypePad account, please Sign In.

About this Blog

This blog provides insight and highlights for VMware PowerCLI, the best tool for automating management and configuration of VMware vSphere.

Subscribe via RSS  

Recommended Reading

Pimp your PowerCLI

Twitter


Facebook

    VMware Blogs