Skip to content

Instantly share code, notes, and snippets.

@Stuart-Moore
Created November 24, 2017 11:15
Show Gist options
  • Save Stuart-Moore/39ac060bd7904c900eac9575d03f0008 to your computer and use it in GitHub Desktop.
Save Stuart-Moore/39ac060bd7904c900eac9575d03f0008 to your computer and use it in GitHub Desktop.
Create multiple environments
$BackupInformation = Get-DbaBackupInformation -sqlinstance localhost\sqlexpress2016 -Path C:\dbatools\RestoreTimeDiffDemo
$Environments = @('Dev','Test','Stage')
ForEach ($Environment in $Environments){
$BackupInformation | Restore-DbaDatabase -sqlinstance localhost\sqlexpress2016 -DestinationFilePrefix $Environment -RestoredDatababaseNamePrefix ("$($Environment)_") -TrustDbBackupHistory
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment