PowerShell script exchange
Post Reply
deubelm
Influencer
Posts: 15
Liked: 2 times
Joined: Jul 04, 2018 10:19 am
Contact:

B&R V11: powershell SQL Server DB Restore issue

Post by deubelm »

Hello community,
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;
Regards
Marcus
deubelm
Influencer
Posts: 15
Liked: 2 times
Joined: Jul 04, 2018 10:19 am
Contact:

Re: B&R V11: powershell SQL Server DB Restore issue

Post by deubelm » 2 people like this post

Problem solved.
For V11 the parameter GuestCredentials has to be applied which wasn't necessary in V10.
Post Reply

Who is online

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