Change Password on all Hosts in VCenter
A couple of weeks ago I was having a conversation about security hardening my ESXi hosts and how often passwords are changed and of course it's not as often as it should be. Most admins that deal with passwords know the best practice is to change your passwords at least every 90 days and I was looking for an easy way to do that on multiple hosts without having to touch each one.
In my lab environment I currently use the same password for all of my hosts so my thought was to write a PowerCLI script that I could use to change the passwords on all the hosts and keep it the same password on all of them. I wrote the script to log into VCenter and get all of the host and then log into each host and reset the password. For me this was a simple way to be more secure even though the password is the same on all hosts.
Here I created the script with the "Reset-HostPasswords" function.
To execute that function I would then run the command.
To make the command easier to use I saved it as a module in my PowerShell Modules folder and can use it anytime I open a new PowerShell console.
https://github.com/berstone/PowerCLI/tree/master/ResetHostPassword
In my lab environment I currently use the same password for all of my hosts so my thought was to write a PowerCLI script that I could use to change the passwords on all the hosts and keep it the same password on all of them. I wrote the script to log into VCenter and get all of the host and then log into each host and reset the password. For me this was a simple way to be more secure even though the password is the same on all hosts.
Here I created the script with the "Reset-HostPasswords" function.
To execute that function I would then run the command.
To make the command easier to use I saved it as a module in my PowerShell Modules folder and can use it anytime I open a new PowerShell console.
https://github.com/berstone/PowerCLI/tree/master/ResetHostPassword
Forked and used. Thank you.
ReplyDelete