As you can read here it is not possible to recover the root password on ESXi. Generally if you forget root password... you have to reinstall ESXi host. But the question is: is it always necessary? Fortunately NO!
If your ESXi hosts are added to vCenter you can use Host Profiles (available in Enterprise + license) to change the root password on ESXi host!
How to reset root password:
- Log in to the vCenter Server system with administrator privileges (via vSphere or Web client).
- Right click on ESXi host and Host Profiles --> Create Profile from Host.
- Type Host Profile name and click Next.
- Click Finish.
- Please go to Home --> Host Profiles and right click on host profile you created. Click Edit Profile.
- Navigate to Security Configuration --> Administrator password. In the configuration details, drop down and choose: Configure a fixed administrator password. Please type a new root password. Click OK.
- Right click on Host Profile and click Enable/Disable Profile Configuration. Uncheck everything except Security Configuration. Click OK.
- Put the host into maintenance mode.
- Apply the Host Profile.
- Click OK.