Skip to content

Instantly share code, notes, and snippets.

@spy86
Created Aug 3, 2017
Embed
What would you like to do?
PS drop database & close connection
$dbnamefile1 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname1 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile2 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname2 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile3 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname3 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile4 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname4 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile5 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname5 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile6 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname6 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile7 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname7 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
$dbnamefile8 = Get-ChildItem %RestorePath% | Where Name -Match ("DB-Name")
$dbname8 = "DB-Name"
Restore-SqlDatabase -ServerInstance %SQLSERVER% -Database $dbname1 -BackupFile "%RestorePath%\$dbnamefile1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment