79549218

Date: 2025-04-01 21:18:53
Score: 0.5
Natty:
Report link

Never found the reason for this, which is annoying as this is pretty much exactly the same as Example 9 at the man page for the command (https://docs.dbatools.io/Restore-DbaDatabase.html)

My workaround was to break the process up into two pieces - one command for the full backup restore and one for the log backup restores:

$File = Get-ChildItem -LiteralPath '\\it-sql-bckp-01\sql_backups$\Business\FULL_COPY_ONLY' | Where-Object {$_.CreationTime -gt (Get-Date).AddDays(-1)}
$File | Restore-DbaDatabase -SqlInstance Server2 -Database Business -NoRecovery -ReuseSourceFolderStructure

$File = Get-ChildItem -LiteralPath '\\it-sql-bckp-01\sql_backups$\Business\LOG' | Where-Object {$_.CreationTime -gt (Get-Date).AddDays(-1)}
$File | Restore-DbaDatabase -SqlInstance Server2 -Database Business -NoRecovery -ReuseSourceFolderStructure -Continue

Apparently, putting files from two different directories into $File at once doesn't work (again, even though that is what the dbatools example shows).

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user1967479