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

Learning the MoRef way of identifying objects


A MoRef is a unique identifier in the vSphere platform for every individual object. Even two objects of the same type and the same name have different MoRef identifiers. Because vSphere builds relationships based on MoRefs, you can easily rename objects, such as virtual machines or resource pools, without affecting memberships and associations.

While this recipe might seem like a bit of a tangent, it is a necessary one before moving on to building VM and Host Groups for VM to Host affinity rules. These rules do not have native PowerCLI cmdlets to manage them; therefore, you need to use object views and methods to create these configurations and those require MoRefs.

You have encountered MoRefs in other recipes throughout the book, such as the Setting Storage DRS automation levels for individual virtual machines recipe in Chapter 4, Working with Datastores and Datastore Clusters, and the Getting alerts from vSphere environment recipe in Chapter...