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

Re: Exporting Group-Objects by entities to CSV

$
0
0

Hi Luc,

 

I am using the attached script which is your one from your blog with timings changed slightly.

 

As for my attempts at getting the export per machine, please don't ask, as I've butchered it now and didn't version track.

 

One copy of the script had in it the below, but this exported information which was not part of the filtered report (do I just need to do a select instead of sort-object?).

 

 

ForEach ($entity in $entities){

    $report = Get-Stat -Entity $entity -Stat $metrics -start $Morning -Finish $Night -IntervalMins 5  | where { $_.value -ne "-0.01" } 

 

    $report | Group-Object -Property EntityId,Timestamp | %{

        New-Object PSObject -Property @{

        Name = $_.Group[0].Entity.Name

        Time = $_.Group[0].Timestamp

        CpuAvg = ($_.Group | where {$_.MetricId -eq "cpu.usage.average"}).Value

        MemAvg = ($_.Group | where {$_.MetricId -eq "mem.usage.average"}).Value

        }

    $report | Sort-Object Time | Export-Csv ".\$entity_$Datefile.csv" -NoTypeInformation -UseCulture

 

    }

 

}

The version I had where I changed the method I cannot find a working copy, unfortunately, or maybe fortunately.

 

Geoff


Viewing all articles
Browse latest Browse all 214863

Latest Images

Trending Articles



Latest Images

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