PowerShell Guide: S2D Node – Kepler-47 Series

Updated: 2018-07-28 @ 0836Hrs MST.

The following is the PowerShell and sometimes Command based steps we use to set up our Kepler-47 cluster nodes.

Note that some steps are optional depending on the environment the node is going in to.

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
2018-01-30: First created by Philip Elder.
# Set the Console Title
$host.UI.RawUI.WindowTitle = "Kepler-47B Node 1 Setup Shell"
$host.UI.RawUI.WindowTitle = "Kepler-47B Node 2 Setup Shell"

# Variables - These need to be copy and pasted in after a reboot!
$Kepler47BNode1 = "Kepler-47B-01"
$Kepler47BNode2 = "Kepler-47B-02"
$S2DClusterName = "2018-05-01 Kepler-47B S2D"
$DomainName = "DOMAIN.COM"
$DomainAdminName = "DOMAIN\Admin"
$OUPath = "OU=2018-02-08 Kepler-47A Cluster,OU=S2D-Clusters,OU=Main-Office,DC=DC=DOMAIN,DC=Com"

# BIOS REV:

gwmi win32_ComputerSystem | Select Manufacturer,Model
Get-WmiObject win32_bios

# BIOS Name Settings
Import the .Reg

# SERVER NAME

Rename-Computer -NewName $Kepler47BNode1 -Restart
Rename-Computer -NewName $Kepler47BNode2 -Restart

# Check Server Name

HostName

# JOIN DOMAIN

Add-Computer -Domain $DomainName -Credential $DomainAdminName -OUPath $OUPath -Restart

# DRIVERS - Need Intel and Mellanox at the minimum

gwmi Win32_SystemDriver | select name,@{n="version";e={(gi $_.pathname).VersionInfo.FileVersion}}
gwmi Win32_PnPSignedDriver | select devicename,driverversion

Get-WmiObject Win32_PNPEntity | Where Status -ne "OK" | Select Name,Status
Get-WmiObject Win32_PNPEntity | Where Status -ne "OK" | FL

# POWER OPTION - Set MAX

POWERCFG.EXE /S SCHEME_MIN

# Configure Active memory dump
Set-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\CrashControl –Name CrashDumpEnabled –value 1
Set-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\CrashControl –Name FilterPages –value 1

# Check Active Memory Dump
Get-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\CrashControl –Name CrashDumpEnabled
Get-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\CrashControl –Name FilterPages

# Set it back to Automatic memory dump (default)
Set-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\CrashControl –Name CrashDumpEnabled –value 7
Remove-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\CrashControl –Name FilterPages –value 1

# INSTALL WINDOWS FEATURES

Install-WindowsFeature Hyper-V,Data-Center-Bridging,Failover-Clustering,RSAT-Clustering-Powershell,Hyper-V-PowerShell,Storage-Replica -IncludeAllSubFeature -IncludeManagementTools -Source D:\Sources\SXS -Restart

# Without Storage Replica
Install-WindowsFeature Hyper-V,Data-Center-Bridging,Failover-Clustering,RSAT-Clustering-Powershell,Hyper-V-PowerShell -IncludeAllSubFeature -IncludeManagementTools -Source D:\Sources\SXS -Restart

# Verify Features
Get-WindowsFeature | where {$_.installed -eq $true} | select DisplayName, Name, Installed

# ENABLE Enhanced Session Mode
Set-VMhost -EnableEnhancedSessionMode $TRUE

# NETWORKING

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

# NETWORKING SETUP - ADAPTER NAME

Get-NetAdapter | Sort MacAddress | Select Name,InterfaceDescription,MacAddress,LinkSpeed
Get-NetAdapter | Sort MacAddress | Select Name,InterfaceDescription,MacAddress

Get-NetAdapter |? Name -NotLike vEthernet* |? InterfaceDescription -Like Intel*tion | Rename-NetAdapter -NewName SvSwith-01
Get-NetAdapter |? Name -NotLike vEthernet* |? InterfaceDescription -Like Intel*LM | Rename-NetAdapter -NewName SvSwith-02

