PowerShell script exchange
Post Reply
iihaus
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 19, 2023 2:05 pm
Full Name: Haus Fupepe
Contact:

Restore-VESQLDatabase odd behavior

Post by iihaus »

Hello All,

I am doing nightly restores of a couple databases using powershell. Everything was working fine but now I'm running into the following error:

Code: Select all

PS>TerminatingError(Restore-VESQLDatabase): "The specified file already exists on the target server."
Restore-VESQLDatabase : The specified file already exists on the target server.
At D:\Scripts\<MyScriptName>.ps1:139 char:9
+         Restore-VESQLDatabase -ServerName $setToSQLServer -Database $ ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Restore-VESQLDatabase], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.SQL.PowerShell.RestoreVESQLDatabaseCmdlet
I am using the -Force command. The odd thing is that the script restores database A fine (which also already exists on the target server) but I get this message when it attempts to restore database B.

Any thoughts?

Thank you!
iihaus
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 19, 2023 2:05 pm
Full Name: Haus Fupepe
Contact:

Re: Restore-VESQLDatabase odd behavior

Post by iihaus »

After some further research it turns out when we moved the script someone else changed the location of the log file and the script was looking at the old location. I've updated my script to look at the new location.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests