Last active
December 1, 2015 16:21
-
-
Save NamedJason/6bc3045aee9f7bae7888 to your computer and use it in GitHub Desktop.
Change many ESXi Host root Passwords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Description: Changes ESXi Host root passwords for all specified ESXi Servers | |
#Author: Jason Coleman | |
#Website: http://virtuallyjason.blogspot.com/ | |
#Reference: http://virtuallyjason.blogspot.com/2015/10/batch-changing-esxi-root-passwords.html | |
#Usage: change-passwords.ps1 -oldPass <old root password> -passString <new root password> | |
param | |
( | |
$passString = "StrongPassword" + '<_<">_>', | |
$oldPass = "WeakPassword", | |
$hostPrefix = "sac-esx", | |
$hostSuffix = ".lab" | |
) | |
$hostsChanged = @() | |
$allHosts = get-vmhost $hostPrefix*$hostSuffix | sort | |
$allHosts | foreach { | |
connect-viserver $_ -user root -password $oldPass | |
set-vmhostaccount -useraccount (get-vmhostaccount root) -password $passString | |
$hostsChanged += "Host $($_.name) has been assigned the password of $passString" | |
cmd /C pause | |
} | |
$hostsChanged |
Sorry, I didn't see this question here earlier. No, you don't have to update the password on vCenter. When you add an ESXi host to vCenter, it creates its own local account on the ESXi host with a randomized password. That's one of the reasons why a given ESXi host cannot be managed by multiple vCenter servers; when you add it to a new vCenter server, that server generates a new password for the management account.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once i do the password reset, do i need to update the password on vcenter?