I wrote a post recently on the updates made to the PowerCLI 6.3 R1 esxcli implementation, so the logical next step was to implement this new behavior into my PowerCLI scripts that use esxcli. I still have a few scripts to update, but my two best practice-related scripts are ready to go. The two scripts are:
- Script to check and set best practices. Download here:
- Script to just check best practices, and lists issues in a report. Download here.
While I was updating them for esxcli changes, I figured i might as well improve them too, so there are quite a few changes for both. Let’s take a look.
Comments on both scripts:
Both scripts are interactive. They ask for the following information:
Log location (this is a pop-up)
vCenter IP/FQDN (this is entered via text)
vCenter credentials (a pop-up)
The script then logs information to a log file that you specified and that location is printed to the screen.
Both scripts will attempted to install PowerCLI through the PowerShell gallery if it is not installed, and if it is, it will make sure it is loaded.
Make sure you are at least running PowerCLI 6.3 or later. The script will terminate if it is not at that release.
Best Practices Set Script
The “set” script checks for and fixes the following things:
- Disk.DiskMaxIO size. This is optional and only needs to be changed if you are using vSphere Replication or UEFI boot for your VMs. The script asks you this at the start. If you are intending to use these options, say yes so it will change Disk.DiskMaxIOSize to 4 MB from 32 MB.
- iSCSI. If the script finds any iSCSI (dynamic and/or static) targets to a FlashArray on your ESXi hosts it will ensure that LoginTimeout and DelayedAck are set properly (30 seconds and disabled respectively)
- Multipathing. It will ensure a SATP multipathing rule is created for the FlashArray with RoundRobin and IO Operations Limit of 1. This is SATP rule is default in ESXi 6.5 U1 and 6.0 Express Patch 5 and later by the way
- If there are any FlashArray devices that do not have RR and IOPS=1 set, it will set them too.
- It will look for any FlashArray VMFS-6 volumes and ensure automatic UNMAP is enabled. If it isn’t it enables it.
Best Practices Check Script
The “check” script checks ONLY for issues and does not change anything. It also checks for more things. It will generally only log problems, if something looks fine it will not be fully logged.
- Disk.DiskMaxIO size. This is optional and only needs to be changed if you are using vSphere Replication or UEFI boot for your VMs. so if you get a warning about this not being set and you are not using those features, you can ignore this.
- iSCSI. If the script finds any iSCSI (dynamic and/or static) targets to a FlashArray on your ESXi hosts that does not have LoginTimeout and DelayedAck set properly (30 seconds and disabled respectively)
- Multipathing. It will check that a SATP multipathing rule exists for the FlashArray with RoundRobin and IO Operations Limit of 1. This is SATP rule is default in ESXi 6.5 U1 and 6.0 Express Patch 5 and later by the way
- If there are any FlashArray devices that do not have RR and IOPS=1 set, it will log them too.
- Check that VAAI in general is enabled. XCOPY, WRITE SAME, ATS and ATS heartbeating
- Will also log specifics around devices. You will see this under each host portion in the log:
Only devices on that host with one or more issues will appear. The problematic setting will be marked with an asterisk. If the setting is irrelevant (a device isnt VMFS-6, so automatic UNMAP doesnt exist, or it isnt being used as a VMFS) the value will be N/A.
This checks for:
- number of paths to volume (should be at least 4)
- IOPS value
- Path Selection Policy
- VMFS version
- ATS Mode (should be ATS)
- Automatic UNMAP setting
Also with this, the script will log all hosts with one or more errors to the screen:
Also in the log file itself, at the top the hosts with errors are listed:
So, search the file for that name to find the host information. Or in general, just search for:
That is listed for anything that is not set properly.