Close Menu
DPC Virtual Tips
    Read More

    How to Resize ext4 and XFS Filesystems on RHEL 8

    September 14, 2026

    How to Install VMware PowerCLI Offline (VCF PowerCLI)

    September 14, 2026

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    September 11, 2026
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    DPC Virtual Tips
    • Home
    • Linux & Automation
    • HPC & Slurm
    • VMware & Virtualization
    • About Us
    • Contact
    DPC Virtual Tips
    Home » vim-cmd Commands for VMware ESXi: Practical Guide
    VMware & Virtualization

    vim-cmd Commands for VMware ESXi: Practical Guide

    By Danilo ChiacchioJuly 14, 202613 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    vim-cmd Commands for VMware ESXi: Practical Guide
    vim-cmd Commands for VMware ESXi: Practical Guide
    Share
    Facebook Twitter LinkedIn Pinterest Email

    The vim-cmd utility is one of the most useful command-line tools available on a VMware ESXi host. It allows administrators to inspect and manage virtual machines directly from the ESXi Shell or through an SSH session, which can be especially useful when troubleshooting a host or when the vSphere Client is unavailable.

    In this practical guide, I will show several useful vim-cmd commands with examples, including how to list registered virtual machines, identify a VMID, check VM configuration and power state, retrieve guest information, work with snapshots, inspect ESXi host information, and perform basic maintenance operations.

    Many vim-cmd operations require the VMID of the virtual machine. Because of that, vim-cmd vmsvc/getallvms is usually the first command I run when troubleshooting a VM directly from an ESXi host.

    vim-cmd Commands Quick Reference

    The table below summarizes some of the commands covered in this guide:

    TaskCommand
    List registered VMsvim-cmd vmsvc/getallvms
    Get VM summaryvim-cmd vmsvc/get.summary <VMID>
    Get VM configurationvim-cmd vmsvc/get.config <VMID>
    Get guest informationvim-cmd vmsvc/get.guest <VMID>
    Check VM power statevim-cmd vmsvc/power.getstate <VMID>
    Power on a VMvim-cmd vmsvc/power.on <VMID>
    Shut down the guest OSvim-cmd vmsvc/power.shutdown <VMID>
    Power off a VMvim-cmd vmsvc/power.off <VMID>
    Reboot the guest OSvim-cmd vmsvc/power.reboot <VMID>
    List VM snapshotsvim-cmd vmsvc/snapshot.get <VMID>
    Create a snapshotvim-cmd vmsvc/snapshot.create <VMID> <name> <description> <memory> <quiesced>
    Remove all snapshotsvim-cmd vmsvc/snapshot.removeall <VMID>
    Show VM networksvim-cmd vmsvc/get.networks <VMID>
    Show VM datastoresvim-cmd vmsvc/get.datastores <VMID>
    Show VM tasksvim-cmd vmsvc/get.tasklist <VMID>
    Show ESXi host summaryvim-cmd hostsvc/hostsummary
    Enter maintenance modevim-cmd hostsvc/maintenance_mode_enter
    Exit maintenance modevim-cmd hostsvc/maintenance_mode_exit
    Show host networking informationvim-cmd hostsvc/net/info
    Show VMkernel interface informationvim-cmd hostsvc/net/vnic_info

    Broadcom continues to document vim-cmd for common VM operations such as listing VMs, checking power state, snapshots, guest shutdown and power operations.

    What Is vim-cmd in VMware ESXi?

    vim-cmd provides a command-line interface for interacting with VMware ESXi management services.

    For an administrator, its main advantage is that many operations normally performed through the vSphere Client can also be inspected or executed directly from an ESXi host.

    This is useful in situations such as:

    • troubleshooting a virtual machine directly from an ESXi host;
    • checking a VM when vCenter Server is unavailable;
    • identifying the VMID of a virtual machine;
    • reviewing VM configuration or runtime information;
    • troubleshooting VM power operations;
    • checking snapshots;
    • inspecting host and network information.

    You normally run these commands from the ESXi Shell or through SSH with an account that has the required administrative permissions.

    Important: vim-cmd depends on the ESXi hostd management service. It is useful when vCenter Server or the graphical client is unavailable, but if hostd itself is stopped or unresponsive, vim-cmd operations may also fail. In that situation, investigate the ESXi management services before assuming that the VM command itself is incorrect.

    How to List All VMs with vim-cmd vmsvc/getallvms

    This is probably the most important vim-cmd command to know:

    vim-cmd vmsvc/getallvms

    The command lists the virtual machines registered on the ESXi host and displays information such as:

    Vmid   Name        File                              Guest OS       Version
    12     linux-a-03  [Private-01] linux-a-03/linux-a-03.vmx  ubuntu64Guest  vmx-19

    The most important field for many subsequent commands is Vmid.

    For example:

    Vmid = 12

    You would then use 12 in commands such as:

    vim-cmd vmsvc/power.getstate 12

    The other fields are also useful:

    • Name identifies the virtual machine.
    • File shows the datastore and the path to the VM configuration file.
    • Guest OS indicates the configured guest operating system type.
    • Version indicates the virtual hardware version.
    • Annotation can contain a description if one has been configured.

    Broadcom also uses vim-cmd vmsvc/getallvms as the standard way to identify the VMID and the location of a registered VM from the ESXi command line.

    If you already know the VM name, you can filter the result:

    vim-cmd vmsvc/getallvms | grep -i linux-a-03

    This is particularly useful on ESXi hosts containing many virtual machines.

    Get a VM Summary with vim-cmd vmsvc/get.summary

    After identifying the VMID, you can retrieve a summary of the virtual machine:

    vim-cmd vmsvc/get.summary 12

    This returns a large amount of information about the VM.

    Instead of reviewing the entire output, you can combine the command with grep.

    For example:

    vim-cmd vmsvc/get.summary 12 | grep -i memory

    or:

    vim-cmd vmsvc/get.summary 12 | grep -i cpu

    Another useful example is retrieving VM uptime:

    vim-cmd vmsvc/get.summary 12 | grep uptimeSeconds

    Broadcom documents get.summary for retrieving VM information, including uptime and memory-related troubleshooting.

    This command is useful when you need a quick overview of a VM without opening the vSphere Client.

    Inspect VM Configuration with vim-cmd vmsvc/get.config

    For more detailed VM configuration information, use:

    vim-cmd vmsvc/get.config 12

    The output contains configuration properties associated with the virtual machine.

    Because the result can be long, filtering it is often more practical.

    For example:

    vim-cmd vmsvc/get.config 12 | grep -i memory

    You can also search for hot-add related configuration:

    vim-cmd vmsvc/get.config 12 | grep -i hotplug

    Broadcom uses vmsvc/get.config in troubleshooting procedures to inspect VM configuration values such as memory hot-plug settings.

    This is one of the commands I find particularly useful when the configuration shown in the guest operating system does not appear to match what ESXi has assigned to the VM.

    Check VM Power State with vim-cmd vmsvc/power.getstate

    To check whether a specific virtual machine is powered on or powered off, use:

    vim-cmd vmsvc/power.getstate 12

    A typical result is:

    Retrieved runtime info
    Powered on

    Remember that you first need the VMID, which you can obtain with:

    vim-cmd vmsvc/getallvms

    Checking the power state before performing another VM operation is a good habit, especially during troubleshooting.

    Get Guest OS Information with vim-cmd vmsvc/get.guest

    If VMware Tools is running inside the guest operating system, vim-cmd can retrieve useful information about the VM:

    vim-cmd vmsvc/get.guest 12

    Depending on the guest and VMware Tools status, the output may contain information such as the guest hostname, IP addresses, VMware Tools information and network details.

    If you only need the IP address, you can filter the output:

    vim-cmd vmsvc/get.guest 12 | grep -i ipAddress

    Broadcom also documents vmsvc/get.guest for obtaining guest network information from ESXi.

    If VMware Tools is not installed or is not running correctly, some guest information may not be available.

    Show the Networks Used by a VM

    To retrieve network information associated with a virtual machine, run:

    vim-cmd vmsvc/get.networks 12

    The command can help identify the networks or port groups associated with the VM.

    This can be useful when troubleshooting connectivity or confirming that the VM is connected to the expected network.

    Show the Datastores Used by a VM

    To retrieve datastore information for a VM:

    vim-cmd vmsvc/get.datastores 12

    The output can include information about the datastores associated with the virtual machine, including their names, paths, capacity and accessibility.

    This can be useful when you need to locate VM files or investigate storage-related problems.

    Power On a VM with vim-cmd

    To power on a virtual machine:

    vim-cmd vmsvc/power.on 12

    If the operation succeeds, ESXi starts the VM identified by that VMID.

    Broadcom documents this command as a supported command-line method for powering on a VM directly from an ESXi host.

    Gracefully Shut Down a VM

    If you want to request a graceful shutdown of the guest operating system, use:

    vim-cmd vmsvc/power.shutdown 12

    This is different from immediately cutting power to the VM.

    A graceful shutdown depends on the guest operating system and VMware Tools being able to process the shutdown request.

    After sending the command, check the state again:

    vim-cmd vmsvc/power.getstate 12

    Broadcom recommends guest shutdown before resorting to a hard power-off when possible.

    Force a VM to Power Off

    If the guest operating system cannot be shut down gracefully and you need to power off the virtual machine directly:

    vim-cmd vmsvc/power.off 12

    Be careful with this command.

    It is comparable to removing power from a physical server rather than performing a normal operating-system shutdown. Applications may not close cleanly, and unsaved data can be lost.

    Use power.shutdown first whenever a graceful shutdown is possible.

    Reboot the Guest Operating System

    You can also request a guest OS reboot:

    vim-cmd vmsvc/power.reboot 12

    As with guest shutdown, this operation depends on the guest operating system and VMware Tools.

    Check VM Snapshots with vim-cmd

    To display the snapshot tree for a virtual machine:

    vim-cmd vmsvc/snapshot.get 12

    A VM with snapshots may return information similar to:

    Get Snapshot:
    |-ROOT
    --Snapshot Name        : Snapshot01
    --Snapshot Id          : 1
    --Snapshot Description :
    --Snapshot State       : powered on

    This allows you to identify existing snapshots and their snapshot IDs.

    Broadcom currently documents snapshot.get for obtaining the snapshot tree and snapshot IDs from an ESXi host.

    You may also encounter:

    vim-cmd vmsvc/get.snapshot 12

    in VMware/Broadcom documentation for checking snapshot metadata.

    Note: snapshot.get reports snapshots known to the VM snapshot metadata. An empty snapshot tree does not always prove that no delta disks exist on the datastore. In troubleshooting situations involving orphaned or inconsistent snapshots, also inspect the VM directory for files such as *-000001.vmdk or *-000001-sesparse.vmdk and follow the appropriate snapshot-consolidation procedure.

    Create a VM Snapshot from the ESXi Command Line

    The general syntax for creating a snapshot is:

    vim-cmd vmsvc/snapshot.create <VMID> <name> <description> <includeMemory> <quiesced>

    For example:

    vim-cmd vmsvc/snapshot.create 12 Snap01 Test-Snap01 1 0

    In this example:

    12          = VMID
    Snap01      = Snapshot name
    Test-Snap01 = Snapshot description
    1           = Include VM memory
    0           = Do not request a quiesced snapshot

    If you do not want to include VM memory, use 0 for that option.

    For names or descriptions containing spaces, quote the arguments appropriately.

    For example:

    vim-cmd vmsvc/snapshot.create 12 "Before Upgrade" "Snapshot before maintenance" 0 0

    Snapshot operations can generate significant storage activity, so they should be planned carefully on production systems. Broadcom documents the same command syntax for creating snapshots from ESXi.

    Remove All Snapshots from a VM

    To remove all snapshots associated with a VM:

    vim-cmd vmsvc/snapshot.removeall 12

    This can trigger snapshot consolidation and may take considerable time depending on snapshot size, storage performance and VM activity.

    Do not interrupt snapshot consolidation simply because it is taking longer than expected. On production environments, verify the current snapshot and storage situation before using this command.

    If your goal is to remove only one specific snapshot, first retrieve the snapshot ID:

    vim-cmd vmsvc/snapshot.get 12

    Then use the corresponding snapshot removal command for that snapshot:

    vim-cmd vmsvc/snapshot.remove <VMID> <Snapshot-ID>
    
    # Example:
    vim-cmd vmsvc/snapshot.remove 12 5

    Check Running Tasks on a VM

    Another very useful troubleshooting command is:

    vim-cmd vmsvc/get.tasklist 12

    If tasks are currently running against that virtual machine, they will be displayed.

    If no task is active, the output may look similar to:

    (ManagedObjectReference) []

    This is useful when vSphere reports messages such as:

    Another task is already in progress

    or when a VM operation appears to be stuck.

    Broadcom specifically recommends vmsvc/get.tasklist when troubleshooting running or stuck VM tasks.

    Get ESXi Host Information with vim-cmd hostsvc/hostsummary

    vim-cmd is not limited to virtual machines.

    You can retrieve information about the ESXi host itself:

    vim-cmd hostsvc/hostsummary

    Because the output is extensive, I usually pipe it through less:

    vim-cmd hostsvc/hostsummary | less

    You can also use grep to search for specific values:

    vim-cmd hostsvc/hostsummary | grep -i vendor
    vim-cmd hostsvc/hostsummary | grep -i model
    vim-cmd hostsvc/hostsummary | grep -i uuid
    vim-cmd hostsvc/hostsummary | grep -i connectionState
    vim-cmd hostsvc/hostsummary | grep -i name
    vim-cmd hostsvc/hostsummary | grep -i version
    vim-cmd hostsvc/hostsummary | grep -i build
    vim-cmd hostsvc/hostsummary | grep inMaintenanceMode

    This makes hostsummary a convenient command when you need basic ESXi host details without navigating through the graphical interface.

    Put an ESXi Host into Maintenance Mode

    To request maintenance mode from the command line:

    vim-cmd hostsvc/maintenance_mode_enter

    Before doing this on a production environment, make sure you understand what will happen to the virtual machines currently running on the host.

    Depending on your environment, workloads may need to be migrated or shut down before the host can safely enter maintenance mode.

    You can check whether maintenance mode is active with:

    vim-cmd hostsvc/hostsummary | grep inMaintenanceMode

    Exit ESXi Maintenance Mode

    To exit maintenance mode:

    vim-cmd hostsvc/maintenance_mode_exit

    Afterward, confirm the state:

    vim-cmd hostsvc/hostsummary | grep -i maintenanceMode

    View ESXi Network Information with vim-cmd

    To retrieve detailed information about the host networking configuration:

    vim-cmd hostsvc/net/info

    The output can be large, so filters can make it easier to read.

    For example, to find standard vSwitch names:

    vim-cmd hostsvc/net/info | grep -i vswitchName

    To search for distributed switch information:

    vim-cmd hostsvc/net/info | grep -i dvsName

    hostsvc/net/info is also used in ESXi troubleshooting to inspect networking information directly through the command line.

    For more extensive ESXi network configuration work, esxcli network is usually the more specialized tool, while vim-cmd remains useful for inspection and troubleshooting.

    If you need to rebuild the ESXi Management Network rather than only inspect it, see “Configure an ESXi Management Network from the Command Line“ for a complete esxcli workflow covering the Standard vSwitch, port group, physical uplink, VMkernel adapter, Management tag, IP address, VLAN, and default route.

    View VMkernel Interface Information

    To retrieve information about VMkernel interfaces:

    vim-cmd hostsvc/net/vnic_info

    This can help when checking VMkernel adapters and their networking information from the ESXi command line.

    For deeper network troubleshooting, I normally combine this information with tools such as:

    esxcli network ip interface list
    esxcli network nic list
    vmkping

    That gives a broader view of physical NICs, VMkernel interfaces and connectivity.

    A Practical vim-cmd Troubleshooting Workflow

    When troubleshooting a VM directly from an ESXi host, a simple workflow can save a lot of time.

    Start by identifying the VM:

    vim-cmd vmsvc/getallvms

    Suppose the VMID is 12.

    Check its current power state:

    vim-cmd vmsvc/power.getstate 12

    Review the VM summary:

    vim-cmd vmsvc/get.summary 12

    Inspect its configuration:

    vim-cmd vmsvc/get.config 12

    Check guest information:

    vim-cmd vmsvc/get.guest 12

    Check for running tasks:

    vim-cmd vmsvc/get.tasklist 12

    Check snapshots:

    vim-cmd vmsvc/snapshot.get 12

    Check storage:

    vim-cmd vmsvc/get.datastores 12

    And check networking:

    vim-cmd vmsvc/get.networks 12

    With these commands alone, you can collect a significant amount of information about a VM without using the vSphere Client.

    Using vim-cmd as an ESXi Troubleshooting Tool

    The real value of vim-cmd is not memorizing every available command, but knowing how to move from the ESXi inventory to the specific object that needs investigation.

    In most VM troubleshooting scenarios, the workflow starts with vmsvc/getallvms to identify the VMID. From there, commands such as power.getstate, get.summary, get.config, get.guest, get.tasklist, and snapshot.get provide enough information to determine the next troubleshooting step.

    At the host level, hostsvc/hostsummary and the networking commands provide additional visibility when vCenter Server or the graphical interface is unavailable.

    Keep in mind that vim-cmd depends on the ESXi management services. If the command itself cannot communicate with hostd, the problem may be at the ESXi management-service layer rather than with the virtual machine you are investigating.

    External References

    • Performing Common Virtual Machine Tasks from the ESXi Command Line Broadcom reference for common vim-cmd operations, including listing VMs, checking power state, powering VMs on and off, guest shutdown and reboot, VMware Tools information, snapshots, registration, and other VM management tasks.
    • Powering On a Virtual Machine from the ESXi Command Line Broadcom workflow using vim-cmd vmsvc/getallvms, power.getstate, and power.on, including the important dependency of vim-cmd on the ESXi hostd service.
    • Consolidating and Committing Virtual Machine Snapshots in ESXi Official procedure for identifying VM snapshot state, creating snapshots, removing all snapshots, and handling snapshot consolidation from the ESXi command line.
    • How to Remove a Specific Snapshot Using vim-cmd Broadcom ESXi 8.x procedure for obtaining the snapshot ID with snapshot.get and removing one specific snapshot with vmsvc/snapshot.remove.
    • Troubleshooting Virtual Machine Tasks and Locks in ESXi Broadcom troubleshooting reference using vmsvc/get.tasklist and vimsvc/task_info to inspect operations currently running against a virtual machine.
    • Patching an ESXi Host Using the Command Line Broadcom procedure demonstrating hostsvc/maintenance_mode_enter and hostsvc/hostsummary for entering and validating ESXi Maintenance Mode before host maintenance.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleHow to Use iPerf3 on ESXi to Test Network Throughput
    Next Article Linux ss, lsof, and fuser Commands: A Practical Guide
    Danilo Chiacchio
    • LinkedIn

    Infrastructure Engineer with hands-on experience in virtualization, Linux, Windows Server, and enterprise infrastructure troubleshooting. I work with real-world infrastructure environments and technical labs, focusing on diagnosing problems, understanding root causes, and documenting practical solutions. DPC Virtual Tips was created to share hands-on troubleshooting guides, lab experiences, technical procedures, and lessons learned while working with technologies such as VMware, Linux, HPC/Slurm, networking, storage, and infrastructure automation with Python.

    Related Posts

    How to Install VMware PowerCLI Offline (VCF PowerCLI)

    September 14, 2026

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    September 11, 2026

    Restoring vCenter Server from a File-Based Backup: Practical Lab Walkthrough

    September 7, 2026

    Comments are closed.

    Search
    Categories
    • HPC & Slurm (11)
    • Linux & Automation (13)
    • VMware & Virtualization (17)
    Read More
    Linux & Automation

    How to Resize ext4 and XFS Filesystems on RHEL 8

    By Danilo ChiacchioSeptember 14, 202614 Mins Read
    VMware & Virtualization

    How to Install VMware PowerCLI Offline (VCF PowerCLI)

    By Danilo ChiacchioSeptember 14, 202610 Mins Read
    VMware & Virtualization

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    By Danilo ChiacchioSeptember 11, 202610 Mins Read
    Linux & Automation

    Creating Your First Ansible Playbook: A Practical Lab Guide

    By Danilo ChiacchioSeptember 10, 202610 Mins Read
    Linux & Automation

    Linux Commands to Investigate High Disk Partition Usage

    By Danilo ChiacchioSeptember 9, 20267 Mins Read
    Latest Posts

    How to Resize ext4 and XFS Filesystems on RHEL 8

    September 14, 2026

    How to Install VMware PowerCLI Offline (VCF PowerCLI)

    September 14, 2026

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    September 11, 2026
    Images from Gallery
    hpc main commands
    linux commands
    install rock linux
    lustre fs
    shell scripting
    vSAN Trace Files
    Categories
    • HPC & Slurm
    • Linux & Automation
    • VMware & Virtualization
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    Copyright © 2026, DPC Virtual Tips. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.

    We use cookies to improve your browsing experience, analyze website traffic, and display relevant advertising. You can accept all cookies or manage your preferences at any time.