[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1033
  • Last Modified:

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)
0
Greg_U
Asked:
Greg_U
  • 2
  • 2
2 Solutions
 
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/
0
 
BWXTCommented:
Ditto, would recommend hanccocka's recommendation... ;)
0
 
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
0
 
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.
0
 
Greg_UAuthor Commented:
One more time thank you for your answers.

Kind regards
Greg
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now