Learning PowerCLI


Learning PowerCLI
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Automate your VMware vSphere environment including hosts, clusters, storage, and vCenter Server virtual machines and networks
  • Create good-looking, clean reports in no time, increasing your efficiency
  • Get to grips with PowerCLI to automate routine tasks using practical examples

Book Details

Language : English
Paperback : 374 pages [ 235mm x 191mm ]
Release Date : February 2014
ISBN : 1782170162
ISBN 13 : 9781782170167
Author(s) : Robert van den Nieuwendijk
Topics and Technologies : All Books, Virtualization and Cloud, Enterprise


Table of Contents

Preface
Chapter 1: Introduction to PowerCLI
Chapter 2: Learning Basic PowerCLI Concepts
Chapter 3: Working with Objects in PowerShell
Chapter 4: Managing vSphere Hosts with PowerCLI
Chapter 5: Managing Virtual Machines with PowerCLI
Chapter 6: Managing Virtual Networks with PowerCLI
Chapter 7: Managing Storage with PowerCLI
Chapter 8: Managing High Availability and Clustering with PowerCLI
Chapter 9: Managing vCenter with PowerCLI
Chapter 10: Reporting with PowerCLI
Index
  • Chapter 1: Introduction to PowerCLI
    • Downloading and installing PowerCLI
      • Downloading PowerCLI
      • Installing PowerCLI
    • Modifying the PowerShell execution policy
    • Connecting and disconnecting servers
      • Connecting to a server
      • Connecting to multiple servers
      • Suppressing certificate warnings
      • Disconnecting from a server
      • Retrieving the PowerCLI configuration
    • Using the credential store
    • Retrieving a list of all of your virtual machines
      • Suppressing displaying deprecated warnings
      • Using wildcard characters
      • Filtering objects
      • Using comparison operators
      • Using aliases
    • Retrieving a list of all of your hosts
      • Displaying the output in a grid view
    • Summary
  • Chapter 2: Learning Basic PowerCLI Concepts
    • Using the Get-Command, Get-Help, and Get-Member cmdlets
      • Using Get-Command
      • Using Get-VICommand
      • Using Get-Help
      • Using Get-PowerCLIHelp
      • Using Get-PowerCLICommunity
      • Using Get-Member
    • Using providers and PSDrives
      • Using providers
      • Using PSDrives
      • Using the vSphere PowerCLI Inventory Provider
      • Using the vSphere PowerCLI Datastore Provider
      • Copying files between a datastore and your PC
    • Using arrays and hash tables
    • Creating calculated properties
    • Using raw API objects with ExtensionData or Get-View
      • Using the ExtensionData property
      • Using the Get-View cmdlet
      • Using Managed Object References
      • Using the Get-VIObjectByVIView cmdlet
    • Extending PowerCLI objects with the New-VIProperty cmdlet
    • Working with vSphere folders
    • Summary
  • Chapter 3: Working with Objects in PowerShell
    • Using objects, properties, and methods
      • Using methods
    • Expanding variables and subexpressions in strings
      • Understanding what expands a string
      • Expanding a string when it is used
    • Using here-strings
    • Using the pipeline
      • Using the ByValue parameter binding
      • Using the ByPropertyName parameter binding
    • Using the PowerShell object cmdlets
      • Using the Select-Object cmdlet
      • Using the Where-Object cmdlet
      • Using the ForEach-Object cmdlet
      • Using the Sort-Object cmdlet
      • Using the Measure-Object cmdlet
        • Rounding a value
      • Using the Group-Object cmdlet
      • Using the Compare-Object cmdlet
      • Using the Tee-Object cmdlet
    • Creating your own objects
      • Using the New-Object cmdlet
      • Using a hash table to create an object
      • Creating objects using the Select-Object cmdlet
      • Adding properties to an object with Add-Member
      • Using type declarations
    • Using COM objects
    • Summary
  • Chapter 4: Managing vSphere Hosts with PowerCLI
    • Adding a host to a VMware vCenter Server
      • Creating a datacenter
      • Creating a cluster
      • Adding a host
    • Enabling and disabling maintenance mode
    • Working with host profiles
      • Creating a host profile
      • Attaching the host profile to a cluster or a host
      • Testing the host profile for compliance
      • Applying a host profile to a host or cluster
      • Using host profile answer files
      • Exporting a host profile
      • Importing a host profile
    • Working with host services
      • Retrieving information about host services
      • Starting a host service
      • Stopping a host service
      • Restarting a host service
      • Modifying the startup policy of a host service
    • Configuring the host firewall
      • Getting the host firewall default policy
      • Modifying the host firewall default policy
      • Getting the host firewall exceptions
      • Modifying a host firewall exception
    • Configuring vSphere Image Builder and Auto Deploy
      • Configuring Image Builder
      • Configuring Auto Deploy
    • Using esxcli from PowerCLI
      • Listing all of the available esxcli commands
    • Using the vSphere CLI commands from PowerCLI
    • Removing a host from the VMware vCenter Server
    • Summary
  • Chapter 5: Managing Virtual Machines with PowerCLI
    • Creating a virtual machine
      • Creating a virtual machine from scratch
      • Creating a virtual machine from a template
      • Cloning a virtual machine
    • Registering a virtual machine
    • Using OS customization specifications
    • Starting and stopping a virtual machine
      • Starting a virtual machine
      • Suspending a virtual machine
      • Shutting down a virtual machine's guest operating system
      • Stopping a virtual machine
    • Modifying the settings of a virtual machine
      • Using the VMware vSphere API
      • Adding devices to a virtual machine
        • Adding a hard disk
        • Adding a SCSI controller
        • Adding a network adapter
        • Adding a floppy drive
        • Adding a CD drive
      • Modifying devices added to a virtual machine
        • Modifying a hard disk
        • Modifying a SCSI controller
        • Modifying a network adapter
        • Modifying a floppy drive
        • Modifying a CD drive
      • Removing devices from a virtual machine
        • Removing a hard disk
        • Removing a network adapter
        • Removing a floppy drive
        • Removing a CD drive
    • Converting a virtual machine into a template
      • Converting a template into a virtual machine
      • Modifying the name of a template
      • Removing a template
    • Moving a virtual machine to another folder, host, cluster, resource pool, or datastore
    • Updating the VMware Tools
      • Using the Update-Tools cmdlet
      • Enabling the "Check and upgrade VMware Tools before each power on" checkbox
    • Upgrading virtual machine compatibility
    • Using snapshots
      • Creating snapshots
      • Retrieving snapshots
      • Reverting to a snapshot
      • Modifying snapshots
      • Removing snapshots
    • Running commands on the guest OS
    • Configuring Fault Tolerance
      • Turning Fault Tolerance on
      • Turning Fault Tolerance off
    • Opening the console of a virtual machine
    • Removing a virtual machine
    • Summary
  • Chapter 6: Managing Virtual Networks with PowerCLI
    • Using vSphere Standard Switches
      • Creating vSphere Standard Switches
      • Configuring vSphere Standard Switches
      • Adding network adapters to a switch
      • Removing vSphere Standard Switches
    • Using host network adapters
      • Creating host network adapters
      • Retrieving host network adapters
      • Configuring host network adapters
        • Configuring network speed and the duplex setting
        • Configuring the management network
        • Configuring vMotion
      • Removing host network adapters
      • Configuring NIC Teaming
    • Using standard port groups
      • Creating standard port groups
      • Configuring standard port groups
      • Removing standard port groups
    • Using vSphere Distributed Switches
      • Creating vSphere Distributed Switches
        • Creating a new vSphere Distributed Switch from scratch
        • Cloning a vSphere Distributed Switch
        • Creating a vSphere Distributed Switch from an export
      • Retrieving vSphere Distributed Switches
      • Configuring vSphere Distributed Switches
        • Rolling back the configuration of a vSphere Distributed Switch
        • Importing the configuration of a vSphere Distributed Switch from a backup
        • Upgrading a vSphere Distributed Switch
      • Adding hosts to vSphere Distributed Switches
      • Adding host physical network adapters to a vSphere Distributed Switch
      • Removing host physical network adapters from a vSphere Distributed Switch
      • Removing hosts from a vSphere Distributed Switch
      • Exporting the configuration of vSphere Distributed Switches
    • Removing vSphere Distributed Switches
    • Using distributed virtual port groups
      • Creating distributed virtual port groups
        • Creating distributed virtual port groups from a reference group
        • Creating distributed virtual port groups from an export
      • Configuring distributed virtual port groups
        • Renaming a distributed virtual port group
        • Rolling back the configuration of a distributed virtual port group
        • Restoring the configuration of a distributed virtual port group
      • Configuring Network I/O Control
        • Enabling Network I/O Control
        • Disabling Network I/O Control
      • Exporting the configuration of distributed virtual port groups
      • Migrating a host network adapter from a standard port group to a distributed port group
      • Removing distributed virtual port groups
    • Configuring host networking
    • Configuring the network of a virtual machine
    • Summary
  • Chapter 7: Managing Storage with PowerCLI
    • Rescanning for new storage devices
    • Creating datastores
      • Creating NFS datastores
      • Getting SCSI LUNs
      • Creating VMFS datastores
        • Creating software iSCSI VMFS datastores
    • Retrieving datastores
    • Setting the multipathing policy
    • Configuring the vmhba paths to a SCSI device
      • Retrieving the vmhba paths to a SCSI device
      • Modifying the vmhba paths to a SCSI device
    • Working with Raw Device Mappings
    • Configuring Storage I/O Control
      • Retrieving Storage I/O Control settings
    • Configuring Storage DRS
      • Creating a Datastore Cluster
      • Retrieving Datastore Clusters
      • Modifying Datastore Clusters
      • Adding datastores to a Datastore Cluster
      • Retrieving the datastores in a Datastore Cluster
      • Removing datastores from a Datastore Cluster
      • Removing Datastore Clusters
    • Upgrading datastores to VMFS-5
    • Removing datastores
    • Summary
  • Chapter 8: Managing High Availability and Clustering with PowerCLI
    • Creating vSphere HA and DRS clusters
    • Retrieving clusters
      • Retrieving the HA master or primary hosts
      • Retrieving cluster configuration issues
    • Modifying cluster settings
      • Disabling HA
      • Disabling or enabling host monitoring
      • Associating a host profile with a cluster
      • Enabling VM and application monitoring
      • Configuring the heartbeat datastore selection policy
    • Moving hosts to clusters
    • Moving clusters
    • Using DRS rules
      • Creating VM-VM DRS rules
      • Creating VM-Host DRS rules
        • Creating virtual machines DRS groups
        • Creating hosts DRS groups
        • Retrieving DRS groups
        • Modifying DRS groups
        • Removing DRS groups
        • Creating virtual machines to hosts DRS rules
      • Retrieving DRS rules
      • Modifying DRS rules
      • Removing DRS rules
    • Using DRS recommendations
    • Using resource pools
      • Creating resource pools
      • Retrieving resource pools
      • Modifying resource pools
      • Moving resource pools
      • Configuring resource allocation between virtual machines
      • Removing resource pools
    • Using Distributed Power Management (DPM)
      • Enabling DPM
      • Configuring hosts for DPM
      • Testing hosts for DPM
        • Putting hosts in standby mode
        • Starting hosts
      • Retrieving the DPM configuration of a cluster
      • Disabling DPM
    • Removing clusters
    • Summary
  • Chapter 9: Managing vCenter with PowerCLI
    • Working with roles and permissions
      • Retrieving privileges
      • Using roles
        • Creating roles
        • Retrieving roles
        • Modifying roles
        • Removing roles
      • Using permissions
        • Creating permissions
        • Retrieving permissions
        • Modifying permissions
        • Removing permissions
    • Managing licenses
      • Adding license keys to the license inventory
      • Retrieving license keys from the license inventory
      • Removing license keys from the license inventory
      • Assigning licenses to hosts
      • Retrieving assigned licenses
      • Removing assigned license keys from hosts
      • Using the LicenseDataManager
        • Associating license keys with host containers
        • Applying the associated license key to all the hosts in the container
        • Retrieving license key associations
        • Modifying license key associations
        • Removing license key associations
    • Configuring alarms
      • Retrieving alarm definitions
      • Modifying alarm definitions
      • Creating alarm actions
        • Configuring the vCenter Server mail server and sender settings
      • Retrieving alarm actions
      • Removing alarm actions
      • Creating alarm action triggers
      • Retrieving alarm action triggers
      • Removing alarm action triggers
    • Retrieving events
    • Summary
  • Chapter 10: Reporting with PowerCLI
    • Retrieving log files
    • Creating log bundles
    • Performance reporting
      • Retrieving the statistical intervals
      • Retrieving performance statistics
      • Retrieving metric IDs
    • 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

