You are previewing PowerCLI Essentials.
O'Reilly logo
PowerCLI Essentials

Book Description

Simplify and automate server administration tasks with PowerCLI

About This Book

  • Automate VMware’s VSphere environment by learning the essentials of PowerCLI

  • Impress your peers by developing scripts to perform administration tasks

  • Discover the intricate workings of PowerCLI through simple and real-life examples

  • Who This Book Is For

    PowerCLI Essentials is focused toward virtualization professionals and system administrators who want to discover and learn about the automation techniques associated with PowerCLI for complex virtual environments.

    What You Will Learn

  • Download and install PowerCLI and its basics as well as the basics of PowerShell

  • Enchance your scritping experience

  • Build longer scripts and simpler reports

  • Relate a task in VMware administration to a PowerCLI script

  • Discover methods to acquire and change information remotely

  • Set up orchestrator to manage your workflow

  • In Detail

    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.

    Style and approach

    Each and every topic in this book is explained in a very easy-to-follow fashion with real-life, simple examples so you’ll get an idea not only about working with PowerCLI, but will also get an idea about scripting.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. PowerCLI Essentials
      1. Table of Contents
      2. PowerCLI Essentials
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. An Introduction to Essential Administration with PowerCLI
        1. Why this book, and why now?
        2. Understanding PowerShell versions
          1. The basic structure of PowerShell
          2. Why is version understanding important?
          3. v2 or v3 – what's the difference?
          4. Installing PowerShell v3 on a Windows 7 or Windows 2008 R2 machine
        3. Understanding PowerCLI
          1. Getting PowerCLI versions
          2. The PowerCLI change log
          3. Getting PowerCLI
            1. Pre-requisites before getting PowerCLI
            2. Downloading PowerCLI
          4. Installing PowerCLI
          5. Getting help
          6. Setting up the PowerCLI installation
        4. Summary
      9. 2. Comparing Point and Click Administration to PowerCLI and Scripting
        1. Getting started
          1. Where do we begin?
        2. Where do we find scripts and snippets that are safe to run?
          1. VMware communities
          2. VMware blogs
          3. VMware flings
          4. PowerGUI
          5. Notepad++
          6. PowerShell Scriptomatic
          7. Microsoft TechNet Script Center
        3. Programming interfaces
        4. Writing the script
          1. Planning the purpose
          2. Thinking through a script
          3. Planning the output
          4. Making the script
          5. Final script
        5. Report-VMHostConfigStatus
          1. Starting with the inputs
          2. Getting the current configuration
          3. Output of data
          4. Getting the same information through PowerCLI
            1. Network
            2. Storage
            3. Output
          5. Final script of the report
        6. Summary
      10. 3. Enhancing the Scripting Experience
        1. Code repositories – why would I need that?
          1. Building an internal repository
          2. Using a third-party tool for code check-in and check-out
          3. Send it to the cloud! Publicly accessible script repositories
          4. Conclusions
        2. Scripting with the intention to reuse
          1. Functions, functions, functions – the fun with functions
          2. Example of a multifunctional script
          3. Using modules
          4. Calling other scripts within the script
          5. Example of a framework script
          6. Building a framework that others can build upon
          7. Running a workflow
        3. Quality control, consistency, and simplification
          1. Revisiting documentation
          2. Script simplification
          3. Error handling
          4. Verification testing
          5. Version control and keeping previous versions
          6. What signifies a major version versus a minor version
          7. Storing versions
        4. Building a VM script using all the pieces
        5. Summary
      11. 4. Windows Administration within VMware Administration
        1. What is DevOps?
          1. Starting a DevOps practice
          2. Defining the roles
          3. An example process
        2. Duties of the Automation Engineer
          1. Building the script
          2. Mixing PowerCLI and standard PowerShell
          3. Building a Windows script host
            1. Using commands to enable remote desktops on a Windows 2012 R2 server
          4. Running PowerCLI and Windows Administration
          5. A script example
          6. Thinking through the script
          7. Building the script
          8. Invoke-VMScript configuration
        3. Running remote on a Linux guest
          1. Basic BASH
          2. Invoke-VMScript configuration
        4. Introduction to vRealize Orchestrator
        5. Summary
      12. 5. Workflows and vRealize Orchestrator
        1. Workflows
          1. The beginning of a workflow
          2. The planning stage
          3. The design phase
          4. The implementation phase
          5. The testing phase
          6. Promotion or closeout
        2. vRealize Orchestrator
          1. Architecture and history
          2. Sample environment
          3. Where to get it?
          4. Prerequisites to installation
          5. Installation
          6. Installing the standalone instance
          7. Configuring and integration
        3. Summary
      13. 6. Running Workflows with Other VMware Products
        1. Orchestrating VMware products
        2. Orchestrating with Orchestrator
          1. Workflows
        3. Orchestrating the integration of NSX
          1. NSX conceptual overview
          2. PowerCLI and NSX
        4. Orchestrating the integration of Site Recovery Manager
          1. PowerCLI and SRM
          2. Running PowerShell scripts in a Recovery Plan
        5. Orchestrating the integration of Monitoring (vROps)
          1. Connecting to the vRealize Operations Manager
          2. PowerCLI and vROps
        6. Performance tools
        7. Orchestration of Storage (VSAN)
          1. VSAN and PowerCLI
        8. Summary
      14. Index