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

Setting custom properties to add useful context to your virtual machines


Building on the use case for the Get-VIEvent cmdlet, Alan Renouf of VMware's PowerCLI team has a useful script posted on his personal blog (refer to the See also section) that helps you pull the created date and the user who created a virtual machine and populate this into a custom attribute. This is a great use for a custom attribute on virtual machines and makes some useful information available that is not normally visible.

This is a process that needs to be run often to pick up details for virtual machines that have been created. Rather than looking specifically at a VM and trying to go back and find its creation date as Alan's script does, in this recipe, you will take a different approach building on the previous recipe and populate the information from the found creation events. Maintenance in this form would be easier by finding creation events for the last week, running the script weekly, and updating the VMs...