Book Image

Learning PowerCLI - Second Edition

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI - Second Edition

By: Robert van den Nieuwendijk

Overview of this book

VMware vSphere PowerCLI, a free extension to Microsoft Windows PowerShell, enables you to automate the management of a VMware vSphere or vCloud environment. This book will show you how to automate your tasks and make your job easier. Starting with an introduction to the basics of PowerCLI, the book will teach you how to manage your vSphere and vCloud infrastructure from the command line. To help you manage a vSphere host overall, you will learn how to manage vSphere ESXi hosts, host profiles, host services, host firewall, and deploy and upgrade ESXi hosts using Image Builder and Auto Deploy. The next chapter will not only teach you how to create datastore and datastore clusters, but you’ll also work with profile-driven and policy-based storage to manage your storage. To create a disaster recovery solution and retrieve information from vRealize Operations, you will learn how to use Site Recovery Manager and vRealize Operations respectively. Towards the end, you’ll see how to use the REST APIs from PowerShell to manage NSX and vRealize Automation and create patch baselines, scan hosts against the baselines for missing patches, and re-mediate hosts. By the end of the book, you will be capable of using the best tool to automate the management and configuration of VMware vSphere.
Table of Contents (22 chapters)
Learning PowerCLI Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Downloading and installing PowerCLI


In this section, you will learn how to download and install PowerCLI 6.5 Release 1. First, we will list the requirements for PowerCLI 6.5 Release 1. After downloading PowerCLI from the VMware website, we will install PowerCLI on your system.

Requirements for using PowerCLI 6.5 Release 1

You can install VMware PowerCLI 6.5 Release 1, the version used for writing this book, on the following 64-bit operating systems:

  • Windows Server 2012 R2

  • Windows Server 2008 R2 Service Pack 1

  • Windows 10

  • Windows 8.1

  • Windows 7 Service Pack 1

VMware PowerCLI 6.5 Release 1 is compatible with the following PowerShell versions:

  • Microsoft PowerShell 3.0

  • Microsoft PowerShell 4.0

  • Microsoft PowerShell 5.0

  • Microsoft PowerShell 5.1

If you want to work with VMware PowerCLI 6.5 Release 1, make sure that the following software is present on your system:

  • Microsoft PowerShell 3.0, 4.0, 5.0, or 5.1

  • NET Framework 4.5, 4.5.x, 4.6, or 4.6.x

Downloading PowerCLI 6.5 Release 1

Before you can install PowerCLI, you have to download the PowerCLI installer from the VMware website. You will need a My VMware account to do this.

Perform the following steps to download PowerCLI:

  1. Visit http://www.vmware.com/go/powercli . On this page, you will find a Resources section.

  2. Click on the Download button to download PowerCLI.

  3. You have to log in with a My VMware account. If you don't have a My VMware account, you can register for free.

  4. After you log in, you will be taken to the VMware PowerCLI download page. Click on the Download Now button to start downloading PowerCLI.

Installing PowerCLI

Perform the following steps to install PowerCLI:

  1. Run the PowerCLI installer that you just downloaded.

  2. Click Yes in the User Account Control window to accept the Do you want to allow this app to make changes to your device? option.

  3. If the PowerShell execution policy on your computer is not set to RemoteSigned, you will get a warning that tells you It is recommended that you set the execution policy to "RemoteSigned" in order to be able to execute scripts. After the installation of PowerCLI, I will show you how to set the execution policy. Click on Continue to continue to the installation of PowerCLI.

  4. Click on Next > in the Welcome to the InstallShield Wizard for VMware PowerCLI window.

  5. Select I accept the terms in the license agreement and click on Next >.

  6. If you are not using vCloud Air, VMware vCloud Director, vSphere Update Manager, vRealize Operations Manager, or Horizon View, you can click on the little arrow to the left of a feature and select This feature will not be available. I recommend installing all of the features, to be able to run the scripts in all of the chapters in this book. If you want, you can change the installation directory by clicking on Change.... Click on Next >.

  7. Click on Install to begin the installation.

  8. Click on Finish to exit the installation wizard.

After installing PowerCLI, you will have a VMware PowerCLI icon on your desktop. If you installed PowerCLI on a 64-bit computer, you will also have a VMware PowerCLI (32-Bit) icon. Some PowerCLI commands only work in the 32-bit version of PowerCLI. So keep both versions.