Need help with PowerCLI script for performace monitor.

Need help with PowerCLI script to get the CPU and memory usage (average, Max, Min and percentage) on hourly basis for past 3 days for select VM(s) only.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GG VPCommented:
Please go through this vmware community post,

Also please have a look at LUCD blog, expert in powercli,

You could also have a look at RV TOOLS,

Hope this helps!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DhattksAuthor Commented:
Thanks GG,

I found this script online that probably gets the performance counters from vCenter for all the VMs.

Would you know if changing "$allvms = @()" to $server = "vmname" and then changing $allvms at the end to  $server = "vmname" will get me the data only for one particular VM?


attached is the script.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
No. Just add the name of your VM after Get-VM to only get stats for that specific VM.
 $vms = Get-Vm MyParticularVM
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

DhattksAuthor Commented:
Thanks for help.
I was able to get the results for one VM using  $vms = Get-Vm MyParticularVM

But I have another script where it gets the data hourly basis for last 3 days but does not get me the Max, Min and percentage CPU and Memory. I only get average.

I some how need to get this script pull Max, Min and percentage as well.

Thanks in advance.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Not correct. It only gets you the average memory, no CPU stats.
Why don't you use the script posted first?
DhattksAuthor Commented:
The first script does not get me the hourly stats / data and the second one only gets me the average.
Yes, I have to change the memory to cpu in the script to get the cpu average.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
If I understood correctly, the first script will result in daily stats, and determining min and max from the average values of each hour. That is because VMWare seems not to provide any min/max values -   would be difficult to do so for all arbitrary time perioids.

What exactly is your desired output? Best to provide a text example ...
DhattksAuthor Commented:
The first script gives daily stats, and determining min and max from the average values.

the second one provides hourly data but average only.

see attachments.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
That much is clear. I've asked for the desired output, not what you get from the scripts.
You cannot get a min/max each hour, as the only available value is the average. To get min/max, we need to consolidate data, e.g. daily.
DhattksAuthor Commented:
Thanks everyone.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.