-
-
Save Stuart-Moore/9a6bec3aa2710d719d58f2224491911a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Backups = Get-DbaBackupInformation -sqlinstance localhost\sqlexpress2016 -Path C:\dbatools\RestoreTimeClean | |
$Backups += Get-DbaBackupInformation -sqlinstance localhost\sqlexpress2016 -Path C:\dbatools\RestoreTimeDiffStripe | |
$BackupSelection = $Backups | Select-DbaBackupInformation | |
$BackupSelection | Format-DbaBackupInformation | |
$basedir = "C:\some\path\of\yourchoosing\" | |
$BackupSelection | Foreach-Object { | |
ForEach ($file in $_.FileList){ | |
$t = [system.io.FileInfo]$File.PhysicalName | |
$type = switch($file.Type){'D'{'Data'} 'L'{'Log'}} | |
$File.PhysicalName = [io.path]::combine($basedir,$_.Database+"_"+$type,$t.Name) | |
} | |
} | |
$BackupSelection | Test-DbaBackupInformation -SqlInstance localhost\developer2016 | |
$BackupSelection | Invoke-DbaAdvancedRestore -sqlinstance localhost\developer2016 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment