Please provide your feedback in this short Flings' survey.

Virtual Machine Compute Optimizer

version 3.0.0.0 — June 17, 2021

Contributors 2
View All
Comments 67
View All

Release Date: July 02, 2019

Summary

The Virtual Machine Computer Optimizer (VMCO) is a Powershell script and module that uses the PowerCLI module to capture information about the Hosts and VMS running in your vSphere environment, and reports back on whether the VMs are configured optimally based on the Host CPU and memory. It will flag a VM as “TRUE” if it is optimized and “FALSE” if it is not. For non-optimized VMs, a recommendation is made that will keep the same number of vCPUs currently configured, with the optimal number of virtual cores and sockets.

Note that the VMCO will not analyze whether your VMs are configured with the correct number of vCPUs based on the VM’s workload. A more in-depth analysis tool such as VMware vRealize Operations Manager can make right-sizing determinations based on workload and actual performance.

Requirements

In order to run the Virtual Machine Compute Optimizer, you will need the following:

  • Windows 7/Server 2008 or above
  • Powershell v5 or higher
  • Access to the internet. The VMCO will attempt to install or update the modules needed (PowerCLI and VMCO)
  • A user account with Read-Only rights assigned at the vCenter level with ‘Propogate to children’enabled. These rights will be needed on each vCenter that will be analyzed.
Instructions

There are a few ways you can launch a Powershell script.

Please see the PDF for full instructions in the download box.
Changelog

Version 3.0.0

  • Correcting the files included with the Fling

Version 3.0.0.5

  • Minor updates/fixes
  • 2-5-2021 v3.0.0.2 Added escape for parentheses in VM Names (ie, Tanzu VMs) so they will show up in Get-View Filters by VMName
  • 2-5-2021 v3.0.0.3 Removed requirement for VMware.PowerCLI due to error re: HorizonView module not supported in Powershell Core
  • 2-5-2021 v3.0.0.4 Modified Get-vSphereInfo so it checks the VMName type and if Object or UniversalVirtualMachineImpl it selects just the name
  • 4-30-2021 v3.0.0.5 Minor grammar corrections

Version 3.0.0

  • Script will install or update the required modules (VMCO and PowerCLI). The script is now a single script that acts as the easy button to walk through the module installs, connecting to a vCenter, and exporting the results.

Version 2.1.0

  • Fixed errors in reporting for some VMs that are on hosts with 4 sockets
  • Fixed “memory” missing from Details when VM memory spans pNUMA nodes
  • Added ability to call function with “-simple” which only reports VM info (leaves out vCenter, Cluster, and Host)

Version 2.0.4

  • Fixed errors with reporting on VMs with odd number of vCPUs
  • Fixed reporting on VMs that have CPU Hot Add enabled

Version 2.0.3

  • Fixed issues with odd number of vCPUs
  • Fixed issue with reporting on VMs with CPU Hot Add enabled
  • Updated documentation

Version 2.0.2

  • Modified Get-OptimalvCPU.ps1 to account for vCenters with no clusters
  • Modified Error Catches so they display the line number of the error

Version 2.0.1

  • Corrected Get-OptimalvCPU.ps1 where sometimes cluster information would show as System.Object[].

Version 2.0.0

  • Priority of the findings are captured
  • Details on the findings are included
  • Cluster information is captured to determine if Host HW is not consistent across the cluster
  • Report if a VM spanning pNUMA nodes actually has the pNUMA exposed to the guest OS
  • Report if advanced settings have been changed on the VM or host level to expose pNUMA to the guest OS
  • Reports if the number of vCPUs for a VM exceeds the physical cores of the host (using hyperthreads as vCPUs)
  • Ability to use the stand alone “Get-OptimalvCPU” function for more flexibility

Version 1.0.4

  • Added a -Property filter to the Get-View commands for hosts and VMs to reduce time and amount of returned data
  • Removed if statement in Get_Optimal_CPU function that included $hostCPUs as it was not yet being used

Version 1.0.3

  • Fixed calculation of # of vm cores which was incorrectly reporting on some vms
Similar Flings
No similar flings found. Check these out instead...
Apr 12, 2017

Sample Exchange PowerShell ISE Integration

SampleExchangePowerCLI Module
A PowerShell Module that contains integration between VMware's new sample code repository Sample Exchange, and PowerShell ISE. Sample Exchange contains an ever growing catalog of PowerCLI samples and snippets, and this module uses Sample Exchange REST web services to allow a user to paste sample code into their editors directly in PowerShell ISE.
Pre-Requisites
PowerShell version 4 or later.
Installation
1) Download (or clone) all files comprising the module.
2) Create a folder for the module in your module folder path, e.g. C:\Users\username\Documents\WindowsPowerShell\Modules\SampleExchangePowerCLI
3) Place the module files in the above folder. The SampleExchangePowerCLI.psd1 and SampleExchangePowerCLI.psm1 files should be in the root of the folder
NOTE: If you create the folder in the path above, then PowerShell ISE (and regular PowerShell windows) will load the module.
If you don't want to do this, you can manually install the module by running the command
PS C:> Import-Module -Force -Verbose C:\local\path\where\you\extracted\SampleExchangePowerCLI
where SampleExchangePowerCLI is the folder containing SampleExchangePowerCLI.psd1 and SampleExchangePowerCLI.psm1.
4) Restart PowerShell ISE
5) If you would like to have Sample Exchange samples available via the PowerShell ISE Snippets feature, Go to "Add-ons" > "Sample Exchange" > "Sync Snippets"
This command is the equivilent of calling the "Sync-SampleExchangeSnippetsWithISE" method directly. It downloads all samples and registers them as "Snippets" in PowerShell ISE thus making them available for use in the editor when you issue the "CTRL + J" hot-key.
If you later decide that you do not like this, you can simply go to C:\Users<user>\Documents\WindowsPowerShell\Snippets and delete all of the VMW*.ps1xml files and the snippets will go away.
Usage
Selecting Either Add-ons > VMware Sample Exchange > Search Samples, or hitting "CTRL + SHIFT + S" will bring up a dialog box which lists all available PowerShell language samples by default. You can additionally enter a search term and click the "Search" button to additionally filter the list.
Select any sample from the list and click the "Insert in Editor" button to insert the given sample code at the location of the cursor in the editor that had focus when the dialog was opened (yes, it doesn't work to select another editor after the dialog is opened, sorry).
If you click "OK" the sample content is pasted in the shell. "Cancel" simply closes the window.
To see a list of available functions:
Get-Command -Module SampleExchangePowerCLI

View More