March 2, 2024

Sample 2 Node vSAN Deployment Script

A couple months back, I published a YouTube video of my deploying/setting up a 2 Node vSAN cluster with nothing but PowerCLI.

It got a few views and several people internally at VMware asked for the source code. Well, this has been a long time coming, with my working on it on/off for a while, with the vast majority of the coding done on weekends.

The foundation
I wanted to keep it simple/modular, so I put together a PowerCLI module. That way choices could be made like:

  • Will the data nodes be using vmk0 for Witness Traffic Separation? Or will a new VMkernel need to be  created and tagged for vSAN Witness Traffic?
  • Will I need to create a VDS? Enable NIOC? Assign vSAN recommended NIOC settings?
  • I’ll need to create disk groups. How many cache devices are there?
  • and so on.

That is where a good bit of the work/effort went into it. It isn’t as complete as I’d like, doesn’t have nearly the amount of error checking I’d like, but it has been live and published on my GitHub page, and shared on here:

Most of the functions are mine, but I did have to employ some code from William Lam that addresses passing commands to a VM’s tools to execute tasks inside the VM. As the vSAN Witness Appliance is deployed today, only the root account password is asked for, and it does not use the standard OVF properties as the vast majority of VMware virtual appliances do. I’ve been working internally for some time to get this corrected, but until then, my function can handle setting up the networking/vSAN Tagging/etc.

There are still a few things I’d like to add to it, and it isn’t complete, but it is far along enough to get anyone who wants to hack PowerCLI code a bit more to take it to the next level.

Putting it all together
This is where the PowerCLI module makes all the difference. By using functions my sample could be called by a much larger script to deploy multiple 2 Node clusters across a very large enterprise or even just a few sites when used for ROBO type deployments. Remember, vSAN 2 Node is NOT vSAN ROBO. vSAN ROBO is a LICENSE, 2 Node is an architecture.

Without going deep into the content of the script, suffice to say, I’ve taken much of the guesswork out of it, and the only requirements are to update variables.


  • 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 a Central Datacenter/Alternate Cluster running a higher version of the VCSA than the ESXi builds. Don’t deploy a VCSA 6.5 GA and expect it to work properly with 6.5 U1 Hosts.
  • A Cluster (can contain a single host) that you can deploy the vSAN Witness Appliance to
  • 2 Hosts with vSphere 6.5U1 or higher installed and one or more 10Gb NICs connected directly to the  alternate host. My VDS setup looks for NICs >1Gbps and assumes they are Directly Connected to the alternate host.
  • vSAN Witness Appliance OVA that is the same build as the already deployed ESXi hosts. I may had build checking at some point, but not today, as VUM cmdlets aren’t available (that I know of) when using PowerCLI on my Mac.

Bear with me, as this is a work in progress…

You can find the script here:

2 thoughts on “Sample 2 Node vSAN Deployment Script

  1. Jase,

    Thanks for knocking out all the framework, and honestly most of the fleshing out, of this script. This is going to be a tremendous time saver for the numerous 2nodes I have going production this year, as well as keeping them standardized.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.