Get current state of "Rescan repository"

PowerShell script exchange

Get current state of "Rescan repository"

Veeam Logoby edirschedl » Wed Jan 18, 2017 9:01 am

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
edirschedl
Influencer
 
Posts: 22
Liked: 2 times
Joined: Thu Jul 21, 2016 12:29 pm

Re: Get current state of "Rescan repository"

Veeam Logoby tdewin » Wed Jan 18, 2017 9:35 am 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
tdewin
Veeam Software
 
Posts: 1091
Liked: 378 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: Get current state of "Rescan repository"

Veeam Logoby edirschedl » Wed Jan 18, 2017 1:27 pm

Thank you very much! I tried it before and it worked for me.
edirschedl
Influencer
 
Posts: 22
Liked: 2 times
Joined: Thu Jul 21, 2016 12:29 pm

Re: Get current state of "Rescan repository"

Veeam Logoby jim3cantos » Mon Jun 12, 2017 8:06 am

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
jim3cantos
Enthusiast
 
Posts: 43
Liked: 5 times
Joined: Tue Jan 08, 2013 6:14 pm
Location: Madrid, Spain
Full Name: José Ignacio Martín Jiménez


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 24 guests