-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path1_HCI_Switchless_NetATC_Node_Config.ps1
More file actions
150 lines (128 loc) · 8.27 KB
/
1_HCI_Switchless_NetATC_Node_Config.ps1
File metadata and controls
150 lines (128 loc) · 8.27 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
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
#Configure Non-Converged Switchless with Network ATC
#Version v1.3
#Varables
$NodeName="AzHCI1"
#Managment Nics
$MgmtNic1 = "Integrated NIC 1 Port 1-1"
$MgmtNic2 = "Integrated NIC 1 Port 2-1"
$MgmtNicIp="192.168.4.125"
$MGMTNICGW="192.168.4.1"
$DNSIps="192.168.200.10,192.168.200.11"
$MgmtPrefixLength="24"
$Mgmtvlan=""
#Storage Nics
$S1Nic="SLOT 2 Port 1"
$S2Nic="SLOT 2 Port 2"
#Disabled DHCP on Mgmt ports
Set-NetIPInterface -InterfaceAlias $MgmtNic1,$MgmtNic12 -Dhcp Disabled
#Sets vLAN ID for Mgmt
IF($Mgmtvlan -ne ""){Set-NetAdapter -InterfaceAlias $MgmtNic1 -VlanId $Mgmtvlan -Confirm:$false}
#Configures IP addresses for the NICs
New-NetIPAddress -InterfaceAlias $MgmtNic1 -IPAddress $MgmtNicIp -PrefixLength $MgmtPrefixLength -DefaultGateway $MGMTNICGW -Confirm:$false
#Set DNS -comma delimit 2nd DNS Server
Set-DnsClientServerAddress -InterfaceAlias $MgmtNic1 -ServerAddresses $DNSIps -Confirm:$false
# Exclude iDRAC NIC from Cluster
$NDISDesc=(Get-NetAdapter | Where-Object{$_.InterfaceDescription -imatch "NDIS"}).InterfaceDescription
New-Item -Path HKLM:\system\currentcontrolset\services\clussvc\parameters -Force
New-ItemProperty -Path HKLM:\system\currentcontrolset\services\clussvc\parameters -Name ExcludeAdaptersByDescription -Value $NDISDesc -Force
#Enable Remote Desktop
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
#Rename node
IF(($env:COMPUTERNAME) -inotmatch $NodeName){Rename-Computer -NewName $NodeName -Confirm:$False}
#Install Roles
Install-WindowsFeature -Name Hyper-V, NetworkATC, FS-SMBBW, Failover-Clustering, Data-Center-Bridging, BitLocker, FS-FileServer, RSAT-Clustering-PowerShell -IncludeAllSubFeature -IncludeManagementTools -Confirm:$false
#Disable DCB on Intel Nics
Get-NetAdapter -InterfaceDescription *X710* | Disable-NetAdapterQos -Confirm:$false
#Set power profile to High Performance
powercfg /setactive SCHEME_MIN
#Max Rx and Tx queues should be max values
If((Get-NetAdapter $S1Nic,$S2Nic | Select InterfaceDescription) -imatch "QLogic"){
Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Receive Buffers*" -DisplayValue 35000 -Confirm:$false
Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Transmit Buffers*" -DisplayValue 5000 -Confirm:$false
}
If((Get-NetAdapter $S1Nic,$S2Nic | Select InterfaceDescription) -imatch 'Mellanox|NVIDIA'){
Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Receive Buffers*" -DisplayValue 4096 -Confirm:$false
Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Send Buffers*" -DisplayValue 2048 -Confirm:$false
}
If((Get-NetAdapter $S1Nic,$S2Nic | Select InterfaceDescription) -imatch "E810"){
Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Receive Buffers*" -DisplayValue 4096 -Confirm:$false
#Added to set Send or Transmit Buffer
IF(Get-NetAdapterAdvancedProperty $S1Nic,$S2Nic -DisplayName "Send Buffers*" -ErrorAction SilentlyContinue){
Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Send Buffers*" -DisplayValue 4096 -Confirm:$false}
else{Get-NetAdapter $S1Nic,$S2Nic | Set-NetAdapterAdvancedProperty -DisplayName "Transmit Buffers*" -DisplayValue 512 -Confirm:$false}
}
# Exclude iDRAC NIC from Cluster
$NDISDesc=(Get-NetAdapter | Where-Object{$_.InterfaceDescription -imatch "NDIS"}).InterfaceDescription
New-Item -Path HKLM:\system\currentcontrolset\services\clussvc\parameters -Force
New-ItemProperty -Path HKLM:\system\currentcontrolset\services\clussvc\parameters -Name ExcludeAdaptersByDescription -Value $NDISDesc -Force
#Set DcbxMode
If((Get-NetAdapter $S1Nic,$S2Nic | Select InterfaceDescription) -imatch 'Mellanox|NVIDIA'){
Set-NetAdapterAdvancedProperty -Name $S1Nic -DisplayName 'DcbxMode' -DisplayValue 'Host In Charge' -Confirm:$false
Set-NetAdapterAdvancedProperty -Name $S2Nic -DisplayName 'DcbxMode' -DisplayValue 'Host In Charge' -Confirm:$false
}
# Disable DCBX Willing mode
Set-NetQosDcbxSetting -Willing $false -Confirm:$false
# RDMA QOS setting for Mellanox
If((Get-NetAdapter $S1Nic,$S2Nic | Select InterfaceDescription) -imatch 'Mellanox|NVIDIA' -or ((Get-PhysicalDisk | Where-Object{$_.MediaType -imatch 'HDD'}).count -eq 0)){
# Enable IEEE Priority Tag on all network interfaces to ensure the vSwitch does not drop the VLAN tag information.
$nics = Get-VMNetworkAdapter -ManagementOS
ForEach ($nic in $nics) {
Set-VMNetworkAdapter -VMNetworkAdapter $nic -IeeePriorityTag ON -Confirm:$false
}
}
#Windows Defender exclusions for Hyper-V and Clustering
If ($env:SystemDrive+"\ProgramData\Microsoft\Windows\Hyper-V\Snapshots"){
Add-MpPreference -ExclusionPath $env:SystemDrive+"\ProgramData\Microsoft\Windows\Hyper-V\Snapshots"}
Add-MpPreference -ExclusionPath (Get-VMHost).VirtualHardDiskPath
Add-MpPreference -ExclusionPath (Get-VMHost).VirtualMachinePath
Add-MpPreference -ExclusionProcess "vmms.exe"
Add-MpPreference -ExclusionProcess "vmwp.exe"
Add-MpPreference -ExclusionProcess "vmsp.exe" #Removed OS check
Add-MpPreference -ExclusionProcess "Vmcompute.exe" #Removed OS check
Add-MpPreference -ExclusionProcess "clussvc.exe" #Added new for Clustering
Add-MpPreference -ExclusionProcess "rhs.exe" #Added new for Clustering
Add-MpPreference -ExclusionProcess "vmwp.exe"
Add-MpPreference -ExclusionExtension ".vhd"
Add-MpPreference -ExclusionExtension ".vhdx"
Add-MpPreference -ExclusionExtension ".avhd"
Add-MpPreference -ExclusionExtension ".avhdx"
Add-MpPreference -ExclusionExtension ".vhds"
Add-MpPreference -ExclusionExtension ".vhdpmem"
Add-MpPreference -ExclusionExtension ".iso"
Add-MpPreference -ExclusionExtension ".rct"
Add-MpPreference -ExclusionExtension ".mrt" #added
Add-MpPreference -ExclusionExtension ".vsv"
Add-MpPreference -ExclusionExtension ".bin"
Add-MpPreference -ExclusionExtension ".xml" #added
Add-MpPreference -ExclusionExtension ".vmcx"
Add-MpPreference -ExclusionExtension ".vmrs"
Add-MpPreference -ExclusionExtension ".vmgs" #added
Add-MpPreference -ExclusionPath "C:\ClusterStorage"
Add-MpPreference -ExclusionPath "C:\Users\cliusr\Local Settings\Temp" #Added new for Clustering
#Set Spaces Port hardware timeout
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\spacePort\Parameters -Name HwTimeout -Value 0x00002710 -Verbose -Confirm:$false
#Set Spectre Variant 2 to fix Live Migrations for
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management' -Name FeatureSettingsOverride -Value 0 -Verbose -Confirm:$false
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management' -Name FeatureSettingsOverrideMask -Value 3 -Verbose -Confirm:$false
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization' -Name MinVmVersionForCpuBasedMitigations -Value '1.0' -Confirm:$false
#Update Pagefile settings for memory dump
#$blockCacheMB = (Get-Cluster).BlockCacheSize
$blockCacheMB = 1024
$pageFilePath = "C:\pagefile.sys"
$initialSize = [Math]::Round(51200 + $blockCacheMB)
$maximumSize = [Math]::Round(51200 + $blockCacheMB)
$system = Get-WmiObject -Class Win32_ComputerSystem -EnableAllPrivileges
if ($system.AutomaticManagedPagefile) {
$system.AutomaticManagedPagefile = $false
$system.Put()
}
$currentPageFile = Get-WmiObject -Class Win32_PageFileSetting
If($currentPageFile.Name){
$currentPageFile.Name=$pageFilePath
$currentPageFile.InitialSize = $InitialSize
$currentPageFile.MaximumSize = $MaximumSize
$currentPageFile.Put()
}Else{
Write-Host "Failed to set pagefile. Please set manually. sysdm.cpl" -ForegroundColor Red
}