PowerCLI Cookbook

Book description

Over 75 step-by-step recipes to put PowerCLI into action for efficient administration of your virtual environment

In Detail

PowerCLI allows faster administration by executing tasks on groups of objects in the virtual environment and is flexible enough to allow complex, scripted routines to solve complex problems.

PowerCLI Cookbook illustrates the ease of performing repetitive tasks using native PowerCLI commands to speed up administration. This book teaches you how to create custom functions and modules to solve specific problems and deploy these solutions to operators. It covers all vSphere administration areas including host, cluster, and virtual machine management utilizing PowerCLI.

Finally, this book will enable administrators to execute scripts that will open new possibilities for automation and also enable them to manage VM workloads effectively.

What You Will Learn

  • Configure and administer VMware ESXi hosts, clusters, and vCenter
  • Manage virtual machine configurations and operations
  • Administer datastores, datastore clusters, and virtual machine snapshots
  • Create and configure virtual networking in a vSphere environment
  • Manage cluster features and affinity groups
  • Make custom reports and notifications from vSphere
  • Direct operations in vCloud Director

Table of contents

  1. PowerCLI Cookbook
    1. Table of Contents
    2. PowerCLI Cookbook
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
        3. Instant updates on new Packt books
    8. 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
    9. 1. Configuring the Basic Settings of an ESXi Host with PowerCLI
      1. Introduction
      2. Connecting to an ESXi host or a vCenter instance
        1. Getting ready
        2. How to do it...
        3. How it works…
        4. There's more…
        5. See also
      3. Getting the VMware host object
        1. Getting ready
        2. How to do it...
        3. How it works…
        4. There's more…
        5. See also
      4. Joining an ESXi host into Active Directory
        1. Getting ready
        2. How to do it...
        3. How it works…
        4. There's more…
        5. See also
      5. Enabling services and setting security profiles
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Setting network configuration
        1. Getting ready
        2. How to do it...
        3. How it works…
        4. There's more…
        5. See also
      7. Creating datastores on an ESXi host
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      8. Configuring syslog settings on an ESXi host
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      9. Joining an ESXi host to vCenter
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      10. Creating a configuration script to set all properties uniformly
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    10. 2. Configuring vCenter and Computing Clusters
      1. Introduction
      2. Creating a virtual datacenter in vCenter
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Creating a cluster and adding ESXi hosts
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Setting cluster advanced features, including HA, DRS, and EVC
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Setting up resource pools
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Setting up folders to organize objects in vCenter
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Setting permissions on vCenter objects
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
    11. 3. Managing Virtual Machines
      1. Introduction
      2. Deploying the first virtual machine
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Cloning a virtual machine to a template
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Deploying new virtual machines from a template
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Importing a virtual appliance from OVA
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Performing a hot add of virtual hardware to an existing virtual machine
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Enabling and disabling Fault Tolerance on a virtual machine
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. See also
      8. Increasing the disk space in a virtual machine
        1. Getting Started
        2. How to do it…
        3. How it works…
      9. Upgrading the virtual hardware version of a virtual machine
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. See also
      10. Locating and reloading inaccessible or invalid virtual machines
        1. Getting Started
        2. How to do it…
        3. How it works…
      11. Setting VMware Tool settings from PowerCLI
        1. Getting Started
        2. How to do it…
        3. How it works…
      12. Creating basic reports of VM properties using VMware Tools and PowerCLI
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    12. 4. Working with Datastores and Datastore Clusters
      1. Introduction
      2. Performing Storage vMotion
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Finding Raw Disk Mappings in your environment
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Locating thin or thick provisioned disks
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Converting thin to thick disks with Storage vMotion
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Creating and managing datastore clusters
        1. Getting ready
        2. How to do it…
        3. How it works…
      7. Setting Storage DRS automation levels for individual virtual machines
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      8. Setting Storage DRS automation levels for individual VMs using PowerCLI 6
        1. Getting ready
        2. How to do it…
        3. How it works…
    13. 5. Creating and Managing Snapshots
      1. Introduction
      2. Creating a snapshot
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Getting a list of snapshots in the environment
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Manipulating the list of snapshots to get better information
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also

      5. Scoping and filtering a list of snapshots
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Removing targeted snapshots
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Find lost or unknown snapshots
        1. Getting Started
        2. How to do it…
        3. How it works…
      8. Creating a function to automatically remediate snapshots
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Scheduling automatic snapshot remediation
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. See also
      10. Creating a snapshot management module
        1. Getting Started
        2. How to do it…
        3. How it works…
        4. There's more…
    14. 6. Managing Resource Pools, Reservations, and Limits for Virtual Machines
      1. Introduction
      2. Setting reservations and limits for resource pools
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Balancing share allocations on resource pools
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Creating a custom attribute with a number of shares per VM on each resource pool
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Automating share allocation balancing
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Reporting shares, reservations, and limits of resource pools and virtual machines
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    15. 7. Creating Custom Reports and Notifications for vSphere
      1. Introduction
      2. Getting alerts from a vSphere environment
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Basics of formatting output from PowerShell objects
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Sending output to CSV and HTML
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Reporting VM objects created during a predefined time period from VI Events object
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Setting custom properties to add useful context to your virtual machines
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Using PowerShell native capabilities to schedule scripts
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    16. 8. Performing ESXCLI and in-guest Commands from PowerCLI
      1. Introduction
      2. Retrieving the ESXCLI object in PowerCLI
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more...
      3. Using the ESXCLI vm namespace to kill a misbehaving VM
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Performing ESXi ping with an ESXCLI object
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Configuring custom storage and path selection policies
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Configuring coredump settings for an ESXi host from PowerCLI
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Executing native commands inside the guest operating system from PowerCLI
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    17. 9. Managing DRS and Affinity Groups using PowerCLI
      1. Introduction
      2. Applying recommendations for partially automated DRS clusters
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Setting a cluster into maintenance mode with PowerCLI
        1. Getting ready
        2. How to do it...
        3. There's more...
      4. Using native DRS rule cmdlets to manage KeepTogether and Separate rules
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Learning the MoRef way of identifying objects
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Creating a DRS group for virtual machines
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Listing the members of a DRS group
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Updating the members of a VM DRS group
        1. Getting ready
        2. How to do it…
        3. How it works…
      9. Creating a custom function to update members of a DRS group
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      10. Creating rules to maintain memberships of DRS groups using a custom function
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      11. Using Compare-Object to audit group memberships for differences
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    18. 10. Working with vCloud Director from PowerCLI
      1. Introduction
      2. Connecting to a vCloud environment
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Creating and managing organizations in vCloud
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Creating a new user in an organization using Views
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Creating an organization's virtual datacenter in vCloud Director
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Importing a vApp template into vCloud
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Configuring networking in a vCloud vApp
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Reassigning vApp VM network settings with PowerCLI
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      9. Starting and stopping vApps and individual VMs in a vCloud
        1. Getting ready
        2. How to do it…
        3. How it works…
    19. A. Setting up and Configuring vCloud Director
      1. The hosted vCloud environment
      2. Deploying the vCloud Director environment from AutoLab
      3. Build your own vCloud Director implementation on your vSphere lab environment
      4. Additional resources
    20. Index

Product information

  • Title: PowerCLI Cookbook
  • Author(s): Philip Sellers
  • Release date: March 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781784393724