klancy43
Contributor
Contributor

how to identify two similar VMs?

Jump to solution

my environment is vSphere 7.0u2,

recently I discovered a weird situation that two VMs' files (residing in a vsanDatastore) are almost the same but categorized in different directories, I did try to delete the one that seem not running but failed.

As shown in figure below.

klancy43_1-1640074087884.png

in the datacenter inventory, only one VM, which is "4IN1-2" can be seen running, the other can not be found, and I cannot power them off for troubleshooting.

can anyone provide some tips, how to identify theses two VMs? it's quite strange that they are visually the same.

 

0 Kudos
1 Solution

Accepted Solutions
fabio1975
Expert
Expert

Ciao 

in the command,vim-cmd solo/registervm, for registering a VM through its VMX file you can also add the name with which you want it to be inventoried at the end of the syntax. Es:

[root@viESXi0:~] vim-cmd solo/registervm /vmfs/volumes/USB-Storage/Embedded-vCenter-Server-Appliance_1/Embedded-vCenter-Server-Appliance_1.vmx vcenterTest01

This command registers the VM in the single ESXi, if you have a vCenter I advise you to register from the vCenter GUI, during the registration phase  (after selecting the VMX file) the wizard asks you for the name of the VM.

View solution in original post

0 Kudos
5 Replies
fabio1975
Expert
Expert

Ciao 

To check which is the directory of the VM inventoried in the vCenter I would use this powercli command:

Get-VM -Name <name of the VM> | select Name, @ {E = {$ _. ExtensionData.Config.Files.VmPathName}; L = "VM Path"}


What it returns to you is the vSAN storage directory where the configuration file (the VMX file) resides.

Once the directory of the current VM has been identified .. I would try to add the other VM to the vCenter (obviously with a different name than the one already inventoried).

Then I would evaluate whether to delete it or turn it on (with the network disconnected)

 

0 Kudos
depping
Leadership
Leadership

Moved your post to the vSAN forum, feels more appropriate or the topic.

0 Kudos
kastlr
Expert
Expert

Hi,

 

open a ssh Session to the ESXi Server which did host the running VM and perform the following command.

vim-cmd vmsvc/getallvms |grep -F 4IN1-2

 



Hope this helps a bit.
Greetings from Germany. (CET)
0 Kudos
klancy43
Contributor
Contributor

Hi guys, thanks so much for the prompt

i also found some useful docs like Performing common virtual machine-related tasks with command-line utilities (2012964) (vmware.com) and VMware PowerCLI User's Guide -

but not sure how to name the new VM (that is going to be registered) via command: vim-cmd solo/registervm <path_to_vmx_file>

 

hope this operation won't conflict with the VM that is already in the vCenter inventory...

0 Kudos
fabio1975
Expert
Expert

Ciao 

in the command,vim-cmd solo/registervm, for registering a VM through its VMX file you can also add the name with which you want it to be inventoried at the end of the syntax. Es:

[root@viESXi0:~] vim-cmd solo/registervm /vmfs/volumes/USB-Storage/Embedded-vCenter-Server-Appliance_1/Embedded-vCenter-Server-Appliance_1.vmx vcenterTest01

This command registers the VM in the single ESXi, if you have a vCenter I advise you to register from the vCenter GUI, during the registration phase  (after selecting the VMX file) the wizard asks you for the name of the VM.

0 Kudos