We help IT Professionals succeed at work.

ESXiCLI: Is it possible to list VMs with Virtual Machine Port Groups which they are using?

Greg_U
Greg_U asked
on
Hi,

I'm trying to write simple script in Bash under vMA which will list (like in topic) all running VMs with virtual machine Port Groups which they they are attached to. Is it possible?

I've try to find solution to this problem for last couple hours.

Kind regards
Greg

(Please excuse my English it isn't my first language)
Comment
Watch Question

Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
CERTIFIED EXPERT
Fellow
Expert of the Year 2017
Commented:
esxtop can list VMs against portgroups and vmnics.

I would recommend using the following, also VMware recommends the use of PowerCLI, which is PowerShell interface with vSphere-specific additions.

http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli

One of the simplest PowerCLI examples, and something which is actually extremely useful on its own, is the Get-VM cmdlet. Which lists VMs.

PowerCLI can be a bit overwhelming to use,  But it can be enhanced with a nice toolset and a library of preconfigured scripts to jump-start your mass changes, which is possible with PowerGUI

http://powergui.org/index.jspa

and

VMware Community Pack

http://www.virtu-al.net/featured-scripts/vmware-powerpack/

Commented:
Ditto, would recommend hanccocka's recommendation... ;)

Author

Commented:
Thank you for your answers.

I know about PowerCLI and if I could I would use it, but due to nature of environment I can use only Linux environment.
So I'm force to use ESXCli.

I'm guessing it cannot be done in ESXCli?

Kind regards
Greg
VMware and Virtualization Consultant
CERTIFIED EXPERT
Fellow
Expert of the Year 2017
Commented:
there are esxcli network commands to list vSwitchs, vmnics, portgroups, but they cannot map back to VMs.

Author

Commented:
One more time thank you for your answers.

Kind regards
Greg

Explore More ContentExplore courses, solutions, and other research materials related to this topic.