PowerShell script exchange
Post Reply
papajon0s1
Novice
Posts: 3
Liked: 1 time
Joined: Nov 18, 2019 9:23 pm
Full Name: Jonathan Schulteis
Contact:

(Case #04592413) SQL Restore

Post by papajon0s1 »

Long story short, trying to schedule a restore of an SQL Database and I am struggling badly with the commands to do this. The latest roadblock is this error: "Restore-VESQLDatabase : Cannot convert 'System.Object[]' to the type 'System.Management.Automation.PSCredential' required by parameter 'GuestCredentials'. Specified method is not supported." I tried several different versions of the command(s) to get credentials, but no luck. The current line reads "$target_credentials = Get-VBRCredentials -Name *administrator* ". And the line that fails is " Restore-VESQLDatabase -Database $database -ServerName $target_vm -TargetFolder "C:\SQL\Restore" -GuestCredentials $target_credentials -SqlCredentials $target_credentials ". I tried using just the "Get-Credentials" but that also fails. It's like some odd type mismatch of some kind??? Maybe? I feel I am missing something obvious... Any thoughts on this are greatly appreciated.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: (Case #04592413) SQL Restore

Post by oleg.feoktistov »

Hi Jonathan,

The error you see means that you have an array of credentials obtained with Get-VBRCredentials and assigned to $target_credentials variable. That's why it reads 'System.Object[]', with square brackets meaning 'array'.
You might want to explore what is in $target_credentials and choose the right creds with filtering or referencing it by index.
Also, I don't quite remember if Restore-VESQLDatabase can convert the object obtained with Get-VBRCredentials to PSCredential class,
so you might need to take that into account and try the same with Get-Credential.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests