Am deploying multiple vms by running the below commad,
> new-vm -vmhost <hostname> -name <vmname> -template <temp_name> -datastore <datastore_name> -runasync
So the prompt is immediately returned and the command runs in the background.
now i have to collect the error messages if any from the output of the above command.
using get-task i can only find if the state of the task is "success" or "error"
Is there any command or parameter of get-task from where i can get the actual error message as why the command would have failed?
Take a look at Luc's "SDK Best Practices" blog post. The example under "Handle Faults Carefully" will probably solve your question.
Regards, Robert
Amazing.. that solved my problem..