Thanks LucD,
the script worked for me But I have to put the all vm names (one time job only).
###############################################################################################
$report = @()
$metrics = "cpu.usage.average","mem.usage.average","disk.usage.average","net.usage.average"
$vms = Get-Vm | where {$_.PowerState -eq "PoweredOn"}
$start = (Get-Date).adddays(-7)
Get-Stat -Entity ($vms) -start $start -stat $metrics | `Group-Object -Property EntityId | %{
$row = ""| Select VmName, Timestamp, vCPU, MinCpu,AvgCpu,MaxCpu,MemAlloc,MinMem,AvgMem,MaxMem,Mindisk,Avgdisk,Maxdisk,Minnic,Avgnic,Maxnic
$row.VmName = $_.Group[0].Entity.N
$row.Timestamp = ($_.Group | Sort-Object -Property Timestamp)[0].Timestamp
$row.vCPU = $_.Group[0].Entity.NumCpu
$cpuStat = $_.Group | where {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average
$row.MinCpu = "{0:f2}" -f ($cpuStat.Minimum)
$row.AvgCpu = "{0:f2}" -f ($cpuStat.Average)
$row.MaxCpu = "{0:f2}" -f ($cpuStat.Maximum)
$row.MemAlloc = $_.Group[0].Entity.MemoryMB
$memStat = $_.Group | where {$_.MetricId -eq "mem.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average
$row.MinMem = "{0:f2}" -f ($memStat.Minimum)
$row.AvgMem = "{0:f2}" -f ($memStat.Average)
$row.MaxMem = "{0:f2}" -f ($memStat.Maximum)
$row.vdisk = $_.Group[0].Entity.vdisks
$diskStat = $_.Group | where {$_.MetricId -eq "disk.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average
$row.Mindisk = "{0:f2}" -f ($diskStat.Minimum)
$row.Avgdisk = "{0:f2}" -f ($diskStat.Average)
$row.Maxdisk = "{0:f2}" -f ($diskStat.Maximum)
$row.vnic = $_.Group[0].Entity.vnic
$netStat = $_.Group | where {$_.MetricId -eq "net.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average
$row.Minnic = "{0:f2}" -f ($netStat.Minimum)
$row.Avgnic = "{0:f2}" -f ($netStat.Average)
$row.Maxnic = "{0:f2}" -f ($netStat.Maximum)
$report += $row}
$report | Export-Csv "C:\test.csv" -NoTypeInformation
################################################################