Skip to content

Instantly share code, notes, and snippets.

Last active November 24, 2017 07:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
$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 = []$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