Robert van den Nieuwendijk

Robert van den Nieuwendijk is an IT veteran from the Netherlands with over 25 years of experience in the IT industry. He holds a bachelor's degree in Software Engineering. After working for a few years as a programmer of air traffic control and vessel traffic management systems for a company that is now called HITT, he started his own company Van den Nieuwendijk Informatica in 1988. Since then he has worked as a freelance systems administrator for OpenVMS, Windows Server, Linux, and VMware vSphere systems, mainly for Dutch governmental organizations. Currently, he is a VMware vSphere administrator at Wageningen UR (University and  Research centre). During winter, he is also a ski and snowboard instructor at an indoor ski school.

With his background as a programmer, he always tries to make his job easier by writing programs or scripts to perform repetitive tasks. In the past, he used the C programming language, OpenVMS DCL, Visual Basic Script, and KiXtart to do this. Since Windows PowerShell 1.0, he uses Windows PowerShell and VMware vSphere PowerCLI for all of his scripting work.

Robert is a member of the Dutch VMware User group (VMUG) Customer Council and a frequent contributor and moderator at the VMware VMTN Communities. In 2012 and 2013, VMware awarded him the vExpert title for his "significant contributions to the community and a willingness to share his expertise with others".

He has his own blog at http://rvdnieuwendijk.com where he has shared his knowledge since 2011. He writes mainly about VMware vSphere PowerCLI, Windows PowerShell, and VMware vSphere.

