Hi,
I am trying to get the Output of MemoryUsage in GB. Can anyone help me with the syntax of Code (below its bold)?
Code:
$Report = @()
get-vm | % {
$vm = Get-View $_.ID
$vms = "" | Select-Object VMName, Hostname, IPAddress, VMState, TotalCPU, TotalMemory, MemoryUsage, TotalNics, ToolsStatus, ToolsVersion, MemoryLimit, MemoryReservation, CPUreservation, CPUlimit
$vms.VMName = $vm.Name
$vms.HostName = $vm.guest.hostname
$vms.IPAddress = $vm.guest.ipAddress
$vms.VMState = $vm.summary.runtime.powerState
$vms.TotalCPU = $vm.summary.config.numcpu
$vms.TotalMemory = $vm.summary.config.memorysizemb
$vms.MemoryUsage = $vm.summary.quickStats.guestMemoryUsage --> [math]::Round(($vm.summary.QuickStats.GuestMemoryUsage/1GB),2)
$vms.TotalNics = $vm.summary.config.numEthernetCards
$vms.ToolsStatus = $vm.guest.toolsstatus
$vms.ToolsVersion = $vm.config.tools.toolsversion
$vms.MemoryLimit = $vm.resourceconfig.memoryallocation.limit
$vms.MemoryReservation = $vm.resourceconfig.memoryallocation.reservation
$vms.CPUreservation = $vm.resourceconfig.cpuallocation.reservation
$vms.CPUlimit = $vm.resourceconfig.cpuallocation.limit
$Report += $vms
}
$Report
GuestMemoryUsage is expressed in MB, so you'll have to divide by 1KB to get to GB
$vms.MemoryUsage = [math]::Round(($vm.summary.QuickStats.GuestMemoryUsage/1KB),2)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
GuestMemoryUsage is expressed in MB, so you'll have to divide by 1KB to get to GB
$vms.MemoryUsage = [math]::Round(($vm.summary.QuickStats.GuestMemoryUsage/1KB),2)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK, now I get it, Thank you, Sir,