Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Powercli GUI: Determine the EVC Mode that vmware cluster should be configured

vmware vsphere esxi cluster, enhanced vmotion mode evc, cpu manufacturer, cpu generations, failover, drs, ha, vmware high availibility, distributed resource scheduler

I was evaluating one of the old project hosted on VMware in my office for a client, After ruff capacity calculation I found scarce of compute and memory resources in the VMware clusters. Few meetings and decisions, and sharing complete excel data and capacity planning for upcoming VMs, we decided to add and purchase new ESXi hosts for existing cluster, so capacity can be increased, then do the reshuffling of Esxi between VMware clusters as required, My main task was to ensure VMware DRS (Distributed resource scheduler) is working once new hosts are added, Basically configure EVC (Enhanced vMotion mode) on the cluster so vMotion should completely operational, As I was going to add different CPU processor generations Esxi host in the cluster.

EVC is short for Enhanced vMotion Compatibility. EVC permits you to vMotion virtual machines amid dissimilar generations of CPUs. Because EVC allows you to migrate virtual machines between different generations of CPUs, with EVC you can mix older and newer server generations in the same cluster and be able to migrate virtual machines with vMotion between these hosts.

For example: I have 2 Esxi host with CPU manufacturer AMD, with Generation 1, As time goes there AMD has manufactured and come out with new CPU processor Generation 2, and Generation 1 is no longer in production, When I add the third Esxi host in the VMware cluster vMotion no longer works, because Gen1 is missing features which Gen2 has and validation end up in error. vMotion works well between Gen1 host, but fails between newer and older CPU due to differences between CPU.

