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

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)
Greg_UAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
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/
BWXTCommented:
Ditto, would recommend hanccocka's recommendation... ;)
Greg_UAuthor 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
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
there are esxcli network commands to list vSwitchs, vmnics, portgroups, but they cannot map back to VMs.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Greg_UAuthor Commented:
One more time thank you for your answers.

Kind regards
Greg
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VMware

From novice to tech pro — start learning today.