How to Add Descriptions or Notes To Multiple VMs Using PowerCLI and CSV VMware- VirtuallyThatGuy

I had over 100 VMs to add descriptions or notes and then Move them to a folder so decided to write a one-liner for it. Hope it comes handy for someone looking to do similar task.

Import-Module vmware.vimautomation.core
#Get-Module -ListAvailable VMware* | Import-Module | Out-Null
Connect-VIServer uk3p-vc01.lab.local
Import-Csv "C:\scripts\VMNotes.csv" | % { Set-VM $_.VMName -Description $_.Notes -Confirm:$false}
## Now watch the magic happens 
 

Create a CSV similar to below

Connect to vCenter with enough privileges to add notes or description to existing VMs

Import-Module​​ vmware.vimautomation.core

#Get-Module -ListAvailable​​ VMware* | Import-Module | Out-Null

Connect-VIServer​​ uk3p-vc01.lab.local

Import-Csv​​ "C:\scripts\VMNotes.csv"​​ |​​ %​​ {​​ Set-VM​​ $_.VMName​​ -Description​​ $_.Notes​​ -Confirm:$false}

## Now watch the magic happens​​ 

​​ 

 

You May Also Like

About the Author: VirtuallyThatGuy

Leave a Reply

Your email address will not be published. Required fields are marked *