Phew that title is a mouthful. Sorry about that. But at least you know what I’m gonna talk about here. Nothing particularly profound, but obviously something every customer must do. I’ve been on a solid PowerShell kick as of late so why not put pen to paper here.

So whether you are using VVols or VMFS (or gross: RDMs) you need to do a bit of prep work to get things up and running. I will likely write a post on doing this with the vSphere Client Plugin, but for now let’s focus on doing it with PowerShell.

So step one is to install the PowerShell module that will help you. This is hosted on the PowerShell Gallery, so it is fairly simple to install:

If you already have it installed, don’t forget to pull the latest version:


Prep Work

Next step is to connect to your vCenter with PowerCLI (I am assuming you already have this installed, if not, run: Install-Module VMware.PowerCLI).

Then we need to connect to our FlashArray. We can use New-PfaConnection for this.

My new cluster looks like this:

On a FlashArray we want to create a “host” object for each ESXi server. A FlashArray host is a collection of initiators that represent a physical server. Furthermore, (as best practices dictate) we should create a “host group” that corresponds to the VMware cluster. All of the hosts for the servers in that cluster should be in the FlashArray host group.

As you can see on my FlashArray, I neither have a host group for the “Cupertino” cluster, nor hosts for esxi-11 or esxi-12.

The last thing is to store our cluster in an object. My cluster is “Cupertino”:

So let’s do it!

Create a New Host Group

There are a few relevant cmdlets for hosts and host groups. Let’s focus on the host group ones for now:

  • Get-PfaHostGroupFromVcCluster. This looks to see if a host group exists on a FlashArray for a given cluster.
  • New-PfaHostGroupFromVcCluster. This creates a new host group and its hosts for a given cluster.

Both of these take in two things, a cluster and a FlashArray connection. So first let’s verify that a host group does not exist:

Just as we thought. Not there. So let’s create it.

The New-PfaHostGroupFromVcCluster cmdlet takes in the same things as the other (cluster and FlashArray connection) but also one of two other options. -iSCSI or -FC. This indicates if we should configure the host and FlashArray for iSCSI or FC. In this environment it is iSCSI.

What this cmdlet does is the following:

  1. Iterates though each ESXi host in the cluster
  2. If iSCSI, it will check the host for a software iSCSI adapter. If it does not exist, it will create it. Then, it adds the FlashArray iSCSI targets to the ESXi host and sets our best practices (LoginTimeout to 30 seconds and disables DelayedAck). If any or all of this already done, it will silently skip that entire host or setting.
  3. If FibreChannel, nothing is done on the host.
  4. It then goes to the FlashArray and creates a FlashArray host using the network name of the ESXi host. Then it will add the identified initiators to the new host. For FC, it will add all WWNs. For iSCSI it will add the IQN of the software adapter. This cmdlet DOES NOT support hardware iSCSI. If the FlashArray version is Purity 5.0 or later, it will set the ESXi host personality. If the FlashArray host already exists, it will skip it this whole step.
  5. It will then repeat step 2-4 for each host.
  6. Lastly, it will create a new host group and put the new hosts into it. If one of the hosts somehow is in a different host group already, this will fail.
  7. It will then return the host group information.

Okay so the operation:

The host group is created and the hosts are added

The hosts have their initiators and the ESXi host personality is set:

Adding a Host

Okay so what if later I add a host? Well the simplest option is to rerun the above command:

I have a third host. So the above workflow will find a host is not configured/added and add it: