#
.SYNOPSIS
Gets the resource pool shares per VM from vCenter and shows the weight imbalance
.DESCRIPTION
This script will connect to your vCenter server and scan the resource pools.
It will then calculate how many shares are in place per CPU / 1MB memory.
This allows you to correctly size your resource pools
.PARAMETER vCenter
FQDN or IP for the vCenter server you wish to run the script against.
.PARAMETER csv
Path to csv file:
FQDN, Username, Password
vcenter.domain.com,user1,password1
.PARAMETER Reservation
Show how much resources are reserved by the resource pool
.PARAMETER Limit
Show the resource limits for a resource pool.
.PARAMETER PerVmShares
Display the current value per vm for the shares in a resource pool. This allows you to
see the balance between pools and see which pool has a higher priority.
.PARAMETER RecommendedShares
Display the recommended total pool shares for low / normal / high these can either be
hard coded into the script or added to variables.
.PARAMETER CpuShares
Set the share value you would like to have for Low/normal/high and the script will calculate
the values for you, default values are "2000,4000,8000" following VMware standards
.PARAMETER MemShares
Set the share value you would like to have for Low/normal/high and the script will calculate
the values for you, default values are "5,10,20" following VMware standards
.EXAMPLE
.\Get-ResourcePoolSharesReport.ps1 -Csv .\ResourcePoolShares.csv
.EXAMPLE
.\Get-ResourcePoolSharesReport.ps1 -vCenter "my-vc01.yoursite.com"
.EXAMPLE
.\Get-ResourcePoolSharesReport.ps1 -vCenter "my-vc01.yoursite.com" -PerVmShares -RecommendedShares -CpuShares "500,1000,2000" -MemShares "5,10,20" -reservation -limit
.NOTES
Script created by Steven Marks www.spottedhyena.co.uk
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,ParameterSetName="vCenter", Position=0)]
[string]$vCenter,
[Parameter(Mandatory=$true,ParameterSetName="Csv", Position=0)]
[string]$Csv,
[Parameter(Mandatory=$false)]
[switch]$PerVmShares,
[switch]$RecommendedShares,
[switch]$Reservation,
[switch]$Limit,
[string]$Report="Report.html",
[string]$CpuShares="500,1000,2000",
[string]$MemShares="5,10,20"
)
Try{
If ((Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin VMware.VimAutomation.Core }
function Get-vCenterClusterPools{
## Null clusters then get clusters
$clusters = $null
$clusters = Get-Cluster
## Enumerate Members of Cluster
Foreach($cluster in $clusters){
Add-Content $report "