Author Posts

September 11, 2014 at 6:58 am

Trying to export the name and notes attached to all Virtual Machines in a vcenter. Is there a more effecient way of doing this other than this:

$VM = get-vm
foreach($v in $vm){
get-vm $vm | select name, notes | export-csv c:\vm-notes.csv


September 11, 2014 at 7:02 am

Why wouldn't...

get-vm | select name, notes | export-csv c:\vm-notes.csv


September 11, 2014 at 7:32 am

Hi Don,
Well I tried that first but it would never finish running the script.
What I ended up doing and the only way I could get it to work without stalling on me was this:

Connect-VIServer vcenter01
Connect-VIServer vcenter1
$a = get-vm | select Name,Notes
$a | export-csv c:\vm-notes.csv

Not sure why it was stalling the other ways..

September 11, 2014 at 7:33 am

Me, either. It's something you'd probably get a better answer for in VMware's forums – there's a lot more folks there who understand how their cmdlets communicate with their server.

September 11, 2014 at 7:40 am

Most likely because I was connected to two VCenters, your line of code works fine when connected to a single vcenter. Thanks again Don, always enjoy your tutorials out on the web, keep up the good work.