Project OnyxVery cool tool to find the PowerCLI Code you need List of Performance Counterslist of commands related to stats Get-Command -Module "VMware.VimAutomation.Core" *stat* Get a list of stats available for a vm or host Get-StatType -Entity servername Get-StatInterval Get-StatType -Entity servername -Interval "Past Day" Get-vm servername | Get-Stat -Stat mem.active.average -Start (Get-Date).AddHours(-2)-IntervalMins 5 Peak memory usage over past 24 hours in gb (Get-vm servername | Get-Stat -Stat mem.active.average -Start (Get-Date).AddHours(-24) | Measure-Object -Property Value -Maximum).Maximum * 1kb / 1gb If you change the interval units you can get older data Get-vm servername | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddHours(-168) -IntervalMins 60 | sort timestamp | select -First 5 Table 12-5. Default Sampling Periods and Retention
CPU Ready $vms= get-vm -Location NewYork #% CPU Ready = (CPU Ready / stat interval in milliseconds ) * 100 #( 30 min x 60 seconds * 1000 = 1800000 milliseconds ) * 100 to get percent, so we use 18000 as our divisor $VMCPUReady = Get-Stat -Entity (get-vm $vms ) -Stat cpu.ready.summation -start (get-date).adddays(-7) -finish (get-date) -interval 30 -instance "" -ea silentlycontinue | group entity | select Name, @{Name="CPU Ready Avg"; Expression= {[Math]::Round($($_.group | measure -property value -average).average,0)}}, @{Name="% CPU Ready"; Expression= {[Math]::Round(($($_.group | measure -property value -average).average) / 18000 ,2)}} ($VMCPUReady | measure -Sum -Property "CPU Ready Avg").sum $VMCPUReady PowerCLI property for vSphere client GUI Cluster "Current Failover Capacity" This seems to be the right property $cluster.ExtensionData.Summary.CurrentFailoverLevel Get-Cluster | select name, @{Name="Current Failover Capacity"; Expression={$_.ExtensionData.Summary.CurrentFailoverLevel}} | ft -auto
$vmhosts = Get-VMHost | Get-View $vmhosts = get-view (Get-VMHost) $VMHosts | select name, @{Name="Vendor";Expression={$_.summary.hardware.vendor}}, @{Name="Model";Expression={$_.summary.hardware.Model}}
Email a list of VM SnapshotsLook into issue with scheduled tasks not running evidently this was fixed in PowerCLI 4 Update 1 http://communities.vmware.com/thread/240979
Guest NICs disconnected after upgrade
Get VM ToolsVersion
blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah
Check for lockdown mode
List count of VMs per Datastore
List count of VMs esx host and datastore
List vm name and IP address Get-VM server | Select name,@{N=”IP Address”;E={@($_.guest.IPAddress[0])}} |
Powershell >