PowerCLI: Create New VM Port Groups in a Cluster

Hello again, everyone! Recently, I’ve been working on a script that will create new VM Port Groups on a virtual standard switch (vSS) in a given cluster. While this could probably be alleviated by using a virtual distributed switch (vDS), let’s assume that you have a need to stick with vSS for whatever reason (licensing, company standards, etc.).

In this script, it validates that the VLAN number is in fact a whole number within the range of 1 through 4905. At the end of the script, it asks if you’d like to add another port group to the same cluster or not. I found this to be very handy if you’re standing up a new cluster that only contained vSS, or simply adding more port groups to an existing cluster. Continue reading “PowerCLI: Create New VM Port Groups in a Cluster”

Advertisements

PowerCLI: Get or Set VAAI Settings for VMware Hosts

During a recent technical engagement with a vendor, my team was asked to verify that VAAI was disabled for all hosts attached to that vCenter. There are several different ways to go about doing this, so I figured I would put this blog post together to showcase some of the different ways in which this can be accomplished. There are three settings that need to be reviewed (or changed). They are: DataMover.HardwareAcceleratedMove, DataMover.HardwareAcceleratedInit, and VMFS3.HardwareAcceleratedLocking. A value of 1 means the setting is enabled, and a value of 0 means the setting is disabled.
Continue reading “PowerCLI: Get or Set VAAI Settings for VMware Hosts”

PowerCLI: Find a VM Based on RDM’s LUN ID

Let’s say you have a LUN ID that you clearly know is a RDM. How do you determine what virtual machine is associated with that disk?

Recently, I was prepping a cluster for routine ESXi patching. As part of my preparation, I scanned the cluster for RDM disks first to ensure that they were set to Perennially Reserved = True. After doing the RDM scan, I found a cluster that had a single RDM disk, but didn’t know which VM it was associated with. Although VMware has a Knowledge Base article (KB2001823) on how to do find RDM’s and which VM’s they’re associated with, it looks like it will find all RDM’s and VM’s across the entire vCenter Server. Since I know the cluster, and I know the RDM LUN ID, I wanted to narrow down the results for my particular needs.
Continue reading “PowerCLI: Find a VM Based on RDM’s LUN ID”