PowerShell script exchange
Post Reply
Posts: 1
Liked: never
Joined: Feb 14, 2020 6:31 am

Restore current copy

Post by krisak8989 »

Good afternoon!
Tell me how to restore the current copy of the SQL database using PS?

From the management console, I have the ability to restore the closest point. Via PS, the output of the Get-VBRRestorePoint command does not show the latest recovery points. Log transactions every 15 minutes

Egor Yakovlev
Veeam Software
Posts: 1521
Liked: 346 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev

Re: Restore current copy

Post by Egor Yakovlev »

You need to use Start-VESQLRestoreSession, pick a database from mounted backup via Get-VESQLDatabase, find available restore interval Get-VESQLDatabaseRestoreInterval and restore via Restore-VESQLDatabase with -ToPointInTime parameter. Last but not least, stop mounted session via Stop-VESQLRestoreSession.

Check out Veeam Explorer for Microsoft SQL Powershell Reference Guide.


Veeam Software
Posts: 499
Liked: 167 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov

Re: Restore current copy

Post by oleg.feoktistov » 1 person likes this post

Besides, use Get-VBRApplicationRestorePoint rather than Get-VBRRestorePoint to retrieve restore points with AAIP enabled.
Then, filter it by creation time and pass to Start-VESQLRestoreSession, like Egor wrote above.

Code: Select all

$date = (Get-Date).AddHours(-24)
$restorepoint = Get-VBRApplicationRestorePoint -SQL | where {$_.CreationTime -ge $date}
Start-VESQLRestoreSession -RestorePoint $restorepoint[-1]

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests