PowerShell script exchange
Post Reply
edirschedl
Enthusiast
Posts: 44
Liked: 4 times
Joined: Jul 21, 2016 12:29 pm
Full Name: Emanuel Dirschedl
Contact:

Get current state of "Rescan repository"

Post by edirschedl »

Hi,

is it possible to get the current status of a "Rescan repository" task, initiated with help of Sync-VBRBackupRepository? How can I do that with Powershell?
I want to automate a regular rescan of specific repositories and I want to know, if this task was successful.


Thank you,

Emanuel
tdewin
Veeam Software
Posts: 1818
Liked: 655 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Get current state of "Rescan repository"

Post by tdewin » 2 people like this post

Not really supported I guess but you can do this. Capture the session, then refind the session to get an updated view

Code: Select all

$sess = Get-VBRBackupRepository -name "Default Backup Repository" | Sync-VBRBackupRepository
while ($sess.State -in @("Working","Starting")) { $sess = [Veeam.Backup.Core.CBaseSession]::Get($sess.Id);start-sleep -seconds 1 }
write-host $sess.Result
edirschedl
Enthusiast
Posts: 44
Liked: 4 times
Joined: Jul 21, 2016 12:29 pm
Full Name: Emanuel Dirschedl
Contact:

Re: Get current state of "Rescan repository"

Post by edirschedl »

Thank you very much! I tried it before and it worked for me.
jim3cantos
Enthusiast
Posts: 64
Liked: 12 times
Joined: Jan 08, 2013 6:14 pm
Full Name: José Ignacio Martín Jiménez
Location: Madrid, Spain
Contact:

Re: Get current state of "Rescan repository"

Post by jim3cantos »

I think you can achieve same result using -Wait option (new?) in Rescan-VBREntity command

Code: Select all

$Repository = Get-VBRBackupRepository -Name "veeamrepo" 
$sess = Rescan-VBREntity -Entity $Repository -Wait
write-host $sess.Result
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests