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

Posted on 2012-08-14
Last Modified: 2012-08-15

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

(Please excuse my English it isn't my first language)
Question by:Greg_U
    LVL 116

    Assisted Solution

    by:Andrew Hancock (VMware vExpert / EE MVE)
    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.

    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


    VMware Community Pack
    LVL 1

    Expert Comment

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

    Author Comment

    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
    LVL 116

    Accepted Solution

    there are esxcli network commands to list vSwitchs, vmnics, portgroups, but they cannot map back to VMs.

    Author Comment

    One more time thank you for your answers.

    Kind regards

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    #Citrix #Citrix Netscaler #HTTP Compression #Load Balance
    This is similar to the error described in my previous Article, but with a different source problem and a different solution. When trying to scan and stage the ESXi 6.0 updates using VMware Update Manager, we can get "error code 90"
    Teach the user how to convert virtaul disk file formats and how to rename virtual machine files on datastores. Open vSphere Web Client: Review VM disk settings: Migrate VM to new datastore with a thick provisioned (lazy zeroed) disk format: Rename a…
    Teach the user how to use create log bundles for vCenter Server or ESXi hosts Open vSphere Web Client: Generate vCenter Server and ESXi host log bundle:  Open vCenter Server Appliance Web Management interface and generate log bundle: Open vCenter Se…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now