Handling Job Objects with Hyper-V WMI scripting

Many of the methods in the Hyper-V WMI have an odd way of returning status.  They can either immediately return a return value - or instead return a job object - and it can be hard to predict which one you are going to get.  The reason for this is that some methods are always […]

Many of the methods in the Hyper-V WMI have an odd way of returning status.  They can either immediately return a return value - or instead return a job object - and it can be hard to predict which one you are going to get.  The reason for this is that some methods are always synchronous (and return a return value), some methods are always asynchronous (and return a job object) while other methods can be executed synchronously or asynchronously on the back end by WMI, and could return either.

The job object returned by asynchronous methods allows you to track the progress of the operation, and get detailed error information in the case of a failure.

Full Article