Export VM notes

Welcome Forums General PowerShell Q&A Export VM notes

This topic contains 4 replies, has 2 voices, and was last updated by

 
Participant
4 years, 6 months ago.

  • Author
    Posts
  • #18728

    Participant
    Points: 0
    Rank: Member

    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
    }

    Thanks
    Andy

  • #18729

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Why wouldn't...

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

    Work?

  • #18731

    Participant
    Points: 0
    Rank: Member

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

  • #18732

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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.

  • #18733

    Participant
    Points: 0
    Rank: Member

    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.

    Thanks
    Andy

The topic ‘Export VM notes’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort