PacktLib: Learning PowerCLI

Learning PowerCLI

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Introduction to PowerCLI

Downloading and installing PowerCLI

Modifying the PowerShell execution policy

Connecting and disconnecting servers

Using the credential store

Retrieving a list of all of your virtual machines

Retrieving a list of all of your hosts

Summary

Learning Basic PowerCLI Concepts

Using the Get-Command, Get-Help, and Get-Member cmdlets

Using providers and PSDrives

Using arrays and hash tables

Creating calculated properties

Using raw API objects with ExtensionData or Get-View

Extending PowerCLI objects with the New-VIProperty cmdlet

Working with vSphere folders

Summary

Working with Objects in PowerShell

Using objects, properties, and methods

Expanding variables and subexpressions in strings

Using here-strings

Using the pipeline

Using the PowerShell object cmdlets

Creating your own objects

Using COM objects

Summary

Managing vSphere Hosts with PowerCLI

Adding a host to a VMware vCenter Server

Enabling and disabling maintenance mode

Working with host profiles

Working with host services

Configuring the host firewall

Configuring vSphere Image Builder and Auto Deploy

Using esxcli from PowerCLI

Using the vSphere CLI commands from PowerCLI

Removing a host from the VMware vCenter Server

Summary

Managing Virtual Machines with PowerCLI

Creating a virtual machine

Registering a virtual machine

Using OS customization specifications

Starting and stopping a virtual machine

Modifying the settings of a virtual machine

Converting a virtual machine into a template

Moving a virtual machine to another folder, host, cluster, resource pool, or datastore

Updating the VMware Tools

Upgrading virtual machine compatibility

Using snapshots

Running commands on the guest OS

Configuring Fault Tolerance

Opening the console of a virtual machine

Removing a virtual machine

Summary

Managing Virtual Networks with PowerCLI

Using vSphere Standard Switches

Using host network adapters

Using standard port groups

Using vSphere Distributed Switches

Removing vSphere Distributed Switches

Using distributed virtual port groups

Configuring host networking

Configuring the network of a virtual machine

Summary

Managing Storage with PowerCLI

Rescanning for new storage devices

Creating datastores

Retrieving datastores

Setting the multipathing policy

Configuring the vmhba paths to a SCSI device

Working with Raw Device Mappings

Configuring Storage I/O Control

Configuring Storage DRS

Upgrading datastores to VMFS-5

Removing datastores

Summary

Managing High Availability and Clustering with PowerCLI

Creating vSphere HA and DRS clusters

Retrieving clusters

Modifying cluster settings

Moving hosts to clusters

Moving clusters

Using DRS rules

Using DRS recommendations

Using resource pools

Using Distributed Power Management (DPM)

Removing clusters

Summary

Managing vCenter with PowerCLI

Working with roles and permissions

Managing licenses

Configuring alarms

Retrieving events

Summary

Reporting with PowerCLI

Retrieving log files

Creating log bundles

Performance reporting

Exporting reports to CSV files

Generating HTML reports

Sending reports by e-mail

Reporting the health of your vSphere environment with vCheck

Using PowerGUI

Summary

Index