# encoding: ascii
# api: powershell
# title: VM Disk Report
# description: APCOBO016
# version: 0.1
# type: script
# author: jgrote
# license: CC0
# x-poshcode-id: 3353
# x-archived: 2015-07-18T04:03:24
# x-published: 2012-04-13T09:36:00
#
# APCOBO028
# APCOBO029
# APCOBO034
# APCOBO049
# APCOBO051
# APCOBO056
# APCOBO058
# APCOBO059
# APCOBO060
# APCOBO061
# APCOBO062
# APCOBO063
# APCOBO064
# APCOBO065
# APCOBO066
# APCOBO067
# APCOBO068
# APCOBO076
# APCOBO077
# APCOBO078
# APCOBO080
# APCOBO081
# APCOBO085
# APCOBO086
# APCOBO096
# APCOBO097
# APCOBO099
# APCOBO107
# APCOBO109
# APCOBO113
# APCOBO114
# APCOBO116
# APCOBO117
# APCOBO124
# APCOBO127
# APCOBO132
# APCOBO142
# APCOBO143
# APCOBO145
# APCOBO149
# CDCOBO003
# ECCOBO001
# ECCOBO002
# ECCOBO003
# ECCOBO004
# ECCOBO005
# ECCOBO006
# FSCOBO001
# PRCOBO003
# PRCOBO003
# PRCOBO004
# PRCOBO005
# PRCOBO006
# PRCOBO007
# PRCOBO009
# PRCOBO010
# PRCOBO012
#
$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
