Uncategorized

Adding and re-adding ESX servers to VirtualCenter

Hosts can get disconnected for a variety of reasons. One common reason is that the host was imported into another instance of VirtualCenter, since only one VirtualCenter can manage an ESX host at a time.

Here’s what a host (in my case, 10.16.83.242) looks like when it’s disconnected:

Disconnected

In other words a disconnected host appears in inventory but is unmanagable. If you have a lot of disconnected hosts, here’s a PowerShell script you can use to automatically reconnect every host (new and improved with real-world customer feedback! Thanks Tom!):

This script automatically detects any disconnected host and reconnects it (be sure you connect to VirtualCenter before running it though!) On the first line, the script also allows setting a password Sometimes you can’t reconnect a host without a password, usually because the password has been changed. If this applies to you, set the password here and you’ll be re-connecting hosts faster than ever.

On the other hand…

If an ESX host you want to manage doesn’t appear in VirtualCenter, you need to add it. This is a bit tricker than reconnecting since there’s no inventory in VirtualCenter to tell you the IP addresses of all the hosts you use, and you also need to know a host’s password in order to add it. This is another case where entering things in a spreadsheet can really speed things up. I made just such a spreadsheet, and here’s a video of me using it.

Attaching lots of VMware ESX hosts to VMware VirtualCenter.

One big improvement this time around is that we enter the passwords at runtime rather than saving them in the spreadsheet.

As always with these spreadsheets, the script that makes it all work is hidden in cell A2, so if this is not quite what you need you can easily tweak it into something more like what you need.

Also, if you haven’t yet downloaded the VI Toolkit (for Windows), there’s no reason not to give it a try today.