# NODE 1 and 2
Get-Netadapter |? Name -Like Ethernet* |? InterfaceDescription -like Mellanox*#2 | Rename-NetAdapter -NewName EW-LM-101
Get-Netadapter |? Name -Like Ethernet* |? InterfaceDescription -like Mellanox*Adapter | Rename-NetAdapter -NewName EW-LM-102

# NODE 2 if the above is reversed
Get-Netadapter |? Name -Like Ethernet* |? InterfaceDescription -like Mellanox*Adapter | Rename-NetAdapter -NewName EW-LM-101
Get-Netadapter |? Name -Like Ethernet* |? InterfaceDescription -like Mellanox*#2 | Rename-NetAdapter -NewName EW-LM-102

# NETWORKING SETUP - VLAN

Set-NetAdapter -Name EW-LM-101 -VlanID 101 -Confirm:$False
Set-NetAdapter -Name EW-LM-102 -VlanID 102 -Confirm:$False

Get-NetAdapterAdvancedProperty |? DisplayName -Like VLAN* | Select Name,DisplayName,DisplayValue

# NETWORKING SETUP - JUMBO FRAMES

Get-NetAdapterAdvancedProperty -Name EW-LM* -RegistryKeyword "*jumbopacket" | Set-NetAdapterAdvancedProperty -RegistryValue 9014

Get-NetAdapterAdvancedProperty -Name * -RegistryKeyword "*jumbopacket" | Sort Name

# RDMA

Get-NetAdapter *EW-LM* | Enable-NetAdapterRDMA
Get-NetAdapterRDMA

# TEAMING and IP ADDRESS ASSIGNMENT

Set-DNSClient -InterfaceAlias EW* -RegisterThisConnectionsAddress $False

New-NetLbfoTeam -Name SvSwitch -TeamMembers SVS* -Confirm:$False
New-VMSwitch -Name vSwitch -NetAdapterName SvSwitch -AllowManagementOS 1

New-NetIPAddress -InterfaceAlias "vEthernet (Management-0)" -IPAddress 10.10.0.5 -PrefixLength 24 -Type Unicast | Out-Null
Set-DnsClientServerAddress -InterfaceAlias "vEthernet (Management-0)" -ServerAddresses 10.10.0.20 | Out-Null

New-NetIPAddress -InterfaceAlias "vEthernet (Cluster-100)" -IPAddress 10.10.100.5 -PrefixLength 24 -Type Unicast | Out-Null

# NODE 1 East-West and Live Migration Subnets
New-NetIPAddress -InterfaceAlias "EW-LM-101" -IPAddress 10.101.100.10 -PrefixLength 24 -Type Unicast | Out-Null
New-NetIPAddress -InterfaceAlias "EW-LM-102" -IPAddress 10.102.100.10 -PrefixLength 24 -Type Unicast | Out-Null

# NODE 2 East-West and Live Migration Subnets
New-NetIPAddress -InterfaceAlias "EW-LM-101" -IPAddress 10.101.100.20 -PrefixLength 24 -Type Unicast | Out-Null
New-NetIPAddress -InterfaceAlias "EW-LM-102" -IPAddress 10.102.100.20 -PrefixLength 24 -Type Unicast | Out-Null

# REMOVE If Necessary
Remove-NetIPAddress -InterfaceAlias "EW-LM-101" -IPAddress 10.101.100.100 -PrefixLength 24 -Type Unicast -Confirm:$False | Out-Null
Remove-NetIPAddress -InterfaceAlias "EW-LM-102" -IPAddress 10.102.100.100 -PrefixLength 24 -Type Unicast -Confirm:$False | Out-Null

Get-NetIPAddress |? AddressFamily -Like IPv4 |? InterfaceAlias -NotLike "lo*" | FT IPAddress,InterfaceAlias

Get-NetIPAddress |? AddressFamily -Like IPv4 | FT IPAddress,InterfaceAlias

# TEST Jumbo Frames
# NODE1
ping 10.101.100.20 -l 9014
ping 10.102.100.20 -l 9014

# NODE2
ping 10.101.100.10 -l 9014
ping 10.102.100.10 -l 9014

# TEST and CLUSTER

