PowerShell script exchange
Post Reply
sarapinho
Enthusiast
Posts: 92
Liked: 7 times
Joined: Nov 10, 2015 12:40 pm
Full Name: Amauri Ramos
Contact:

Reports From Restore

Post by sarapinho »

Hi people,

Through Veeam One or Enterprise Manager is it possible to get a more detailed report about restore?

- Start time
- Duration (Can be determined if an end time is shown)
- File/object sizes
- File/object count
- MB/s throughput

Do we already have a date to have these reports?

Thanks
RomanK
Veeam Software
Posts: 745
Liked: 191 times
Joined: Nov 01, 2016 11:26 am
Contact:

Re: Reports From Restore

Post by RomanK »

Hello Ramos,

Please take a look at Restore Operator Activity report. Is that what you are looking for?

Thanks.
sarapinho
Enthusiast
Posts: 92
Liked: 7 times
Joined: Nov 10, 2015 12:40 pm
Full Name: Amauri Ramos
Contact:

Re: Reports From Restore

Post by sarapinho »

Hi Romank,

I had already seen these reports, but it contains all the information I need as I mentioned.

Could a powershell script be an option?

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

Re: Reports From Restore

Post by oleg.feoktistov »

Hi Amauri,

Oleg from Powershell team here. What kind of restores you are talking about precisely?
For full vm restores, for example, you could script something like that:

Code: Select all

$restores = Get-VBRRestoreSession
foreach ($restore in $restores) {

$taskSessions = $restore.GetTaskSessions()

foreach ($task in $taskSessions) {
  $rate = [Math]::Round(($task.Process | Select-Xml -XPath "/CRestoreFilesProcessInfo").Node.Rate / 1Mb, 2)
  $processedSize = [Math]::Round(($task.Process | Select-Xml -XPath "/CRestoreFilesProcessInfo").Node.ProcessedSize / 1Gb, 2)
  $processedFilesCount = ($task.Process | Select-Xml -XPath "/CRestoreFilesProcessInfo").Node.ProcessedFilesCount
  $startTime = $restore.CreationTime
  $duration = ($restore.EndTime - $restore.CreationTime).ToString()
  $task | select Name, @{n='StartTime';e={$startTime}}, @{n='Duration';e={$duration}}, `
  @{n='ProcessedSize';e={$processedSize}}, @{n='ProcessedFilesCount';e={$processedFilesCount}}, `
  @{n='Rate';e={"$($rate) MB/s"}}
  
  }
}
Keep in mind that the code above is just a workaround as it uses unsupported methods and properties, which are a subject to change from release to release. As for the supported way via APIs, there currently isn't one to get all the info you are after, but we also have these requests noted for a while.

Best regards,
Oleg
sarapinho
Enthusiast
Posts: 92
Liked: 7 times
Joined: Nov 10, 2015 12:40 pm
Full Name: Amauri Ramos
Contact:

Re: Reports From Restore

Post by sarapinho »

Hi Oleg,

Sorry for the delay and thanks for the reply.

In this script, can I add the date that was chosen from the restore?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Reports From Restore

Post by oleg.feoktistov »

Hi Amauri,

Sorry for getting back to you so late. I think I must have forgotten to set up a notification for this topic.
If your question is still relevant, could you please elaborate on "the date chosen from the restore"? Do you mean the time restore started, stopped or else?

Thanks,
Oleg
sarapinho
Enthusiast
Posts: 92
Liked: 7 times
Joined: Nov 10, 2015 12:40 pm
Full Name: Amauri Ramos
Contact:

Re: Reports From Restore

Post by sarapinho »

Hi Oleg.

OK, no problem.

I think I asked the wrong question, in this script to add the point that was chosen from the restore?

Example: If the restore was from the previous day or 15 days ago?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Reports From Restore

Post by oleg.feoktistov »

Now I got you, thanks for the clarification. Yes, it is possible. I re-wrote the script a bit:

Code: Select all

$restores = Get-VBRRestoreSession
$oibs = Get-VBRRestorePoint
foreach ($restore in $restores) {

  $taskSession = $restore.GetTaskSessions()
  $oib = $oibs | where {$_.Id -eq $restore.OibId}
  $rate = [Math]::Round(($taskSession.Process | Select-Xml -XPath "/CRestoreFilesProcessInfo" -ErrorAction SilentlyContinue).Node.Rate / 1Mb, 2)
  $processedSize = [Math]::Round(($taskSession.Process | Select-Xml -XPath "/CRestoreFilesProcessInfo" -ErrorAction SilentlyContinue).Node.ProcessedSize / 1Gb, 2)
  $processedFilesCount = ($taskSession.Process | Select-Xml -XPath "/CRestoreFilesProcessInfo" -ErrorAction SilentlyContinue).Node.ProcessedFilesCount
  $startTime = $restore.CreationTime
  $duration = ($restore.EndTime - $restore.CreationTime).ToString()
  $restore | select Name, @{n='StartTime';e={$startTime}}, @{n='Duration';e={$duration}}, `
  @{n='ProcessedSize';e={$processedSize}}, @{n='ProcessedFilesCount';e={$processedFilesCount}}, `
  @{n='Rate';e={"$($rate) MB/s"}}, @{n='RestorePointTime';e={$oib.CreationTime}}
  
}
Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests