PowerCLI: Add Notes To Multiple VM’s


image

My colleague asked me to add some notes to the VM’s so he knows what this VM is doing. So this is a nice job for PowerCLI 🙂 . In this post you will see how powerful PowerCLI /Powershell is.  With only one line of code (one-liner),  you are able to achieve this job.

First you have to create a CSV file with the following entry’s:

VMName,Note
VM1,Domain Controller
VM2,Database Server

The second step is to run this one-liner. The one-liner will add the Notes:

Import-Csv "D:\*.csv" | % { Set-VM $_.VMName -Description $_.Note -Confirm:$false}

When the one-liner is ready, you will find the Notes in the vSphere Client:

image

Note: This script will overwrite the existing Notes, so use it at your own risk!

Advertisements

2 thoughts on “PowerCLI: Add Notes To Multiple VM’s

  1. vmdoug

    DISCLAIMER: I work for Veeam

    If you don’t want to mess with PowerShell or mess up your Notes field you can also use Veeam Business View (free) to set custom attributes on the VM’s. Once the attributes are set, you can then add the columns to the Virtual Infrastructure Client and use them to sort. You can do the same thing with PowerShell but Business View also allows you to set rules for auto categorization and provides a dashboard web interface to manage all the attributes. Check it out here -> http://www.veeam.com/vmware-business-view.html

    Reply
  2. Pingback: PowerCLI: Set Custom Fields « ICT-Freak.nl

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s