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”

Advertisements

List RDM Disks in a Cluster Using PowerCLI

Hello everyone! Earlier today, I was looking for a way to list the RDM disks that are currently attached and in use by VMs within a specific cluster. See, we’re in the process of decommissioning an old SAN array, and I needed to verify that specific LUNs and RDMs were no longer in use. I came across this post over on the VMware Communities portal, but needed made a minor tweak, as I only wanted to search a specific cluster. By the way… HUGE thanks to user LucD for posting the original script! After running this script, I was then able to search the output to ensure that the LUN WWNs I needed to decommission weren’t in the list.

$report = @()
$vms = Get-Cluster -name "Cluster01" | Get-VM | Get-View
foreach($vm in $vms){
     foreach($dev in $vm.Config.Hardware.Device){
          if(($dev.gettype()).Name -eq "VirtualDisk"){
               if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or 
               ($dev.Backing.CompatibilityMode -eq "virtualMode")){
                    $row = "" | select VMName, VMHost, HDDeviceName, HDFileName, HDMode, HDsize, HDDisplayName
                    $row.VMName = $vm.Name
                    $esx = Get-View $vm.Runtime.Host
                    $row.VMHost = ($esx).Name
                    $row.HDDeviceName = $dev.Backing.DeviceName
                    $row.HDFileName = $dev.Backing.FileName
                    $row.HDMode = $dev.Backing.CompatibilityMode
                    $row.HDSize = $dev.CapacityInKB
                    $row.HDDisplayName = ($esx.Config.StorageDevice.ScsiLun | where {$_.Uuid -eq $dev.Backing.LunUuid}).DisplayName
                    $report += $row
               }
          }
     }
}
$report