VMware Cloud Community
vmkarthik
Enthusiast
Enthusiast

Export details of VM's from vCenter

Hi,

Is there any way or tool to export the information about the VM's from v Center server?

In the Datacenter under Virtual Machines tab we get to see the details of Virtual machine like Ip, on which host it is powered On, Memory, CPU Count etc. I need these info to be exported.

Any help?

Reply
0 Kudos
5 Replies
RvdNieuwendijk
Leadership
Leadership

With PowerCLI you can export all the information about virtual machines. Something like:

Connect-VIServer YourVIServerName
Get-VM | `
  ForEach-Object {
    $Report = "" | Select-Object -property Name,NumCpu,MemoryMB,Host,IPAddress
    $Report.Name = $_.Name
    $Report.NumCpu = $_.NumCpu
    $Report.MemoryMB = $_.MemoryMB
    $Report.Host = $_.Host
    $Report.IPAddress = ($_ | Get-VMGuest).IPAddress
  Write-Output $Report
  }

You can easily extend this script to get more information. If you have any questions about PowerCLI you can go to the VMware vSphere™ PowerCLI Community.

Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
maxel
Enthusiast
Enthusiast

Reply
0 Kudos
vmkarthik
Enthusiast
Enthusiast

Hi,

The script when it run output the name,cpu,mem, host and Ip but when I try to export the IP alone doesnt get exported....

below is the script that i ran...

Get-VM | `

ForEach-Object {

$Report = "" | Select-Object -property Name,NumCpu,MemoryMB,Host,IPAddress

$Report.Name = $_.Name

$Report.NumCpu = $_.NumCpu

$Report.MemoryMB = $_.MemoryMB

$Report.Host = $_.Host

$Report.IPAddress = ($_ | Get-VMGuest).IPAddress

Write-Output $Report

} | Export-Csv "C:\VM.csv"

karthik

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

I changed the script a little bit. Now it returns the IP address also:

Get-VM | `
  ForEach-Object {
    $Report = "" | Select-Object -property Name,NumCpu,MemoryMB,Host,IPAddress
    $Report.Name = $_.Name
    $Report.NumCpu = $_.NumCpu
    $Report.MemoryMB = $_.MemoryMB
    $Report.Host = $_.Host
    $Report.IPAddress = $_.Guest.IPAddress
  Write-Output $Report
  } | Export-Csv "C:\VM.csv"

Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
vmroyale
Immortal
Immortal

Hello.

In the vSphere client, connect to the vCenter server. Select the Datacenter, Cluster or Host with the virtual machines you want in it. Click the "Virtual Machines" tab. Right-click any column to select the viewable columns. When you have all the information you want, go to File -> Export -> Export List and save it.

Good Luck!

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
Reply
0 Kudos