VMware Cloud Community
KrisHamilton
Contributor
Contributor

Find Windows dns name inside VM file

We upgraded our infrastructure to ESX 3.5 Update 1 onver the weekend and all went well. However after powering up VM's we apparently missed one. The issue is that the Windows name is different than the VMware file name, so we are aving trouble locating it. Is there any way to find what the Windows name (DNS) name is by looking in and any of the VM files? Thanks!

Tags (3)
0 Kudos
2 Replies
lamw
Community Manager
Community Manager

You can do the following to get the displayName, which is what is shown on your VIC.

for loop through "vmware-cmd -l", this will show you all registered VMs and then you'll want to parse out the "displayName" variable and match it up against a list of known VMs, which everone does not match, you'll know that's the one that needs to be renamed to match your DNS name for the system.

#!/bin/sh

for vm in `vmware-cmd -l`;

do

VM_NAME=`vmware-cmd "$" | getconfig displayName | awk '{print $3}'`

VM_PATH=$vm

echo -e "$VM_NAME\t$VM_PATH

done

This quick script will pull out the displayName and also path to the storage whether that be local or on a SAN and hopefully this can quickly parse through your VMs to let you know which is out of date, this could go faster if you had a list to compare with and you can then output only the displayName that does not match any of your DNS names.

0 Kudos
KrisHamilton
Contributor
Contributor

Thanks for the script. We found the VM, but I may need to explain my question better. It may be helpful for myself and others in the future if we can get it answered.

Supposed you have a location that contains all the VM's you have and they are labeled, A, B, C, D, etc... Now a user requests that you power on VM machine with the windows name of "BOB". As you look for the folders you add the .vmx file to the inventory you realize that there are no folders named "BOB". Is there a way to find which machine has the name "BOB" without adding the machine to the inventory and powering it on?

I think this could be useful if you have some old backups and someone needs a machine back. It may not even be possible, but it could really save some time. Thanks!

0 Kudos