VMware Cloud Community
JohnathanAmber
Enthusiast
Enthusiast
Jump to solution

[ESXi 4.1] Limit VIM-CMD vmsvc/getallvms Results

Hello,

I have a lot of VMs running in our environment. Thus, when I run the subject command, I get a lot of unneeded content.

What I want is to see the VMID, Name, and its Datastore location. How can I do this?

BTW, I did install RVTools to attempt to make this easier for myself and see them all in a row... however the VMID is not displayed.

Thanks,

Johnathan

-Just workin' and learnin'
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
JohnathanAmber
Enthusiast
Enthusiast
Jump to solution

brunofernandez1‌,

Thanks for the link. I found the following one liner that does this for me:

vim-cmd vmsvc/getallvms | sed -e '1d' -e 's/ \[.*$//' | awk '$1 ~ /^[0-9]+$/ {print $1" "substr($0,8,80)}'

-Just workin' and learnin'

View solution in original post

0 Kudos
7 Replies
brunofernandez1
Jump to solution

this could help

vm-support --listvms

------------------------------------------------------------------------------- If you found this or any other answer helpful, please consider to award points. (use Correct or Helpful buttons) Regards from Switzerland, B. Fernandez http://vpxa.info/
0 Kudos
JohnathanAmber
Enthusiast
Enthusiast
Jump to solution

brunofernandez1,

I appreciate the reply. However, that command doesn't work:

~ # vm-support --listvms

Illegal option --

Currently running it with a single '-'... will let you know once it is done... taking a while.

-Just workin' and learnin'
0 Kudos
JohnathanAmber
Enthusiast
Enthusiast
Jump to solution

Well, running it with a single dash simply created the compressed package to send to support.

Other suggestions?

-Just workin' and learnin'
0 Kudos
brunofernandez1
Jump to solution

I'm sorry but with esxi 5.5 this matches.

but this could help:

Get all VMs with "vmware-vim-cmd vmsvc/getallvms"

------------------------------------------------------------------------------- If you found this or any other answer helpful, please consider to award points. (use Correct or Helpful buttons) Regards from Switzerland, B. Fernandez http://vpxa.info/
JohnathanAmber
Enthusiast
Enthusiast
Jump to solution

brunofernandez1‌,

Thanks for the link. I found the following one liner that does this for me:

vim-cmd vmsvc/getallvms | sed -e '1d' -e 's/ \[.*$//' | awk '$1 ~ /^[0-9]+$/ {print $1" "substr($0,8,80)}'

-Just workin' and learnin'
0 Kudos
brunofernandez1
Jump to solution

You're welcome

Maybe you can mark my answer as helpful 😉

Thanks

------------------------------------------------------------------------------- If you found this or any other answer helpful, please consider to award points. (use Correct or Helpful buttons) Regards from Switzerland, B. Fernandez http://vpxa.info/
0 Kudos
JohnathanAmber
Enthusiast
Enthusiast
Jump to solution

Done. :smileygrin:

-Just workin' and learnin'
0 Kudos