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

Re: Problem with get-stat command and scripting

$
0
0

What is the layout of the name you used for the daily CSV files ?

Since that filename contains the name of the resourcepool, we could use the Group-Object to group the CSV files that belong together.

 

For example, assume the CSV filenames are following this layout: cluster-rp1-date.csv

Then you could do something like this

 

$folder="C:\powercli\stats"

Get-ChildItem-Path$folder-Filter"*.csv"|
Group-Object-Property {$_.Name.Split('-')[1]} |%{
 
$monthArray=@()
 
$_.Group|%{
   
$monthArray+=Import-Csv-Path"$folder\$name"
  }
 
$rp=$monthArray[0]."Resource Pool"
 
$monthArray|Export-Csv-Path"$folder\$($rp)-Month.csv"-NoTypeInformation-UseCulture
}

Viewing all articles
Browse latest Browse all 210400

Trending Articles



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