Test-Cluster $Kepler47BNode1,$Kepler47BNode2 -Include "Storage Spaces Direct",Inventory,Network,"System Configuration"

Test-Cluster $Kepler47BNode1,$Kepler47BNode2 -Include "Storage Spaces Direct",Inventory,Network,"System Configuration"

New-Cluster 180315-S2DCL -Node $Kepler47BNode1,$Kepler47BNode2 -NoStorage

# Disable NETBIOS

Get-ClusterResource “Cluster IP address” -Cluster 180315-S2DCL | Set-ClusterParameter EnableNetBIOS 0

# NetBIOS over TCP/IP controls for vNics

Get Code:

$vNic = Get-NetAdapter -CimSession $wc -name "vEthernet (Storage1)","vEthernet (Storage2)","vEthernet (Mgmt)"
$wmiNicList = $vNic | % { $thisnic = $_; Get-WmiObject -class win32_networkadapterconfiguration -ComputerName $thisNic.pscomputerName | where {$_.Description -eq $thisnic.InterfaceDescription} }
$wmiNicList | sort PsComputerName, Description | select PSComputerName, Description, tcpIpNetbiosoptions

# CLEAN NODE DISKS ****DANGER DESTRUCTIVE****
# Used when we have had a Storage Spaces Direct cluster set up previously

icm (Get-Cluster -Name $S2DClusterName | Get-ClusterNode) {
Update-StorageProviderCache
Get-StoragePool |? IsPrimordial -eq $false | Set-StoragePool -IsReadOnly:$false -ErrorAction SilentlyContinue
Get-StoragePool |? IsPrimordial -eq $false | Get-VirtualDisk | Remove-VirtualDisk -Confirm:$false -ErrorAction SilentlyContinue
Get-PhysicalDisk | Reset-PhysicalDisk -ErrorAction SilentlyContinue
Get-Disk |? Number -ne $null |? IsBoot -ne $true |? IsSystem -ne $true |? PartitionStyle -ne RAW |% {
$_ | Set-Disk -isoffline:$false
$_ | Set-Disk -isreadonly:$false
$_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false
$_ | Set-Disk -isreadonly:$true
$_ | Set-Disk -isoffline:$true
}
Get-Disk |? Number -ne $null |? IsBoot -ne $true |? IsSystem -ne $true |? PartitionStyle -eq RAW | Group -NoElement -Property FriendlyName
} | Sort -Property PsComputerName,Count

# CHECK DISKS
Get-PhysicalDisk | FT FriendlyName,CanPool,MediaType

Set-PhysicalDisk –FriendlyName "WDC WD2002FAEX-007BA0" –MediaType HDD

# Cluster Quorum - Azure CW

Set-ClusterQuorum -CloudWitness -AccountName AzureCloudWitnessAA01 -AccessKey 00gaB00ga

# CLUSTER NETWORK

# NODE1
Get-ClusterNetwork

(Get-ClusterNetwork -Name "Cluster Network 1").Name="EW-LM-102"
(Get-ClusterNetwork -Name "Cluster Network 2").Name="EW-LM-101"
(Get-ClusterNetwork -Name "Cluster Network 3").Name="SvSwitch"

(Get-ClusterNetwork | where-object {$_.Address -eq "10.101.100.10"}).Name = "EW-LM-101"
(Get-ClusterNetwork | where-object {$_.Address -eq "10.102.100.10"}).Name = "EW-LM-102"

# NODE FAIRNESS

(Get-Cluster).AutoBalancerMode = 2
(Get-Cluster).AutoBalancerLevel = 2

# Stand up the S2D CLUSTER with several variations

Enable-ClusterS2D -Confirm:$False

Enable-ClusterS2D -PoolFriendlyName 'S2D' -CollectPerformanceHistory $True

Enable-ClusterStorageSpacesDirect

# STORAGE POOL CSV SETUP FOR PRODUCTION

New-Volume -StoragePoolFriendlyName "S2D*" -FriendlyName "CSV-01-Guest-OS" -FileSystem CSVFS_ReFS -Size 900GB
Rename-Item -Path C:\ClusterStorage\volume1\ -NewName "CSV-01-Guest-OS"

