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!

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

  1. 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

  2. how about if i don’t want to overwrite the notes, i want to add one word in the previous notes. can you help here?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.