we have a problem with our powershell script to restore SQL Server databases (Case #04911078).
Since we have upgraded to V11 our powershell script to restore databases doesn't work anymore.
This is the script which does work with V10 and not with V11.
We get this error:
Restore-VESQLDatabase : Access is denied: unable to pass current account's context to the mount server mountserver.mountserver.com, please supply credentials and try again.
I have no idea who to pass the credentials to the mountserver.
Any help is appreciated.
Code: Select all
#Add-PSSnapin VeeamPSSnapin;
connect-vbrserver -server "server" -user 'server\administrator' -password 'password'
$source = 'sqlserver';
$restorepoint = Get-VBRApplicationRestorePoint -SQL -Name $source -ErrorAction Stop | Sort -Property CreationTime -Descending | Select -First 1;
$sessions = Start-VESQLRestoreSession -RestorePoint $restorepoint[0];
$db = Get-VESQLDatabase -Session $sessions[0] -Name "<databasename>";
Write-Output "$db";
$secpasswd = ConvertTo-SecureString 'password' -AsPlainText -Force;
$sqlcreds = New-Object System.Management.Automation.PSCredential -ArgumentList 'user', $secpasswd;
Restore-VESQLDatabase -Database $db -ServerName "targetservername" -SqlCredentials $sqlcreds -UseSQLAuthentication; # -File $vmDbFiles -TargetPath $dbFiles -SqlCredentials $sqlcreds -UseSQLAuthentication -force -ErrorAction Stop;
Stop-VESQLRestoreSession -Session $sessions[0]; # Close Veeam Restore Session
#Stop the connection
Disconnect-VBRServer | out-null;
Marcus