PoshCode Archive  Artifact [802e56798b]

Artifact 802e56798bd92ec24dde7c5cf4ce6531880213437a9738a6d6c9c58bb43fe8e2:

  • File VM-Disk-Report.ps1 — part of check-in [aebe59f3aa] at 2018-06-10 13:50:52 on branch trunk — 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. (user: jgrote size: 1105)

# 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: 5148
# x-archived: 2014-05-15T05:10:01
# x-published: 2014-05-06T04:06:00
#
#
$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