If you want to get in touch with Robert, you can find him on Twitter. His username is  @rvdnieuwendijk.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 2 submitted: last submission 14 Feb 2014

Errata type: Code | Page number: 196

In the last command-line output:

VirtualSwitch ActiveNic StandbyNic UnusedNic FailbackEnabled NotifySw

Should be:

VirtualSwitch ActiveNic StandbyNic UnusedNic FailbackEnabled NotifySwitches

Errata type: Code | Page number: 197

In the first command-line output:

VirtualPortGroup            ActiveNic   StandbyNic    UnusedNic   FailbackEnabled  Not

Should be:

VirtualPortGroup            ActiveNic   StandbyNic    UnusedNic   FailbackEnabled  NotifySwitches

 

 

And:

Management  Network   {vmnic0}                                                      True                  Tru

Should be:

Management  Network   {vmnic0}                                                      True                 True



Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Learning PowerCLI +    Alfresco 3 Enterprise Content Management Implementation =
50% Off
the second eBook
Price for both: €32.24

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Download and install PowerCLI
  • Add hosts to VMware vCenter Server
  • Configure vSphere Auto Deploy
  • Use the esxcli command from PowerCLI
  • Create OS Customization Specs
  • Monitor virtual machine performance
  • Configure distributed virtual switches and storage I/O Control
  • Enable VM and Application Monitoring
  • Manage licenses for multiple hosts to migrate them easily
  • Configure an alarm to monitor your networks virtual machines
  • Generate a good-looking HTML report in no time

