Book Image

PowerCLI Cookbook

By : Philip Brandon Sellers
Book Image

PowerCLI Cookbook

By: Philip Brandon Sellers

Overview of this book

Table of Contents (19 chapters)
PowerCLI Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Getting a list of snapshots in the environment


Now that you've created a bunch of snapshots in your environment, it is time to keep track of them. Creating a list of snapshots is extremely easy. This recipe will cover how to get that list and perform basic manipulation for reporting on your snapshots.

Getting Started

To begin this recipe, you will need a PowerCLI window and an active connection to the vCenter host. You will also need to have VMs with snapshots, either created as in the previous recipe or created by some other method.

How to do it…

In order to get the created list of snapshots and perform basic manipulation for reporting on these snapshots, perform the following steps:

  1. The logical cmdlet to retrieve a list of snapshot objects is the Get-Snapshot cmdlet. You can assume that you can run it with no parameters, such as Get-VM, and return a list of all the snapshots in the environment. If you execute the following cmdlet on its own, you get an error:

    Get-Snapshot
    
  2. The error states that...