0

Trying to restore the file or files returned by this statement

$backupFiles = Get-ChildItem -Path $BackupPath -Filter "*$tstamp*.bak" -Recurse | Sort-Object -Property CreationTime | Select-Object

I am executing this command. I get a warning and the restore is NOT done.

$backupFiles | Restore-DbaDatabase -SqlInstance $primaryReplica -useDestinationDefaultDirectories -WithReplace

$backupFiles value is below

Mode                LastWriteTime         Length Name                                                                                                                                                                                                                            
----                -------------         ------ ----                                                                                                                                                                                                                            
-a----         9/8/2022  10:36 PM      130576384 WP04034XXXXX_WebStrat_20220908223605_full.bak 

The command throws a warning and does not do the restore. The error seems as if the variable being passed is empty, but it's not, so what gives? See Warning below

WARNING: [16:12:02][Restore-DbaDatabase] No backups passed through. 
 This could mean the SQL instance cannot see the referenced files, the file's headers could not be read or some other issue

This is the code reference to the PowerShell function being used Restore-DbaDatabase

Ken White
  • 123,280
  • 14
  • 225
  • 444
Leo Torres
  • 673
  • 1
  • 6
  • 18
  • 1
    Is the targeted database instance on a different machine? The error message and the help for the linked function suggest that the input file paths must be local to the machine where the database instance runs. – mklement0 Sep 29 '22 at 12:19
  • 1
    Ah it is not.. That must be what it is. The file and database dont reside on the same server. I will run more test but I think this to be the answer. – Leo Torres Sep 29 '22 at 13:14

0 Answers0