Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm looking to generate an excel spreadsheet with various information about each one of my company's ~140 VMs residing on 7 ESX 3.5 servers - specifically, the VM's:

  • Name
  • Allocated Memory, Processors, Hard Drive
  • Average Memory, Processor utilization for a given time period
  • Maximum Memory, Processor utilization for a given time period

I know I can manually fill in a spread sheet, but I'm looking for a script (perhaps powershell) that I can run on a scheduled basis to keep an eye on things.

Thanks!

share|improve this question

5 Answers 5

up vote 3 down vote accepted

If you want a really comprehensive solution, check out the VI Power Documenter. It may be overkill for you though.

Here is a PowerShell script which will grab most of the info you were looking for and export to a CSV which you can easily work with in Excel of course.

param ( $Path )
Connect-VIServer -Server MyVIServer
$HDPrimarySize = @{
    Name = "Primary HD Size (GB)"
    Expression = { $_.HardDisks[0].CapacityKB / 1MB }
}
$AvgMemUsage = @{
    Name = "Mem Usage (Daily Avg %)"
    Expression = { ($_ | Get-Stat -Stat mem.usage.average -MaxSamples 1 -ErrorAction SilentlyContinue ).Value }
}
$vm = Get-VM
$output = $vm | Select-Object Name, MemoryMB, NumCpu, $HDPrimarySize, $AvgMemUsage 
$output | Export-Csv -NoTypeInformation -Path $Path
share|improve this answer

VMware released a Powershell toolkit you'll probably want to check out:

http://blogs.vmware.com/vipowershell/

And here's a blog with Top 10 Powershell scripts VMware admins should be using:

http://vsphere-land.com/top-10-list/top-10-powershell-scripts-that-vmware-administrators-must-use.html

share|improve this answer

Another answer (if you're SQL inclined and bored) is that you can open Excel, connect to a SQL datasource, connect to the SQL instance hosting your Virtual Center and query the views that Virtual Center uses 'under the covers' to roll your own reporting solution. Beauty to this is that it will always be up to date since its data coming live from your SQL and its completely customizable provided you're comfortable enough to do it in Excel (or even Reporting Services if you're that advanced/bored).

share|improve this answer

Not an automated answer, but I just use the Virtual Infrastructure Client.

Click on the Datacenter, Cluster or Server level. Select the Virtual Machine Tab File Menu - Export List. dumps to excel or csv or webpage, little massaging and it works.

I also went in and put what the server does in the notes field.

share|improve this answer

Get-VMStat is the easy way to do this with PowerShell. I have a blog post outlining how to use the script if you're new to PowerShell.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.