Book Image

PowerCLI Essentials

By : Chris Halverson
Book Image

PowerCLI Essentials

By: Chris Halverson

Overview of this book

Have you ever wished you could automatically get a report with all the relevant information about your VMware environments in exactly the format you want? Or that you could automate a crucial task that needs to be performed on a regular basis? Powerful Command Line Interface (PowerCLI) scripts do all these things and much more for VMware environments. PowerCLI is a command-line interface tool used to automate VMware vSphere environments. It is used to handle complicated administration tasks through use of various cmdlets and scripts, which are designed to handle certain aspects of VSphere servers and to help you manage them. This book will show you the intricacies of PowerCLI through real-life examples so that you can discover the art of PowerCLI scripting. At the start, you will be taught to download and install PowerCLI and will learn about the different versions of it. Moving further, you will be introduced to the GUI of PowerCLI and will find out how to develop single line scripts to duplicate running tasks, produce simple reports, and simplify administration. Next, you will learn about the methods available to get information remotely. Towards the end, you will be taught to set up orchestrator and build workflows in PowerShell with update manager and SRM scripts.
Table of Contents (13 chapters)
PowerCLI Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Running remote on a Linux guest


Attempting to cross platforms is always difficult and this type of crossing is also hard in PowerShell. Considering that PoSH does not run on Linux (for obvious reasons), there has to be a medium that pushes alternate programming languages to the VM.

This has to be done through one of two methods. The first method is Invoke-VMScript, in which a PowerCLI command talks to the VMTools of the VM and launches a script block that the VM can understand through the VMTools. It is much harder than it would appear on the surface. The second method is by launching an SSH connection and running the command as if the administrator is plunking away on the keyboard. It is a little easier to support and is more secure than the first method.

Basic BASH

A basic BASH script consists of components similar to a batch or PowerShell script, using a definition of the language and a list of commands in order to perform the function. Typical Linux BASH is used for navigating around the...