forked from nickrod518/PowerShell-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMigrate-SQLBackup.ps1
More file actions
24 lines (20 loc) · 964 Bytes
/
Copy pathMigrate-SQLBackup.ps1
File metadata and controls
24 lines (20 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$OldSQL = Read-Host 'Current SQL server'
$NewSQL = Read-Host 'New SQL server'
$DB = Read-Host 'Name of Database'
# Prompt the user whether they want to merge the database
Function Prompt {
CLS
$Title = "Database Backup Migration`n`n`tOLD SQL SERVER`t:`t$OldSQL`n`tNEW SQL SERVER`t:`t$NewSQL`n`tDATABASE`t:`t$DB"
$Message = "`nDo you want to merge database?"
$Yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Perform a database merge on $DB, moving it from $OldSQL to $NewSQL."
$No = New-Object System.Management.Automation.Host.ChoiceDescription "&No", 'Exit this utility.'
$Options = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No)
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, 0)
CLS
switch ($Result) {
0 {'Merging...'; Start-Sleep -Seconds 1; Break}
1 {'Exiting...'; Start-Sleep -Seconds 1; Exit}
}
Prompt
}
Prompt