preloader
4 December 2013 / #Esxi #Powercli

Compare advanced settings with PowerCLI

We needed to compare advanced settings from 2 ESXi servers which were located in different cluster managed by different vCenter servers. In order to avoid manual action and as we didn’t already made some script to do it, here it is! PowerCLI to the Rescue!

powercliman

Here is a PowerCLI script which will display all differences between advanced settings from one ESXi server to another ones whatever their cluster or vCenter location, the only prerequisites being to be connected to the vCenter server(s) managing these servers:

compare_advancedsettings_0011

This can be useful with esxcli feature available from 5.1 version that will display settings with non-default values (cf William Lam post Identifying Non-Default Advanced & Kernel Settings Using ESXCLI 5.1).

The script use some parameter:

  • hostSourceName: ESXi host name used for source comparison
  • hostDestinationName: ESXi host name used for destination comparison
  • short (optionnel): Switch filtering displayed advanced settings' differences based on exclusions' list ($excludedSettings variable in the script)

The result is shown as a list of differences store in a System.Array[] object, feel free to sort, filter, export in csv or display to a GridView :

compare_advancedsettings_002

Here are some usage examples:

C:\foo>.\Compare-AdvancedSettings.ps1 -hostSourceName esx01.vmdude.fr -hostDestinationName esx02.vmdude.fr

Display all differences between advanced settings from host esx01.vmdude.fr and host esx02.vmdude.fr

C:\foo>.\Compare-AdvancedSettings.ps1 -hostSourceName esx01.vmdude.fr -hostDestinationName esx02.vmdude.fr -short

Display differences (without those in $excludedSettings) between advanced settings from host esx01.vmdude.fr and host esx02.vmdude.fr And as always, you can use Get-Help cmdlet in order to have online help for this cmdlet:

compare_advancedsettings_003

The Compare-AdvancedSettings.ps1 script is available for download in our GitHub page: https://github.com/v-team/powercli-toolbox


> Frederic MARTIN