To resolve this Put all the esxi server in cluster, and Configure cluster EVC mode set it to AMD Generation 1. By doing this the Esxi host cpu Gen2, few features are stripped and it behave and acts like Gen1 (You won't be able to use new CPU features in cluster). This is good when you want to keep using Old CPU hardware. For more information check below 2 tables for AMD and Intel. 

Caution: Before enabling EVC mode on mixed CPU consult with your application team their application might require this new features. After setting or changing EVC mode always make sure you restart VMs to take changes effect.

Vendor CPU Generation CPU Summary
INTELIntel "Merom" GenerationApplies the baseline feature set of Intel "Merom" Generation (Xeon Core2) processors to all hosts in the cluster.

Hosts with the following processor types will be permitted to enter the cluster:
Intel "Merom" Generation (Xeon Core2)
Intel "Penryn" Generation (Xeon 45nm Core2)
Intel "Nehalem" Generation (Xeon Core i7)
Intel "Westmere" Generation (Xeon 32nm Core i7)
Intel "Sandy Bridge" Generation
Intel "Ivy Bridge" Generation
Intel "Haswell" Generation
Future Intel processors
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Penryn" GenerationApplies the baseline feature set of Intel "Penryn" Generation (Xeon 45nm Core2) processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Penryn" Generation (Xeon 45nm Core2)
Intel "Nehalem" Generation (Xeon Core i7)
Intel "Westmere" Generation (Xeon 32nm Core i7)
Intel "Sandy Bridge" Generation
Intel "Ivy Bridge" Generation
Intel "Haswell" Generation
Future Intel processors
 
Compared to the Intel "Merom" Generation EVC mode, this EVC mode exposes additional CPU features including SSE4.1.
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Nehalem" GenerationApplies the baseline feature set of Intel "Nehalem" Generation (Xeon Core i7) processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Nehalem" Generation (Xeon Core i7)
Intel "Westmere" Generation (Xeon 32nm Core i7)
Intel "Sandy Bridge" Generation
Intel "Ivy Bridge" Generation
Intel "Haswell" Generation
Future Intel processors
 
Compared to the Intel "Penryn" Generation EVC mode, this EVC mode exposes additional CPU features including SSE4.2, POPCOUNT, and RDTSCP.
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Westmere" GenerationApplies the baseline feature set of Intel "Westmere" Generation (Xeon 32nm Core i7) processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Westmere" Generation (Xeon 32nm Core i7)
Intel "Sandy Bridge" Generation
Intel "Ivy Bridge" Generation
Intel "Avoton" Generation
Intel "Haswell" Generation
Future Intel processors
 
Compared to the Intel "Nehalem" Generation EVC mode, this EVC mode exposes additional CPU features including AES and PCLMULQDQ.
 
Note: Some "Westmere" microarchitecture processors do not provide the full "Westmere" feature set. Such processors do not support this EVC mode; they will only be admitted to the Intel "Nehalem" Generation mode or below.
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Sandy Bridge" GenerationApplies the baseline feature set of Intel "Sandy Bridge" Generation processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Sandy Bridge" Generation
Intel "Ivy Bridge" Generation
Intel "Haswell" Generation
Future Intel processors
 
Compared to the Intel "Westmere" Generation EVC mode, this EVC mode exposes additional CPU features including AVX, XSAVE, and ULE.
 
Note: Some "Sandy Bridge" microarchitecture processors do not provide the full "Sandy Bridge" feature set. Such processors do not support this EVC mode; they will only be admitted to the Intel "Nehalem" Generation mode or below.
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Ivy Bridge" GenerationApplies the baseline feature set of Intel "Ivy Bridge" Generation processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Ivy Bridge" Generation
Intel "Haswell" Generation
Future Intel processors
 
Compared to the Intel "Sandy Bridge" Generation EVC mode, this EVC mode exposes additional CPU features including RDRAND, ENFSTRG, FSGSBASE, SMEP, and F16C.
 
Note: Some "Ivy Bridge" microarchitecture processors do not provide the full "Ivy Bridge" feature set. Such processors do not support this EVC mode; they will only be admitted to the Intel "Nehalem" Generation mode or below.
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Haswell" GenerationApplies the baseline feature set of Intel "Haswell" Generation processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Haswell" Generation
Future Intel processors
 
Compared to the Intel "Ivy Bridge" Generation EVC mode, this EVC mode exposes additional CPU features including Advanced Vector Extensions 2, fused multiply-adds, Transactional Synchronization Extensions, and new bit manipulation instructions.
 
Note: Some "Haswell" microarchitecture processors do not provide the full "Haswell" feature set. Such processors do not support this EVC mode; they will only be admitted to the Intel "Nehalem" Generation mode or below.
 
For more information, see Knowledge Base article 1003212.
INTELIntel "Broadwell" GenerationApplies the baseline feature set of Intel "Broadwell" Generation processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
Intel "Broadwell" Generation
Future Intel processors
 
Compared to the Intel "Haswell" Generation EVC mode, this EVC mode exposes additional CPU features including Transactional Synchronization Extensions, Supervisor Mode Access Prevention, Multi-Precision Add-Carry Instruction Extensions, PREFETCHW and RDSEED.
 
Note: Some "Broadwell" microarchitecture processors do not provide the full "Broadwell" feature set. Such processors do not support this EVC mode; they will only be admitted to the Intel "Haswell" Generation mode or below.
 
For more information, see Knowledge Base article 1003212.

 

Vendor CPU Generation CPU Summary
AMDAMD Opteron Generation 1Applies the baseline feature set of AMD Opteron Generation 1 ("Rev. E") processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron Generation 1 ("Rev. E")
AMD Opteron Generation 2 ("Rev. F")
AMD Opteron Generation 3 ("Greyhound")
 
For more information, see Knowledge Base article 1003212.
AMDAMD Opteron Generation 2Applies the baseline feature set of AMD Opteron Generation 2 ("Rev. F") processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron Generation 2 ("Rev. F")
AMD Opteron Generation 3 ("Greyhound")
 
Compared to the AMD Opteron Generation 1 EVC mode, this EVC mode exposes additional CPU features including CMPXCHG16B and RDTSCP.
 
For more information, see Knowledge Base article 1003212.
AMDAMD Opteron Gen. 3 (no 3DNow!)Applies the baseline feature set of AMD Opteron Generation 3 ("Greyhound") processors, with 3DNow! support removed, to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron Generation 3 ("Greyhound")
AMD Opteron Generation 4 ("Bulldozer")
AMD Opteron "Piledriver" Generation
AMD Opteron "Steamroller" Generation
Future AMD processors
 
Compared to the AMD Opteron Generation 2 EVC mode, this EVC mode exposes additional CPU features including SSE4A, MisAlignSSE, POPCOUNT, and ABM (LZCNT).
 
For more information, see Knowledge Base article 1003212.
AMDAMD Opteron Generation 3Applies the baseline feature set of AMD Opteron Generation 3 ("Greyhound") processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron Generation 3 ("Greyhound")
 
Compared to the AMD Opteron Generation 2 EVC mode, this EVC mode exposes additional CPU features including SSE4A, MisAlignSSE, POPCOUNT and ABM (LZCNT).
 
For more information, see Knowledge Base article 1003212.
AMDAMD Opteron Generation 4Applies the baseline feature set of AMD Opteron Generation 4 ("Bulldozer") processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron Generation 4 ("Bulldozer")
AMD Opteron "Piledriver" Generation
AMD Opteron "Steamroller" Generation
Future AMD processors
 
Compared to the AMD Opteron Generation 3 (no 3DNow!) EVC mode, this EVC mode exposes additional CPU features including SSSE3, SSE4.1, SSE4.2, AES, PCLMULQDQ, XSAVE, AVX, XOP and FMA4.
 
For more information, see Knowledge Base article 1003212.
AMDAMD Opteron "Piledriver" GenerationApplies the baseline feature set of AMD Opteron "Piledriver" Generation processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron "Piledriver" Generation
AMD Opteron "Steamroller" Generation
Future AMD processors
 
Compared to the AMD Opteron Generation 4 EVC mode, this EVC mode exposes additional CPU features including FMA, TBM, BMI1, and F16C.
 
For more information, see Knowledge Base article 1003212.
AMDAMD Opteron "Steamroller" GenerationApplies the baseline feature set of AMD Opteron "Steamroller" Generation processors to all hosts in the cluster.
 
Hosts with the following processor types will be permitted to enter the cluster:
AMD Opteron "Steamroller" Generation
Future AMD processors
 
Compared to the AMD Opteron Piledriver EVC mode, this EVC mode exposes additional CPU features including XSAVEOPT and FSGSBASE.
 
For more information, see Knowledge Base article 1003212.

To determine EVC mode of cluster, I have created a small PowerCLI GUI script which identify and shows what should be the Enhanced vMotion compatibility mode set on cluster. First login on the vCenter server, After login this shows the supported EVC modes in vCenter. Next select cluster from list and click search button, this will show Information in the bottom as shown below screenshot.

Make sure you are using Powercli version 6.0 version to execute this script. VMWARE VSPHERE POWERCLI INSTALLATION AND CONFIGURATION STEP BY STEP.

vmware vsphere esxi, vmware cluster detect evc mode, enhanced vmotion compatibility mode, inte and amd, cpu generations, vcenter server logoff

Download this complete script with images from here, It is also available on Github.com.

Related Articles
POWERCLI INITIALIZE-POWERCLI ENVIRONMENT.PS1 CANNOT BE LOADED BECAUSE RUNNING SCRIPTS IS DISABLED
Installing, importing and using any module in powershell

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<# This form was created using POSHGUI.com  a free online gui designer for PowerShell
#requires -version 4
<#
.SYNOPSIS
    This GUI script shows detects EVC mode of cluster.
.DESCRIPTION
    The Search-EVCMode cmdlet detects and shows what EVC (Enhanced vMotion comapatibility) mode need to set on VMware Vsphere cluster.
.INPUTS
    None
.OUTPUTS
    [VMware]
.NOTES
    Script Version:        1.0
    Author:                Kunal Udapi
    Creation Date:         20 March 2018
    Purpose/Change:        Get windows office and OS licensing information.
    Useful URLs:           http://kunaludapi.blogspot.in/
                           http://vcloud-lab.com/
    OS Version:            Windows 10
    Powershell Version:    Powershell V5.1 
    PowerCLI Version:      6.5
    VMware Vsphere:        6.5
.EXAMPLE
    PS C:\>.\Search-EVCMode.ps1

    This connects to vCenter, list clusters and and shows what EVC mode should be for selected vmware cluster, You can also disconnect cluster.
#>

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()

$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Definition -Parent
$CPUJpg = Get-Item "$PSScriptRoot\images\CPU.jpg"
$CPU = [System.Drawing.Image]::Fromfile($CPUJpg)
$IntelJpg = Get-Item "$PSScriptRoot\images\Intel.jpg"
$Intel = [System.Drawing.Image]::Fromfile($IntelJpg)
$AMDJpg = Get-Item "$PSScriptRoot\images\AMD.jpg"
$AMD = [System.Drawing.Image]::Fromfile($AMDJpg)

#region begin Functions{
    function Show-MessageBox { 
        param (  
            [string]$Message = "Show user friendly Text Message", 
            [string]$Title = 'Title here', 
            [ValidateRange(0,5)]  
            [Int]$Button = 0, 
            [ValidateSet('None','Hand','Error','Stop','Question','Exclamation','Warning','Asterisk','Information')] 
            [string]$Icon = 'Error' 
        ) 
        #Note: $Button is equl to [System.Enum]::GetNames([System.Windows.Forms.MessageBoxButtons]) 
        #Note: $Icon is equl to [System.Enum]::GetNames([System.Windows.Forms.MessageBoxIcon]) 
        $MessageIcon  = [System.Windows.Forms.MessageBoxIcon]::$Icon 
        [System.Windows.Forms.MessageBox]::Show($Message,$Title,$Button,$MessageIcon) 
    } 

Function Confirm-Powercli {
    $AllModules = Get-Module -ListAvailable VMware.VimAutomation.Core
    if (!$AllModules) {
        Show-MessageBox -Message "Install VMware Powercli 6.0 or Latest. `n`nUse either 'Install-Module VMware.VimAutomation.Core' `nor download Powercli from 'http://my.vmware.com'" -Title 'VMware Powercli Missing error' | Out-Null
    }
    else {
        Import-Module VMware.VimAutomation.Core
        $PowercliVer = Get-Module VMware.VimAutomation.Core
        $ReqVersion = New-Object System.Version('6.0.0.0')
        if ($PowercliVer.Version -gt $ReqVersion) {
            'Ok'
        }
        else {
            Show-MessageBox -Message "Install VMware Powercli 6.0 or Latest. `n`nUse either 'Install-Module VMware.VimAutomation.Core' `nor download Powercli from 'http://my.vmware.com'" -Title 'Lower version Powercli' | Out-Null
        }
    }
}

Function Connect-vCenter {
    param (
        [string]$vCenterServer = $vCenterTextBox.Text
    )
    Confirm-Powercli
    Disconnect-vCenter
    if (($vCenterTextBox.Text -eq $vCenterTextBoxWaterMark) -or ($vCenterTextBox.Text -eq '')) { 
        #[System.Windows.Forms.MessageBox]::Show("Please type valid Domain\Account", "Textbox empty")
        Show-MessageBox -Message "Please type valid vCenter server name" -Title 'vCenter Server Name' | Out-Null
    } 
    else { 
        try {
            Connect-VIServer $vCenterServer -Credential (Get-Credential) -ErrorAction Stop | Out-Null
            $VCConnected.text= "Connected to $($Global:DefaultVIServer.Name), Below EVC modes are supported"
            Get-EvcInfo
            $ClusterListComboBox.text = Get-ClusterNames
        }
        catch {
            Show-FormOnTop
            Show-MessageBox -Message $error[0].Exception.Message -Title 'Error Connecting vCenter' | Out-Null
        }
    }
    Show-FormOnTop 
}

function Disconnect-vCenter {
    try {
        Disconnect-VIServer * -Confirm:$false -ErrorAction Stop
        $VCConnected.text = 'Not connected to any vCenter Server'
        $EvcDataGridView.DataSource = $null
        $ClusterListComboBox.Items.Clear()
        $ClusterListComboBox.Text = "Select Cluster name from list"
        $EVCMode.text  = $null
        $ResultLabel.text = $null
        $PictureBox1.Image = $CPU
    }
    catch {
        #Show-MessageBox -Message $error[0].Exception.Message -Title 'Error Connecting vCenter' | Out-Null
    }
}

function Get-EvcInfo {
    $ArrayList = New-Object System.Collections.ArrayList
    $vCenterInfo  = $Global:DefaultVIServer.ExtensionData.Capability.SupportedEVCMode
    $EVCInfo = $vCenterInfo | Select-Object  Vendor, Label #Vendor, VendorTier, Key, Label, Summary
    $ArrayList.AddRange($EVCInfo)
    $EvcDataGridView.DataSource = $ArrayList
}

function Get-ClusterNames {
    $Cluster = Get-Cluster
    $ClusterListComboBox.Items.AddRange($Cluster.Name)
    $Cluster[0].Name
}

function Show-FormOnTop {
    $vCenterForm.TopMost = $true
    $vCenterForm.TopMost = $false
}

#endregion }

#region begin GUI{ 

$vCenterForm                                      = New-Object system.Windows.Forms.Form
$vCenterForm.ClientSize                           = '531,486'
$vCenterForm.text                                 = 'Detect EVC mode'
$vCenterForm.TopMost                              = $false
$vCenterForm.Top                                  = $true

$vCenterTextBox                                   = New-Object system.Windows.Forms.TextBox
$vCenterTextBox.Name                              = 'vCenterTextBox'
$vCenterTextBox.multiline                         = $false
$vCenterTextBox.width                             = 345
$vCenterTextBox.height                            = 20
$vCenterTextBox.location                          = New-Object System.Drawing.Point(16,11)
$vCenterTextBox.Font                              = 'Microsoft Sans Serif,10'
$vCenterTextBoxWaterMark                          = 'Type vCenter Server name to login' 
$vCenterTextBox.ForeColor                         = 'LightGray' 
$vCenterTextBox.Text                              = $vCenterTextBoxWaterMark 
$vCenterTextBox.add_TextChanged({$vCenterTextBox.ForeColor                  = 'Black'})

$ConnectvCenter                                   = New-Object system.Windows.Forms.Button
$ConnectvCenter.text                              = "Connect-vCenter"
$ConnectvCenter.width                             = 133
$ConnectvCenter.height                            = 30
$ConnectvCenter.location                          = New-Object System.Drawing.Point(375,5)
$ConnectvCenter.Font                              = 'Microsoft Sans Serif,10'
$ConnectvCenter.add_Click({Connect-vCenter})

$VCConnected                                      = New-Object system.Windows.Forms.Label
$VCConnected.Name                                 = 'VCConnected'
$VCConnected.text                                 = 'Not connected to any vCenter Server'
$VCConnected.AutoSize                             = $true
$VCConnected.width                                = 25
$VCConnected.height                               = 10
$VCConnected.location                             = New-Object System.Drawing.Point(20,40)
$VCConnected.Font                                 = 'Microsoft Sans Serif,10'

$EvcDataGridView                                  = New-Object system.Windows.Forms.DataGridView
$EvcDataGridView.width                            = 493
$EvcDataGridView.height                           = 229
$EvcDataGridView.location                         = New-Object System.Drawing.Point(14,64)
$EvcDataGridView.AutoSizeColumnsMode              = 'Fill'
#https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewautosizecolumnsmode(v=vs.110).aspx

$ClusterListComboBox                              = New-Object system.Windows.Forms.ComboBox
$ClusterListComboBox.text                         = "Select Cluster name from list"
$ClusterListComboBox.width                        = 348
$ClusterListComboBox.height                       = 20
$ClusterListComboBox.location                     = New-Object System.Drawing.Point(14,309)
$ClusterListComboBox.Font                         = 'Microsoft Sans Serif,10'
$ClusterListComboBox.DropDownStyle                = [System.Windows.Forms.ComboBoxStyle]::DropDownList

$SearchEvcMode                                    = New-Object system.Windows.Forms.Button
$SearchEvcMode.text                               = "Search-EvcMode"
$SearchEvcMode.width                              = 133
$SearchEvcMode.height                             = 30
$SearchEvcMode.location                           = New-Object System.Drawing.Point(375,301)
$SearchEvcMode.Font                               = 'Microsoft Sans Serif,10'
$SearchEvcMode.add_Click({Search-EvcMode})

$PictureBox1                                      = New-Object system.Windows.Forms.PictureBox
$PictureBox1.width                                = 101
$PictureBox1.height                               = 92
$PictureBox1.location                             = New-Object System.Drawing.Point(15,341)
#$PictureBox1.imageLocation                       = "undefined"
$PictureBox1.SizeMode                             = [System.Windows.Forms.PictureBoxSizeMode]::zoom
$PictureBox1.Image                                = $CPU

$EVCMode                                          = New-Object system.Windows.Forms.Label
$EVCMode.AutoSize                                 = $true
$EVCMode.width                                    = 25
$EVCMode.height                                   = 10
$EVCMode.location                                 = New-Object System.Drawing.Point(140,356)
$EVCMode.Font                                     = 'Microsoft Sans Serif,10'

$ResultLabel                                      = New-Object system.Windows.Forms.Label
$ResultLabel.AutoSize                             = $true
$ResultLabel.width                                = 25
$ResultLabel.height                               = 10
$ResultLabel.location                             = New-Object System.Drawing.Point(140,393)
$ResultLabel.Font                                 = 'Microsoft Sans Serif,15'

$Url                                              = New-Object System.Windows.Forms.LinkLabel
$Url.text                                         = 'http://vcloud-lab.com'
$Url.AutoSize                                     = $true
$Url.width                                        = 25
$Url.height                                       = 10
$Url.location                                     = New-Object System.Drawing.Point(17,458)
$Url.Font                                         = 'Microsoft Sans Serif,10'
$Url.add_Click({[system.Diagnostics.Process]::start('http://vcloud-lab.com')})

$LogoffvCenter                                    = New-Object system.Windows.Forms.Button
$LogoffvCenter.text                               = 'Logoff-vCenter'
$LogoffvCenter.width                              = 133
$LogoffvCenter.height                             = 30
$LogoffvCenter.location                           = New-Object System.Drawing.Point(370,447)
$LogoffvCenter.Font                               = 'Microsoft Sans Serif,10'
$LogoffvCenter.add_Click({Disconnect-vCenter})

$vCenterForm.controls.AddRange(@($vCenterTextBox,$ConnectvCenter,$EvcDataGridView,$ClusterListComboBox,$SearchEvcMode,$PictureBox1,$EVCMode,$ResultLabel,$VCConnected,$Url, $LogoffvCenter))

#region gui events {
#endregion events }

#endregion GUI }

#Write your logic code here
function Search-EvcMode {
    if ($ClusterListComboBox.SelectedItem -eq $null) {
        Show-MessageBox -Message 'Login to Esxi server first' -Title 'Select Cluster' | Out-Null
    }
    else {
        $EsxiServer = Get-Cluster $ClusterListComboBox.SelectedItem | Get-VMHost
        $EvcTable =  $Global:DefaultVIServer.ExtensionData.Capability.SupportedEVCMode | Select-Object Vendor, VendorTier, Key, Label, Summary
        $EsxiInfo = $EsxiServer | Select-Object MaxEVCMode 
        $EsxiEvcTable = @()
        foreach ($Esxi in $EsxiInfo) {
            $EsxiEvcTable += $EvcTable | Where-Object {$_.Key -contains $Esxi.MaxEVCMode}
        }
        $GroupedVendor = $EsxiEvcTable | Group-Object -Property Vendor
        $VendorCount = $GroupedVendor | Measure-Object
        if ($VendorCount.Count -eq 0) {
            $EVCMode.text = "No esxi host found in cluster, it is empty `n$($ClusterListComboBox.SelectedItem)"
            $PictureBox1.Image = $CPU
        }
        elseif ($VendorCount.Count -eq 1) {
            $GetEVCMode = $GroupedVendor.Group | Sort-Object -Property VendorTier -Unique | Select-Object -First 1
            $EVCMode.text  = "EVC Mode should be $($GetEVCMode.Vendor.toUpper())"
            $ResultLabel.text = $GetEVCMode.Label
            if ($GetEVCMode.Vendor -eq 'intel') {
                $PictureBox1.Image = $Intel
            }
            elseif ($GetEVCMode.Vendor -eq 'amd') {
                $PictureBox1.Image = $Amd
            }
            else {
                $PictureBox1.Image = $CPU
            }
        }
        else {
            $EVCMode.text = "Esxi server with mixed CPU vendors in cluster, `n$($ClusterListComboBox.SelectedItem) `nCannot detect EVC mode"
            $PictureBox1.Image = $CPU
        }
    }
}

$vCenterForm.ShowDialog() | Out-Null

Useful articles
Different ways to bypass Powershell execution policy :.ps1 cannot be loaded because running scripts is disabled
PART 1 : VCENTER SQL DATABASE AND ODBC DSN CREATION
PART 2 : VCENTER SERVER 6.0 INSTALLATION ON WINDOWS 2012 R2

Go Back

Comment

Blog Search

Page Views

12085165

Follow me on Blogarama