We need to automate a backup from a SQL Server and restore one database in the test server, everyday.
I collected some scripts and made one working script (i will change the name server in it) . The only problem in the script is that it uses the old Start-VBRSQLDatabaseRestore, and the problem is that it only restore to c:\, and in the test server i need to be in e:\ for example
I tried to use the new Restore-VESQLDatabase that allow changing the folder, but i cannot make it work. Support told me that they cant help with scripts. Anyone can give a light of how to change / do it?
Script (im not the author of it!) :
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn
$restorepoint = Get-VBRApplicationRestorePoint -SQL -Name "ProductionSQL"
$ProductionDatabase = Get-VBRSQLDatabase -ApplicationRestorePoint $restorepoint[-1] -Name "ProductionDatabase"
$guestcreds = Get-VBRCredentials -Name "DOMAIN\VeeamSvc"
$sqlcreds = Get-VBRCredentials -Name "DOMAIN\VeeamSvc"
Start-VBRSQLDatabaseRestore -Database $ProductionDatabase -ServerName TestSQLServer -DatabaseName ProductionDatabaseTest -GuestCredentials $guestcreds -SqlCredentials $sqlcreds -Wait