Do you ever rename a server? Sure, in Windows that’s pretty easy. But having virtualized most of your servers, renaming brings along some new challenges.
When you first create a virtual machine, you enter a name for the machine. But that’s before you even started installing Windows on it. You might not even use the same names. Sure, the name in the VI Client is only a label and can easily be changed, even while the vm is running. So, no problems there? Look again. Have you ever tried browsing one of your datastores looking for the files that belong to some vm? Simple enough, as each vm gets its own folder, which is named after… the vm, obviously. But that folder is created when the vm is created. And when you rename the vm, guess what happens to the folder name: nothing.
Now, I don’t even want to begin to imagine the things that could go wrong when you’re browsing your datastores looking for those files, whether you are looking to copy them, remove them, … My advise would be to take a look at the vm settings, which lists the locations of the vmdk files ánd double-check the modified dates of the files you are touching to see whether they correspond to what you’d expect.
Although we should always keep checking and double-checking, it is still a good idea to try and keep your naming as consistent as possible. You never know whether somebody else will be checking as thoroughly as you are. And that’s where the Helpful Script of the Day comes in. This Powershell script, using the VI Toolkit, lists all your vm’s names, the windows host names (as reported back by the VMware Tools), plus the names of the folders and files this vm is using (for up to three disks). The output is sent to a csv file in a location you specify. I recommend opening it in Excel, which generates a nice tabular view and – if available in your version of Excel, using the feature Conditional Formatting to highlight duplicate values. All the values that are inconsistent should then stand out like a Dutchman in China.
Any questions or remarks? Don’t hesitate to comment. I’ll be reading and trying to respond as soon as possible.
PS: I hit over 1000 visits this month, while the counter stuck at 130 just two months ago! I would like to thank you all for checking out my blog. Hope it’s proving useful to you.