PowerShell script exchange
Post Reply
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Need to publish last mssql daily

Post by kmbstech »

I need to to publish a mssql backup to a dev server daily so data can be collected from it. How would I select the last backup session ? I plan on using Publish-VESQLDatabase to publish but have no idea how to get the backup that I need.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Need to publish last mssql daily

Post by oleg.feoktistov »

Hi,

You could get application restore points, filter the one you need by creation time, start a restore session, get database and finally publish it. For examplre:

Code: Select all

$sql = Get-VBRApplicationRestorePoint -SQL
$sqlLast = $sql | sort -Property CreationTime -Descending | select -First 1
$session = Start-VESQLRestoreSession -RestorePoint $sqlLast
$database = Get-VESQLDatabase -Session $session
Restore-VESQLDatabase # ... etc.
Thanks,
Oleg
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Need to publish last mssql daily

Post by kmbstech »

Thanks
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests