# encoding: ascii
# api: powershell
# title: VM Disk Report
# description: Gets all Virtual Machines, and exports a CSV that shows their virtual disk capacities and type. Used in this case for sizing a VCB temp disk.
# version: 0.1
# type: script
# author: jgrote
# license: CC0
# x-poshcode-id: 1933
# x-archived: 2011-01-17T07:47:44
#
#
$VMs = get-vm
$Results = @()
foreach ($VM in $VMs) {
$Result = new-object PSObject
$Result | add-member -membertype NoteProperty -name "Name" -value $VM.Name
$Result | add-member -membertype NoteProperty -name "Description" -value $VM.Notes
$VMDiskCount = 1
get-harddisk $VM | foreach {
$disk = $_
$Result | add-member -name "Disk($VMDiskCount)SizeGB" -value ([math]::Round($disk.CapacityKB / 1MB)) -membertype NoteProperty
$Result | add-member -name "Disk($VMDiskCount)Type" -value $disk.DiskType -membertype NoteProperty
$VMDiskCount++
}
$Results += $Result
}
$Results | select-object * | export-csv -notypeinformation E:\VCBDiskReport.csv