1 2 Previous Next 15 Replies Latest reply on Jun 13, 2008 4:14 AM by dmaster

    Create a custom report about virtual machines in virtual center with the VI Toolkit

    dmaster Expert
    VMware EmployeesvExpert


      Hello All,



      I am new to the VI Toolkit and try to get some help for the issue below ..



      I need to create a list off all my vm's in virtualcenter 2.5 with the vm name, memory limit and memory reservation + filter out the memory limit ones with a value of -1 (if possible save this to text file like "report.csv")



      How can you do this with the VI Toolkit?



      I managed to get output for only one of the rows, who can help me out ?






      ouput should look like



      virtualmachine name;memory limit; memory reservation 















      The code:



      $vmall = Get-VM *

      #Create a variable that contains all VM's names



      $vmview = $vmall | foreach-object { get-view $_.id }

      #Create a variable that contains the exposed configurable options for each of the VM's contained in the $vm variable



      $vmview | foreach-object { $_.resourceconfig.memoryallocation.limit }



      #Display the contents of one of the collums.



      output is now like












      tried things like, but i can't get it working yet..



      $vmview | foreach-object { $_.config.name $_.resourceconfig.memoryallocation.limit $_.resourceconfig.memoryallocation.reservation}



      and how to include saving output to a file and do the filtering part stays also a riddle ..



      Who can help me out ?



        1 2 Previous Next