VMware Cloud Community
halr9000
Commander
Commander

Job objects

I'm not getting some expected results here:

81# $job = $pvm | New-Snapshot -Name '2008-02 pre-drop' -RunAsync -Confirm:$false
81# $job

Name                           State      % Complete Start Time   Finish Time
----                           -----      ---------- ----------   -----------
CreateSnapshot_Task            Running             0 02:35:21 PM
CreateSnapshot_Task            Running             0 02:35:21 PM
CreateSnapshot_Task            Running             0 02:35:21 PM
...

All of the snapshots were completed 10 seconds later. If I enumerate $job again, the status remains the same as you see above. Is this a bug?

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
2 Replies
admin
Immortal
Immortal

The objects do not change. That said, this is a gap. It should be possible to pass the tasks to get-task to get their updated status but that does not currently work. If you're interested in waiting for the task to complete, wait-task should work. (Yes, I know that's not the same - we need to look at this).

halr9000
Commander
Commander

A good way to tackle this, I think, would be to enhance the Get-Task cmdlet so that it can accept a TaskID by pipeline.

$job = new-snapshot $foo

$job | get-task

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos