PowerShell String Manipulation and ESXi IP Addresses
One of my customers is migrating a lot of ESXi hosts (with a strong naming convention) from one network onto a new network with a pre-defined IP Addressing scheme based around fully populated HP C7000 blade enclosures (containing 16 blades). The host naming convention is <Site>-<Enclosure ID>-ESX<Blade Slot Number>.<FQDN>. Based on this, I've been tasked with automating as much of this migration as possible, and part of that is automatically assigning the new IP Addresses to the blades. In order to do this, I'm using the new-vmhostnetworkadapter cmdlet. That cmdlet will need several parameters in order to work: -virtualswitch -portgroup -IP -subnetmask Most of these are trivial, as they will be constant for every host in the environment. The big exception to that statement is the IP address parameter. As I said earlier though, due to the strong naming convention at this site we can derive the host's new IP address entirely f...