-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc3_remove.ps1
More file actions
36 lines (30 loc) · 1.04 KB
/
Copy pathc3_remove.ps1
File metadata and controls
36 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[CmdletBinding()]
param (
[string]$ClusterName = 'CLUSTER01',
[string[]]$ClusterNodes = @('SQL01', 'SQL02'),
[string]$SqlNetworkName = 'FCI02',
[string]$SqlInstance = 'SQL2022',
[string]$SqlIP = '192.168.3.72',
[string]$SqlIPSubnet = '255.255.255.0',
[string]$SqlVersion = 2022
)
$installCredential = [PSCredential]::new("ORDIX\Admin", (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force))
$paramsRemoveNode = @{
InstanceName = $SqlInstance
Version = $SqlVersion
Configuration = @{ ACTION = 'RemoveNode' }
Path = '\\fs\Software\SQLServer\ISO'
Restart = $true
Credential = $installCredential
Confirm = $false
}
$result = Install-DbaInstance @paramsRemoveNode -ComputerName $clusterNodes[0]
$result | Format-Table
if (-not $result.Successful) {
throw "Failed to uninstall SQL Server"
}
$result = Install-DbaInstance @paramsRemoveNode -ComputerName $clusterNodes[1]
$result | Format-Table
if (-not $result.Successful) {
throw "Failed to uninstall SQL Server"
}