PowerShell script exchange
Post Reply
jdw
Technology Partner
Posts: 11
Liked: 3 times
Joined: Apr 18, 2016 11:26 pm
Full Name: JD Wallace
Location: Seattle, WA
Contact:

Sync-StoragePluginHost / Volume status

Post by jdw »

Is it possible to get the status of a Sync-StoragePluginHost or SyncStoragePluginVolume request? I'm in a scenario where I need to sync to pick up a new snapshot but then I want to wait until the sync task is complete before I do some other work.

oleg.feoktistov
Veeam Software
Posts: 971
Liked: 356 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Sync-StoragePluginHost / Volume status

Post by oleg.feoktistov »

Hi JD,

Sure, here is a simple while loop for that purpose:

Code: Select all

$pluginHost = Get-StoragePluginHost -Name 'pluginHost01'
$sync = Sync-StoragePluginHost -Host $pluginHost


$stopped = $false
while ($stopped -eq $false) {
  $sessionCheck = Get-VBRSession -Id $sync.Id
  if ($sessionCheck.State -eq 'Stopped') {
    Write-Host "Storage plugin host sync session with id: $($sessionCheck.Id) has stopped with status: $($sessionCheck.Result)"
    $stopped = $true
  }
} 

The same goes for Sync-StoragePluginVolume. There is just an additional step to get a volume before triggering synchronisation.

Thanks,
Oleg

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests