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