Updating Vcenter Annotations or Notes with PowerCLI

Vcenter allows you to add notes/comments into the Annotations field per individual VMs. This is very handy if you manage a large environment in which you need to descriptions about the VMs.

In this guide we’re trying to accomplish the following:
Add the following information in this Annotation field:

VM Owner: Requestor

Purpose of System: Purpose

Date Created: SystemDateCreation

Here’s a screenshot of my environment:

(Note: initially I exported the list of VM’s and uploaded them to a SharePoint site in which other system owners could update the Requestor and Purpose fields with accurate information about those systems).

Once the changes were made, I saved this list as Original.csv and created a script to compare that list to AD in order to get the Creation Date (This was one of the VMware Administrator requirements since Vmware purges the VMware creation value after some time)

The Original.csv file contains the following fields: VMName, Requestor, Purpose

NOTE: you need to install Vmware Vsphere POwerCLI 5.5 (or later) to be able to run the powerscript below; otherwise, it won’t work!

Additionally ensure that you have permission to update the Vmware information, otherwise this will fail.

On to the script!

Once you run this script, you should be able to see the following info:

When viewing the list of VMs in your environment, you should be able to see this info in the Notes field. It makes it easier to keep information related to the VM here.

That is all!


Leave a Reply