Skip to content

Instantly share code, notes, and snippets.

@Stuart-Moore
Created November 24, 2017 11:15
  • 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
Embed
What would you like to do?
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