I know LucD had a function he created back in the day to update the root password in host profiles but that stopped working with vSphere 7 & beyond. Has anyone seen any updates to that or have an alternative way of automating updating the host profile esxi root password?
The method I used was based on some reverse engineering on HostProfiles in vSphere 5.* Unfortunately, HostProfiles became more complex, and not really documented, so yes, that method does not work anymore.
In KB68079 it is documented how to do it via the Web GUI, but a diff of a before and after didn't make me any wiser. Plus I'm not even sure which encryption they currently use for passwords in HostProfiles.
If you joined your ESXi node to an AD domain, there is a method that you can use with an account in the ESX Admins AD group. But I haven't used, nor automated that method myself.