PowerCLIAs of lately I’ve been working and testing some new products agility and scalability capabilities around virtual machine provisioning in large numbers. One of my tests was to the deployment of 1000 virtual machines onto a VMware storage product with vCloud Automation Center (vCAC). While I was successful deploying the targeted number of virtual machines I forgot to configure virtual machine customization as part vCAC’s virtual machine provisioning process. This created a major problem for me  and what I was trying to accomplish. Lucky for me I happened to be working out of the office in Palo Alto this week and had access to the one and only Alan Renouf (@alanrenouf) “Mr. PowerCLI Man” and together we conjured up a PowerCLI little nugget to solve my problem the problem I created with 1000 virtual machines in minutes. After deploying 1000 virtual machines and not configuring vCloud Automation Center to customized the virtual machines as part of the provisioning process I got 999 network problems (got 999 network problems, but provisioning ain’t one) due to the virtual machines names being repeated on the network 999 times more than it needed to be. I needed to change the name of a virtual machine’s guest operating system 999 times. That process would have taken me days to manually change and update all those names. I needed something that could get me over that hump before the end of the day to finish my test. Alan and I came up with a PowerCLI solution that would fix the problem and allowed me to proceed with my tests within minutes.  We essentially changed and customized 1000 virtual machines by changing the guest OS name in windows to match the virtual machines unique name. This was exactly what I was initially looking to do as part of my initial deployment. Below you can find the PowerCLI code.

Change GuestOS Name to Match Virtual Machine Name

I figured this was very helpful for me and worth sharing with the community as it may be useful for some other folks. Thanks Alan for the help and collaboration.


For future updates, be sure to follow me on Twitter at @PunchingClouds