VMware Cloud Community
hguthrie
Contributor
Contributor
Jump to solution

Disk Consolidation Script -- Issue retrieving status/error message

First off, this is a follow-up to a post from a little over a month ago.  The script has been expanded significantly since then and has given me a chance to explore using -WhatIf and other more sophisticated features.

Here's a link to the current script (with a few variables redacted).

If the disk consolidation task encounters an error, I'm having trouble retrieving an error message.  The Invoke-DiskConsolidation function creates the ConsolidateVMDisks_Task() on line 143​, and I keep track of the Task ID and VM name in a HashTable so that I can retrieve the task's State (Success, Error, or Running).  I can't figure out how to retrieve a potential error message.

From the vSphere GUI, I can see the tasks created by the script and their associated status/error message of "Unable to access file since it is locked", but I can't figure out how to retrieve this message using PowerCLI.

pastedImage_6.png

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

When you have the failing Task in $task, did you already check $task.ExtensionData.Info.Error?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

When you have the failing Task in $task, did you already check $task.ExtensionData.Info.Error?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
hguthrie
Contributor
Contributor
Jump to solution

Luc,

That's it! Thanks so much.

Reply
0 Kudos