I started some of this with PowerCLI 6.x and have recently only used it with PowerCLI 10.x vSphere 6.5 Update 1 (July 2017) is the earliest build I've validated it on lately - Your Mileage May Vary on older builds. Have used it extensively on vSphere 6.7 lately. A VCSA already stood up in...
deploy2node-sample.ps1
This script forces reads to occur across both hosts in a 2 Node vSAN configuration
Vsan-2NForcedCache.ps1
Module for vSAN Stretched Cluster & 2 Node I took some of my existing scripts and combined them into a module Setup requires the psd1/psm1 files to be put in a VSANSC2N directory under Powershell Modules or you can use Import-Module and the path to these. Tested on PowerCLI 6.5.4 against vSphere 6.5/vSAN 6.6 Not supported by VMware, use at your own risk. Functions for 2 Node vSAN Get-Vsan2NodeForcedCache – Determine state of DOMOwnerForceWarmCache of a cluster Set-Vsan2NodeForcedCache – Set DOMOwnerForceWarmCache for a cluster, good for Hybrid 2 Node Functions for the vSAN Witness Deployment Set-VsanStretchedClusterWitness – Set the vSAN Witness Appliance for a Stretched Cluster New-VsanStretchedClusterWitness – Deploy a new vSAN Witness Appliance Set-VsanWitnessNetwork – Set either vmk0 or vmk1 for a vSAN Witness Appliance Set-VsanWitnessNetworkRoute – Set a static route for a vSAN Witness Appliance Get-VsanWitnessNetworkRoute – Get a list of any static routes Remove-VsanWitnessNetworkRoute – Remove a static route Set-VsanWitnessNtp – Set NTP on a vSAN Witness Appliance Add-VsanWitnessHost – Add a vSAN Witness Host to vCenter Get-VsanWitnessVMkernel – Get the current VMkernel that is tagged for vSAN Traffic (alert if 0 or >2) Set-VsanWitnessVMkernel – Set a VMkernel for vSAN Traffic – Only 1 and remove any extras Functions for vSAN Hosts Get-VsanHostVMkernelTrafficType – Get a list of traffic types for all hosts in a cluster Set-VsanHostWitnessTraffic – Set Witness traffic for hosts in a 2 Node cluster Function for Stretched Clusters & 2 Node vSAN Set-VsanStretchedClusterDrsRules – Place VM’s on either site based on a VM tag Set-VsanStretchedClusterPreferredFaultDomain - Set or Toggle the Current Preferred Fault Domain #vSAN #Deploy #PowerShell #2Node #vSphere #Automation #Apache2.0 #StretchedCluster #VMwarePowerCLI #Witness
Modules-master.zip
2 Comments - Dillards, a 2 Node vSAN Cluster is a 1+1+1 vSAN Stretched Cluster, therefore the commands used for a Stretched Cluster are the same as those for a 2 Node vSAN Cluster
This script includes a function that reports the vSAN Witness information for a 2 Node or Stretched vSAN Cluster
Get-RvcVsanClusterWitnessInfo.ps1
This script removes a vSAN Witness Host for 2 Node and Stretched Cluster vSAN & replaces it
Vsan-WitnessReplace.ps1
Information included is: Host configurations vSAN Witness Host configuration (if Stretched Cluster or 2 Node) Fault Domain information (if they exist) Preferred Fault Domain (if Stretched Cluster or 2Node) Only missing Deduplication & Compression reporting
Get-RvcVsanClusterInfo.ps1
This script will invoke the process to repair any vSAN Objects that need to be repaired. This is typically used when the 60 minute (default) Repair Timer has not expired, but an administrator would like to invoke a repair immediately operation. RVC: PowerCLI: ...
Start-RvcVsanClusterRepairImmediately.ps1
It will: Configure networking Add the vSAN Witness to vCenter Allows either Management (vmk0) or vmk1 to have vSAN Traffic tagged (not both) (v2/v3) Sets static routes (if they are set) and vmk1 is used Makes the vSAN Witness Host available for use in a vSAN Stretched or 2 Node Cluster v2 changed the DNS lookup method and will now run on PowerCLI Core as well as PowerCLI Desktop v3 added support for the vSAN 6.7 P01 Witness Appliance and adds ping check to ensure the vSAN Witness is up before attempting to add it to vCenter
Vsan-WitnessDeploy.ps1
This is the first of many RVC Style Functions that use PowerCLI 11 to mimic some of the tasks available in the Ruby vSphere Console for vSAN Requires William Lam's VSANUUIDtoVM Function, located here: https://github.com/lamw/vghetto-scripts/blob/master/powershell/VSANUUIDTranslate.ps1 ...
RVC-PowerCLI.psm1.gz
This file includes sample code to configure a vSAN cluster as a Stretched Cluster or 2 Node configuration
stretchedCluster.py