Getting started with PowerCLI

PowerCLI is an extension to Microsoft PowerShell which allows VMware administrators to automate tasks in their VMware environment. This article is a very brief guide to getting started with PowerCLI. 

1. Download and install a recent version of Powershell

It might already be installed on your machine but if not download and install the most recent version from the Microsoft PowerShell website.

2. Run PowerShell and install VMware PowerCLI

Start PowerShell from the start menu and install the VMware PowerCLI software. The easiest way to do this is by using the following command:

Install-Module VMware.PowerCLI

This will download the software and add it to your PowerShell environment. If that doesn't work other installation procedures are documented on the Broadcom PowerCLI website.

3. Connect to your vCenter Server

With the following command you can connect to your vCenter Server:

Connect-VIServer <servername>

The commmand will prompt you for the username and password. If you are using a test- or labenvironment with a self-signed certificate then you can ignore certificate errors with this command:

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore 

4. Run your first command

Once connected to your vCenter Server you can execute commands such as this one:

Get-VM

This will list all virtual machines in your environment. For all commands and everything else related to PowerCLI access the VMware PowerCLI Documentation.

Other useful resources for using PowerCLI are:

 

 

Tags
Getting Started Tags