In Detail

VMware vSphere PowerCLI is a powerful command-line tool to automate all aspects of a VMware vSphere environment. PowerCLI is built on top of the popular Windows PowerShell, with which you can automate server tasks and reduce manual input, allowing you to focus on more important tasks.

"Learning PowerCLI" is a practical, hands-on guide that provides you with a thorough knowledge of VMware vSphere PowerCLI. This knowledge will help you to automate your routine tasks so you can save valuable time.

"Learning PowerCLI" introduces you to VMware vSphere PowerCLI, from downloading and installing the software to creating good-looking reports of your VMware vSphere environment.

You will learn about working with host profiles, configuring virtual switches, removing snapshots, configuring Storage DRS, working with affinity rules, configuring an alarm, and managing roles and permissions. You will learn everything you need to know to get started with automating your VMware vSphere infrastructure. All the examples in Learning PowerCLI can be used directly in your environment.

Approach

"Learning PowerCLI" is written in a friendly and practical style with a focus on getting you started and automating daily tasks quickly and efficiently. If you manage or administrate a vSphere environment, and want to make that easier and more efficient, then this book is for you!

Who this book is for

This book is ideal for you if you want to learn how to automate your VMware vSphere infrastructure, by getting the most out of PowerCLI. It’s assumed that you have some experience in administrating a VMware vSphere environment. Knowledge of Microsoft’s Windows PowerShell is not a prerequisite.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software