An Introduction to VMware PowerCLI

Spread The Knowledge

VMware PowerCLI is a command-line and scripting tool built on the top of Windows PowerShell and provides more than 700 cmdlets for managing and automating vSphere, vCloud Director, vRealize Operations Manager, vSAN, NSX-T, VMware Cloud Services, VMware Cloud on AWS, VMware HCX, VMware Site Recovery Manager, and VMware Horizon environments.

You can install VMware PowerCLI modules on all supported operating systems. PowerCLI is based on Microsoft PowerShell so uses the PowerShell basic syntax and concepts.

Microsoft PowerShell is both a command-line and scripting environment. It uses the .NET object model and provides administrators with system administration and automation capabilities.

Recently VMware has released PowerCLI 12.0. It comes with cool new features.

  • Added cmdlets for ESXi host network management
  • Added cmdlets for HCX management
  • Added cmdlets for Namespace Management
  • Added cmdlets for Trusted Host Services management
  • Added cmdlets for VM Guest Disk management
  • Added cmdlets for VMware Cloud on AWS management
  • Added cmdlets for vSAN management
  • New module for VMware Cloud Services management
  • Updated support for vSphere 7.0
  • Updated support for vRealize Operations 8.0
  • Updated support of the License module for multiplatform use
  • Updated support of the vROps module for multiplatform use
  • Updated support of Open-VMConsoleWindow for multiplatform use
  • Updated support of Move-VM to include opaque networks
  • Updated support for PowerShell versions

Installation Guide of PowerCLI

You can install PowerCLI on supported operating systems. You can run guest cmdlets against virtual machines on which supported guest operating systems are installed. But before installing you need to check the compatibility of your system.

Prerequisites

  • Before installing PowerCLI, see Prerequisites for Installing and Running PowerCLI.
  • Verify that you have uninstalled PowerCLI 6.5 R1 or earlier from your system.
  • Verify that your system is connected to the Internet.
  • Verify that you have registered the PowerShell Gallery as a local repository.
  • If you use Windows PowerShell 3.0 or 4.0, install the PowerShellGet and PackageManagement modules from the PowerShell Gallery Web site.

To download the package go to PowerShell site and follow the guidelines to install it.

Basic Syntax of PowerCLI

PowerShell cmdlets use a consistent verb-noun structure, where the verb represents the action and the noun represents the object to operate on. All command categories take parameters and arguments. A parameter starts with a hyphen(-) and is used to control the behavior of the command. An argument is a data value consumed by the command. You can see the basic command structure and an example below:

command -parameter1 -parameter2 argument1, argument2
Connect-VIServer -Server vc01.techyguy.com -Protocol http -User 'TechyGuy' -Password 'Password@123'

The above command helps you to log in to the vCenter server. Similarly, you can command to get the list of VMs, Hosts, Datastore, and so on.

Reference:

[Also read] Top VMware Interview Questions And Answers


Spread The Knowledge

Leave a Comment