Advertisement Header

Monday 24 January 2011

PowerCLI: Add Notes To Multiple VM’s

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!

Additional Info:
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