Need help with PowerCLI script for performace monitor.

Posted on 2014-12-04
Last Modified: 2014-12-15
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.

Question by:Dhattks
  • 5
  • 4

Accepted Solution

GG VP earned 250 total points
ID: 40482138
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!

Author Comment

ID: 40482985
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.
LVL 69

Assisted Solution

Qlemo earned 250 total points
ID: 40483002
No. Just add the name of your VM after Get-VM to only get stats for that specific VM.
 $vms = Get-Vm MyParticularVM
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.


Author Comment

ID: 40491598
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.
LVL 69

Expert Comment

ID: 40491732
Not correct. It only gets you the average memory, no CPU stats.
Why don't you use the script posted first?

Author Comment

ID: 40491878
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.
LVL 69

Expert Comment

ID: 40492282
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 ...

Author Comment

ID: 40494067
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.
LVL 69

Expert Comment

ID: 40494108
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.

Author Closing Comment

ID: 40501116
Thanks everyone.

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Virtualize old XP PC 8 58
How to move multiple VMs in VSCA 6.0 4 71
VMWare 6.5 5 91
Exchange Server DAG mailbox server VMware network configuration 7 42
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
Teach the user how to install log collectors and how to configure ESXi 5.5 for remote logging Open console session and mount vCenter Server installer: Install vSphere Core Dump Collector: Install vSphere Syslog Collector: Open vSphere Client: Config…
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question