Begin {
Collection of property names for custom object
$PropertyCol = @(
"Name", "OS", "Host", "CPU (Count)", "Memory (MB)",
"VM Extent", "Datastore Name"
)
}
Process {
if ( $_ -isnot http://VMware.VimAutomation.Client20.VirtualMachineImpl ) { continue }
$process = "" | Select-Object -Property $PropertyCol
$process.Name = $_.Name
$process.OS = $_.Guest.OSFullName
$process.Host = $_.Host.Name
$process."CPU (Count)" = $_.NumCpu
$process."Memory (MB)" = $_.MemoryMB
$process."VM Extent" = $_ | get-datastore | get-view | %{ $_.Info.Vmfs.Extent }
$process."Datastore Name" = $_ | get-datastore | Select Name
Write-Output $process
}
The problem I'm having is in the output:
Name : MyVM
OS : Microsoft Windows Server 2003, Standard Edition (32-bit)
Host : esx.domain.com
CPU (Count) : 1
Memory (MB) : 4096
VM Extent : VMware.Vim.HostScsiDiskPartition
Datastore Name : @{Name=SomeName}
I need to expand out VM Extent & Datastore name. Thoughts?
-Cody Bunch
vExpert, VCP VI3
http://professionalvmware.com