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

Re: Get statistics by VM folder

$
0
0

Thanks alot LucD, that was exactly what I needed. I put a foreach to get the information for each folder and now I would like to export it to a CSV. Can you help me with this?

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

               

foreach($folder in $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

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

 

 

}


Viewing all articles
Browse latest Browse all 222846

Trending Articles



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