I'm missing something. I've been working on this on and off for the past couple of days and can't figure out what I'm doing wrong here. My goal is to ultimately develop an audit script for my environment using the VI Toolkit.
$scReserved = @{ Label = "Reserved"; Expression = { (Get-View -id (Get-View $_).ConfigManager.MemoryManager).ConsoleReservationInfo.ServiceConsoleReserved) } }
Get-VMHost | ft Name,$scReserved
This doesn't work.
I have a way to get this info by doing the following though i'd like to be able to use Format-Table instead. Why doesn't this work and what am I missing in how to do these Expressions?
This works though isn't a friendly to save out to a file or to use Format-Table.
$hosts = Get-VMHost | Get-View
foreach($hostview in $hosts) {
$mem Get-View -id $hostview.ConfigManager.MemoryManager
$h = $hostview.Name + ","+ $mem.ConsoleReservationInfo.ServiceConsoleReserved
Write-Host $h
}
Please Powershell me correctly.