Quantcast
Channel: VMware Communities : Discussion List - Automation Tools
Viewing all articles
Browse latest Browse all 9071

Track Status of move-vm Task fails

$
0
0

Hey,

 

i am working on a script which check the status of the datastore befor a snapshot of a vm is taken. If the free space on the ds in not enough it will move the vm to a other ds which will meet the needed free space.

 

The script works well so far. But sometimes the move process take a time and i want to get some Info about the state of completion of the task...I tryed this..

 

<code snip>

if ($targetDS) {

            write-host "Die VM" $vm "wird nun von" $aktivDS.Name "nach" $targetDS.Name "verschoben" -ForegroundColor DarkGreen

            $moveVMJob = Move-VM -VM $vm -Datastore $targetDS.Name -RunAsync -Confirm:$false

           

            while ('Success', 'Error' -notcontains $moveVMJob.State) {

                $moveVMJob

                Write-Output $moveVMJob.PercentComplete

                sleep 5

           }    

</code snip>

 

<output snip>

Die VM snaptest2 wird nun von testserver_02-000C2 nach testserver_03-00088 verschoben

 

 

Name            State   % Complete Start Time Finish Time

----            -----   ---------- ---------- -----------

RelocateVM_Task Running          0 11:22:28

0

RelocateVM_Task Running          0 11:22:28

0

RelocateVM_Task Running          0 11:22:28

0

RelocateVM_Task Running          0 11:22:28

0

RelocateVM_Task Running          0 11:22:28

0

RelocateVM_Task Running          0 11:22:28

0

RelocateVM_Task Running          0 11:22:28

<output snip>

 

What do i wrong?

 

Thanks

Feix


Viewing all articles
Browse latest Browse all 9071

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>