VMware Cloud Community
arifdipu1
Contributor
Contributor

How to reset root password ESXi version 7

How to reset root password ESXi version 7? If anyone know how only the way. Please share

0 Kudos
7 Replies
nachogonzalez
Commander
Commander

Hello, officially is you lost the root password you have to reinstall.
Unofficially you can try this:
https://www.vmwareblog.org/forgot-esxi-root-password-no-problems-4-ways-reset/


8islas
Enthusiast
Enthusiast

If you have vCenter and the correct license you can use Host Profiles to reset the root password.

Reset ESXi Root Password with Host Profile (68079) (vmware.com)

 

s_wieland
Enthusiast
Enthusiast

I think, there is a much easier way, that isn't linked yet.

If the ESXi is registered to vCenter, you can use PowerCLI together with esxcli to reset the password.

You can also use this script to change the root password periodically

 

#Connect to vCenter
Connect-VIServer <vcenter-name>

#Connect to esxcli
$esxcli = Get-EsxCli -VMhost <esxi-host-name> -V2


#Define new password for root
$arg = $esxcli.system.account.set.CreateArgs()
$arg.id = ‘root’
$arg.password = ‘NewPassword’
$arg.passwordconfirmation = $arg.password

#Set new password
$esxcli.system.account.set.Invoke($arg)

 

anilspp
Enthusiast
Enthusiast

Great info.

0 Kudos
Wishy1
Contributor
Contributor

Excellent, that technique is great.  Thank you.

0 Kudos
borg111271
Contributor
Contributor

Can you send me a How-to-Do for your script. I don't work so often with the PowerCli.

Thanks Manuel

0 Kudos
jairoquesada
Contributor
Contributor

Use Power shell ISE to create the script

You just need to copy and paste the script and change some values

 

#THIS SCRIPT MUST BE EDITED AS SHOWN IN THE EXAMPLES

#Connect to vCenter ip or hostname
#Example Connect-VIServer 10.60.x.xxx
Connect-VIServer <vcenter-name>

#Connect to esxcli you must specify hosname
#Example $esxcli = Get-EsxCli -VMhost esx1.lab.com -V2
$esxcli = Get-EsxCli -VMhost <esxi-host-name> -V2


#Define new password for root
#Example $arg.password = ‘Changeme!'
$arg = $esxcli.system.account.set.CreateArgs()
$arg.id = ‘root’
$arg.password = ‘NewPassword’
$arg.passwordconfirmation = $arg.password

#Set new password leave this as default
$esxcli.system.account.set.Invoke($arg)

0 Kudos