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

Creating rules to maintain memberships of DRS groups using a custom function


In this recipe, you will create a list of rules that leverage the Update-VmDrsGroup function that you created in the previous recipe in order to keep assignments up to date in a very dynamic environment. These rules can be defined and then set as a scheduled job in PowerShell to ensure that the assignments are up to date at all times, even if administrators move a virtual machine to a different location.

Getting ready

To begin this recipe, you will need a PowerCLI window and the function that you created in the previous recipe. You will also need an active connection to a vCenter Server. All of the cmdlets will update groups on the cluster, BigCluster. You will need to create five groups in the vCenter Client to use these rules and updates. Place the vCenter VM in each of the groups, since you cannot create an empty group. If the groups contain different members after writing the rules, the update worked successfully...