Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 222846

Re: Get statistics by VM folder

$
0
0

One way to do that could be

 

$folders=Get-Folder-Location VIRTUAL_MACHINES -Type VM -NoRecursion

 

$report=@()


foreach($folderin$folders){

    $cpu,$memory,$storage=Get-Folder-Name $folder|Get-VM|

    select @{N='CPU';E={$_.ExtensionData.Summary.Quickstats.OverallCpuUsage}},

        @{N='Memory';E={$_.ExtensionData.Summary.Quickstats.GuestMemoryUsage}},

        UsedSpaceGB |

    Measure-Object-Property CPU,Memory,UsedSpaceGB -Sum |

    Select -ExpandProperty Sum

    $report+=''| Select @{N='Folder';E={$folder}},@{N='CPU';E={$cpu}},@{N='Memory';E={$memory}},@{N='Storage';E={[math]::Round($storage,2)}}

}


$report|Export-Csv-Path .\report.csv -NoTypeInformation -UseCulture


Viewing all articles
Browse latest Browse all 222846

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>