PowerShell script exchange
Post Reply
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Monitor Quick Migration Progress

Post by tsightler »

It's very easy to start a Quick Migration job with Powershell, however, I can't find any way to monitor the progress or to know when it's complete. Is it hiding somewhere that I just can't find?
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Monitor Quick Migration Progress

Post by tsightler »

I still haven't found any method to monitor the progress of a Quick Migrate using Veeam session data, but I did figure out a crude method to determine when the migration is complete by querying the disk path of the VM.

Code: Select all

$VMName = "<VM_Name>"
$TargetDatastore = "<Datastore_Name>"
do {
    $VMDataStorePath = (Find-VBRViEntity -DatastoresAndVMs -Name $VMName).Path.Split("\")
    $VMDataStore = $VMDataStorePath[$VMDataStorePath.Length-2]
    if ($VMDataStore -ne $TargetDatastore) {
        Sleep 30
    } else {
        Write-Host "Migration Complete:" $VMName
    }
} while ($VMDataStore -ne $TargetDatastore)
I'm still interested in finding a better way if anyone knows of a better option, but this seems to work fairly well.
rennerstefan
Veeam Software
Posts: 688
Liked: 150 times
Joined: Jan 22, 2015 2:39 pm
Full Name: Stefan Renner
Location: Germany
Contact:

Re: Monitor Quick Migration Progress

Post by rennerstefan »

Very old thread but worth to post an update in case someone is looking at it:

#Define the variables
$vm = Find-VBRViEntity -Name "RELAEX01_recovery"
$server = Get-VBRServer -Name "relaesx02.relab.local"
$datastore = Find-VBRViDatastore -Server $server -Name "RELAESX01_NVME"

#Start the session and save the session in a variable (important to set -RunAsync for the script to continue
$session1 = Start-VBRQuickMigration -Entity $vm -Server $server -Datastore $datastore -DeleteSorceVmFiles -RunAsync

#repeat those two commands each time you want to refresh the percentage value
$runningsession = Get-VBRSession -Id $session1.id
$runningsession.Progress


The session ID has to be refreshed each time and the the .progress shows the percentage.
Of course this can be put into a loop as needed.

Thanks
Stefan Renner

Veeam PMA
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests