Tuesday, August 3, 2021

Check or Verify Esxi Credentials on Multiple Esxi Hosts

There are times that you will need to check if esxi credentials are correct & consistent across the multiple hosts, and this PowerCLI script will save your time a lot. It uses TCP port 443 so it takes a bit longer than using ssh, but the good thing is you do not need to open port 22 from your client. The process is quite simple:

  • It prompts for Esxi's credentials for the first time.
  • Using the given credentials, it connects to each Esxi by TCP 443.
  • After the connection is succeed, it disconnects the current connection.
  • To save time in executing multiple esxi hosts, PoshRsJob powershell module is used for simultaneously execution.

If you do not have PoshRSJob module, install it in the elevated powershell console by the following command before running the script.

Install-Module -Name PoshRsJob


Monday, July 19, 2021

PowerCLI to set Evacuated Esxi Hosts into Maintenance Mode

It's the little script that will set all esxi hosts into maintenance mode when no VMs are left running, particularly useful when you're doing the bulk VMs migration or shutdown for Esxi maintenance. You will need to define the script runtime whereas the interval for each check (the action which will loop all esxi hosts to see if VMs are still running or not) should be defined as 15 sec as a minimum.