Home > vmware, vsphere > Import-Export VM notes with PowerCLI

Import-Export VM notes with PowerCLI

In a previous post I blogged about exporting and importing custom attributes, but sometimes you need to do the same also for notes.

A little PowerCLI and all is done quickly.


Just connect to our source vCenter, export all notes and disconnect:

Connect-VIserver -server VCsource.vlab.local
$vmList = Get-VM
$noteList = @()
foreach ($vm in $vmList) {
$row = “” | Select Name, Notes
$row.name = $vm.Name
$row.Notes = $vm | select Notes
$notelist += $row
$noteList | Export-Csv “.\exported-notes.csv” –NoTypeInformation

Disconnect-VIServer “*” -Confirm:$False



And now lets import all notes:

Connect-VIserver -server VCdest.vlab.local

$noteList = Import-Csv “.\exported-notes.csv”
foreach($nLine in $noteList){
if ( $nLine.Notes -ne “”){
Set-VM -VM $nLine.Name -Notes $nLine.Notes -Confirm:$false

Disconnect-VIServer “*” -Confirm:$False

Categories: vmware, vsphere Tags: ,
  1. JakeNBake
    24 Sep 2015 at 20:33

    you could do also do it with a single line using the pipeline:

    get-vm | select name,notes | Export-Csv C:\temp\test.csv -Force -NoTypeInformation

  1. No trackbacks yet.

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

%d bloggers like this: