The usual way of changing the root password for ESX Host is simply by using the passwd command as per the KB Article 1004659.
If you want to apply the same in ESXi you have to enable tech-support mode and execute the command. This is one way but you have to physically go to the server and enable tech support mode. below is one way of doing it without enabling tech-support mode using Power-CLI.
Long story short, We can leverage power-CLI to do it by executing the following procedure.
1- Log into the ESXi Host with the following command in POWER-CLI
Connect-VIServer <<YOUR ESX Host or IP Address>> -User root -Password <<Your current password or “” if there is no password>>
2- You can create a variable to identify the password
$password = <<Put the new password>>
3- Just use the below command to change the password
Set-VMHostAccount –UserAccount root –Password $password
4- Don’t forget to disconnect
Disconnect-VIServer <<ESXi Host Name or IP Address>>