Powershell to get the graph report of VMware VMs configured Memory.

Found the below blog which explains to get the report using powershell in graph pattern so wants to try the same to get the VMs configured memory from the vCenter.It is very useful for the disk space and other administration tasks to get the result in graph format from multiple computers.

We need to download the cmdlet from the below link and save it as Out-ConsoleGraph.psm1 , import the module in to the powershell.

http://jdhitsolutions.com/blog/wp-content/uploads/2013/01/Out-ConsoleGraph-v3.txt

Read the below description and help to get the more detailed info about the command.

get-help Out-ConsoleGraph -full

Description

This command takes objects and creates a horizontal bar graph based on the property you specify. The property should return a numeric value. This command does NOT write anything to the pipeline. All output is to the PowerShell host.

The default behavior is to use the same color, Green, for all graphed values.But you can specify conditional coloring using -HighColor, -MediumColor and-LowColor. If you specify one you must specify all three. The maximum available graph value is divided into thirds. The top third will be considered high, the next third medium and the rest low.

The final option is to send the graph results to Out-Gridview. You cannot use conditional formatting nor specify a graph color. But the grid view will include the property value.

To load Powercli module and to run the VMware cmdlts run the below command.

Add-PSSnapin VMware.VimAutomation.Core

Connect-VIServer VCenterIP\Name

Filter the powerdon VM

get-vm | Where-Object -FilterScript { $_.PowerState -eq ‘poweredon’}

Ud_censored

Select object for Name and Memory in GB.

 get-vm | Where-Object -FilterScript { $_.PowerState -eq ‘poweredon’} | Select-Object -Property Name,MemoryGB

Ued_censored

Using the Out-ConsoleGraph we can get the configured memory in Graph view and by default it will come with Green color and also we have option to choose the color.

 get-vm | Where-Object -FilterScript { $_.PowerState -eq ‘poweredon’} | Out-ConsoleGraph -Property MemoryGB 

Untitd_censored

Below command explains to choose corresponding color for High-low-medium configured memory.

 get-vm | Where-Object -FilterScript { $_.PowerState -eq ‘poweredon’} | Out-ConsoleGraph -Property MemoryGB -HighColor Red -MediumColor White -LowColor yellow

Untitleeed_censored

We can choose Sort in to descending order to sort the VMs according to the memory configured on the same.

get-vm | Where-Object -FilterScript { $_.PowerState -eq ‘poweredon’} | Sort-ObjectMemoryGB -Descending | out-ConsoleGraph -Property MemoryGB -HighColor Red -MediumColor White -LowColor yellow

Untitledd_censored

Advertisements
This entry was posted in PowerCLI, Powershell, VMware and tagged , , , , . Bookmark the permalink.

One Response to Powershell to get the graph report of VMware VMs configured Memory.

  1. Pingback: Powershell script to find the ilo firmware of the blades running on HP Enclosure. | Techbrainblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s