New-Volume -StoragePoolFriendlyName "S2D*" -FriendlyName "CSV-02-Guest-OS" -FileSystem CSVFS_ReFS -Size 900GB
Rename-Item -Path C:\ClusterStorage\volume1\ -NewName "CSV-02-Guest-OS"

New-Volume -StoragePoolFriendlyName "S2D*" -FriendlyName "CSV-03-Guest-Data" -FileSystem CSVFS_ReFS -Size 5TB
Rename-Item -Path C:\ClusterStorage\volume1\ -NewName "CSV-03-Guest-Data"

New-Volume -StoragePoolFriendlyName "S2D*" -FriendlyName "CSV-04-Guest-Data" -FileSystem CSVFS_ReFS -Size 5TB
Rename-Item -Path C:\ClusterStorage\volume1\ -NewName "CSV-04-Guest-Data"

# Set VM Configuration paths

Set-VMHOST –computername $Kepler47BNode1 –virtualharddiskpath 'C:\ClusterStorage\CSV-01-Guest-OS'
Set-VMHOST –computername $Kepler47BNode1 –virtualmachinepath 'C:\ClusterStorage\CSV-03-Guest-Data'
Set-VMHOST –computername $Kepler47BNode2 –virtualharddiskpath 'C:\ClusterStorage\CSV-02-Guest-OS'
Set-VMHOST –computername $Kepler47BNode2 –virtualmachinepath 'C:\ClusterStorage\CSV-04-Guest-Data'

# KCD Constrained Delegation

$Domain = "DOMAIN.COM"
$HyvHost = "$Kepler47BNode1"
Get-ADComputer $Kepler47BNode2 | Set-ADObject -Add @{"msDS-AllowedToDelegateTo"="Microsoft Virtual System Migration Service/$HyvHost.$Domain", "cifs/$HyvHost.$Domain","Microsoft Virtual System Migration Service/$HyvHost", "cifs/$HyvHost"}
Get-ADComputer S2D-DC01 | Set-ADObject -Add @{"msDS-AllowedToDelegateTo"="Microsoft Virtual System Migration Service/$HyvHost.$Domain", "cifs/$HyvHost.$Domain","Microsoft Virtual System Migration Service/$HyvHost", "cifs/$HyvHost"}
Get-ADComputer S2D-DC02 | Set-ADObject -Add @{"msDS-AllowedToDelegateTo"="Microsoft Virtual System Migration Service/$HyvHost.$Domain", "cifs/$HyvHost.$Domain","Microsoft Virtual System Migration Service/$HyvHost", "cifs/$HyvHost"}
$HyvHost = "$Kepler47BNode2"
Get-ADComputer $Kepler47BNode1 | Set-ADObject -Add @{"msDS-AllowedToDelegateTo"="Microsoft Virtual System Migration Service/$HyvHost.$Domain", "cifs/$HyvHost.$Domain","Microsoft Virtual System Migration Service/$HyvHost", "cifs/$HyvHost"}
Get-ADComputer S2D-DC01 | Set-ADObject -Add @{"msDS-AllowedToDelegateTo"="Microsoft Virtual System Migration Service/$HyvHost.$Domain", "cifs/$HyvHost.$Domain","Microsoft Virtual System Migration Service/$HyvHost", "cifs/$HyvHost"}
Get-ADComputer S2D-DC02 | Set-ADObject -Add @{"msDS-AllowedToDelegateTo"="Microsoft Virtual System Migration Service/$HyvHost.$Domain", "cifs/$HyvHost.$Domain","Microsoft Virtual System Migration Service/$HyvHost", "cifs/$HyvHost"}

# LIVE MIGRATION SETUP

Enable-VMMigration –Computername $Kepler47BNode1, $Kepler47BNode2
Set-VMHost -MaximumVirtualMachineMigrations 4 `
–MaximumStorageMigrations 4 `
–VirtualMachineMigrationPerformanceOption SMB `
-ComputerName $Kepler47BNode1,$Kepler47BNode2

Set-VMHost –Computername $Kepler47BNode1, $Kepler47BNode2 `
–VirtualMachineMigrationAuthenticationType Kerberos

Get-ClusterResource | Get-ClusterParameter