Monday, February 2, 2026
HomeVMwareWhat are Basic VMware PowerCLI Commands

What are Basic VMware PowerCLI Commands

Let’s take a look at what are basic VMware PowerCLI commands including connecting, PowerCLI commandlets, and looping. Previously, we have looked at VMware PowerCLI and how to download and install PowerCLI and integrate it into Windows Powershell ISE.

Basic VMware PowerCLI Commands

Let’s have a look at some basic PowerCLI commands to see how easy it is to initiate traction information from the vSphere environment with PowerCLI. Please bear in mind, the below commands in no way meant to be an all-embracing guide, but rather an introduction to VMware PowerCLI and how to get started running commands and learning to automate your environment.

The basic commands we need to run is the one to actually connect to the vSphere environment. You can either connect directly to vCenter Server or to an ESXi Host.
To connect, run the command below in a PowerCLI-enabled PowerShell session.

To Connect ESXi with PowerCLI

Connect-VIServer –Server [Name or FQDN]

When you run the command, you will be received your login credentials.

Basic VMware PowerCLI commands

Enter the username and password for either your vCenter Server or ESXi Host.

Specify server credentials PowerCLI

ESXi host successfully connected.

Connect-VIServer PowerCLI command

We use the get-vm command to get information about the guest VMs.

Get-VM
Get-VM VMware PowerCLI

Basic VMware PowerCLI Commands

To receive more information from the get-vm commandlet, we can show the complete information with the command.

Get-VM | fl

Displays more information such as the Operating System, VM Hardware version level, Resource pools, the folder it is located in, and many more.

Get-VM | fl VMware PowerCLI

Basic PowerCLI Scripting

Let’s find the virtual machines that are poweredoff. PowerShell commandlet.

Get-VM | where-object {$_.PowerState –eq “PoweredOff”}
Get VMs poweredoff state PowerCLI

How to Start VM using PowerCLI Command

As we can see, this displays only the virtual machines that are “PoweredOff”. This can be extremely helpful. Now follow the below commandlet to power on VMs.

Get-VM | where-object {$_.PowerState –eq “PoweredOff”} | Start-VM
VMware PowerCLI VM poweron command

Stop Guest VMs

How about shutting down VMs? We can do that by following the below command.

Get-VM 〈yourvm〉 | Stop-VMguest
Stop VMs VMware PowerCLI

If you don’t need to get the confirmation of the action, you can add the –confirm:false parameter

Confirm:false PowerCLI command

Let’s see how many VMs are running.

Get-VM | where-object {$_.NumCpu –gt 1}
Running VMs PowerCLI command

Related: How to Backup ESXi Configuration

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments