VMware : Mass Modify vpxa.cfg on ESXi Hosts

0

The other day i was working on changing the IP address of my vCenter Server and after changing the IP address all of my ESXi hosts lost the connectivity from vCenter. This happens because the vpxa.cfg file which is located at /etc/vmware/vpxa/vpxa.cfg. on each ESXi host is having the old vcenter IP address :

<serverIp>1.1.1.1</serverIp>

Now this situation can leaves you with two options explain in KB1001493

Either we will have to remove the hosts from vcenter and add again or we will have to modify vpxa.cfg file. Both the options are a headache as it involves alot of manual work so why not leverage the power of PowerShell.

Powershell does not have inbuilt functionality to handle SSH Sessions so we will have to use Posh-SSH module from PowerShell gallery which can be download using below command:

After the module is successfully installed you can open ssh sessions to ESXi hosts and script your way into modifying all the vpxa.cfg using Foreach looping.

Below is the code that i wrote to mass modify these files on all of my ESXi hosts from 1.1.1.1 to 2.2.2.2:

Everything went smooth for me and all my ESXi hosts were accessible from vCenter.

Share.

About Author

Leave A Reply