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

Writing the script


Writing a script should be straightforward and to the point. There needs to be a purpose, a breakdown of what inputs are needed, what outputs are needed, and who needs to run it. In most cases, this can be done on the fly as each line is typed, but it still is a methodized approach. This section deals with the mentality of writing a command, how to approach it, and planning the writing of it. As the IT Administration field looks more and more to DevOps frameworks, the more important building a process on how to do it becomes.

Planning the purpose

The basics of planning are to set the final expectations before beginning any typing.

Let's start with the example shown in the introduction of Chapter 1, An Introduction to Essential Administration with PowerCLI, where the boss needs a report of configuration data for a C-level individual in your company. What would a C-level be interested in seeing? Would it be CPU utilization and storage performance? Probably not—but will probably...