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

Locating and reloading inaccessible or invalid virtual machines


Since virtual machines are nothing more than a group of files that define a computer, sometimes an ESXi host or vCenter might lose communication with a filesystem or datastore where the virtual machine files are stored. In that event, the VM can be labeled as inaccessible or invalid inside vCenter. One way to solve this is to unregister and reregister the virtual machine's VMX file to vCenter or the ESXi host.

When you have many of these inaccessible or invalid VMs, like after a storage outage, it can become a tedious process to cleanup. PowerCLI can offer an easy and quick way to provide a remedy for this situation. In this recipe, we'll explore how to locate and identify inaccessible or invalid virtual machines and how to automatically reregister them to fix the problem.

This recipe is available online and is a good use case that will help you understand the use of View objects in PowerCLI. Many of the View objects in PowerCLI...