Menu

Virtual Geek

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

Microsoft Powershell GUI: Change Internet Options connections Lan settings proxy server grayed out

Powershell winform wpf mix gui, graphical interface, change registry proxy settings hack internet option connections tab enable proxy

One of my friend wanted a small proxy settings hack tool which I created using Powershell script, it is very small tool and helps to change proxy server settings, It can changed when Internet Options >> Connections tab is either missing or Lan settings button is disabled, and you still want to change proxy settings. Basically this graphical powershell script make changes in the Registry. So registry modification must be enabled for this.

microsoft windows Powershell Internet Options Connections tab, Lab Settings, Proxy Server, VPN connection, lan proxy address.png

After launching script looks like below. It shows the current proxy configuration, Settings can be changed via typing new proxy server and proxy port and pressing Change Proxy button. Once Setting is refreshed, you can see the results. To build this GUI, I have used Powershell Studio.

microsoft powershell wpf forms change internet proxy settings, connection tab enable hack, powershell hack, registry

Basically this script Enable or Disable and changes proxy server dword values under registry path  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings. Below dword values need to change the behavior of Lan settings >> proxy.

ProxyEnable = 1  #1 = enabled & 0 = Disabled
ProxyServer = 'OldProxyServer:808'

This script can be downloaded from here, It is also available on github.com.

  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
<#
    .NOTES
    --------------------------------------------------------------------------------
     Code generated by:  Visual Studio 2015
     Created on:         4/19/2018 4:57 AM
     Generated by:       http://vcloud-lab.com
     Written by:         Kunal Udapi
     Tested on:          Windows 10
                         Windows 2016 Server
    --------------------------------------------------------------------------------
    .DESCRIPTION
        GUI script generated using Visual Studio 2015
#>

Add-Type -AssemblyName PresentationFramework

$RawXamlForm = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        Title="Configure Proxy Server" Height="201" Width="525" ResizeMode="NoResize" Topmost="True" WindowStyle="none">
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="#FF4E7645" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>
    <Grid>
        <Label x:Name="CurrentProxyLabel" Content="Current Internet Proxy configuration" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="225" Foreground="White" FontStyle="Italic" FontWeight="Bold"/>
        <Label x:Name="CProxyStatusLabel" HorizontalAlignment="Left" Margin="235,10,0,0" VerticalAlignment="Top" Width="140" Foreground="#FFFF0C00" HorizontalContentAlignment="Right" Height="26"/>
        <Label x:Name="UrlLabel" Content="http://vcloud-lab.com" HorizontalAlignment="Left" Margin="248,159,0,0" VerticalAlignment="Top" Width="127" Foreground="White"/>
        <TextBox x:Name="CProxyServerBox" HorizontalAlignment="Left" Height="23" Margin="10,36,0,0" TextWrapping="Wrap" Text="Current Proxy Server" VerticalAlignment="Top" Width="270" Background="#FF3C4632" Foreground="White" IsReadOnly="True"/>
        <TextBox x:Name="CProxyPortBox" HorizontalAlignment="Left" Height="23" Margin="285,36,0,0" TextWrapping="Wrap" Text="Port" VerticalAlignment="Top" Width="90" Background="#FF3C4632" Foreground="White" IsReadOnly="True"/>
        <Button x:Name="RefreshB" Content="Refresh" HorizontalAlignment="Left" Margin="285,64,0,0" VerticalAlignment="Top" Width="90" Height="24"/>
        <Label x:Name="NewProxyLabel" Content="Change new Internet Proxy server and port below" HorizontalAlignment="Left" Margin="10,82,0,0" VerticalAlignment="Top" Width="440" Foreground="White" FontWeight="Bold" FontSize="14"/>
        <Label x:Name="NewProxyServerlabel" Content="New Proxy Server" HorizontalAlignment="Left" Margin="10,105,0,0" VerticalAlignment="Top" Width="125" Foreground="White" FontStyle="Italic"/>
        <Label x:Name="NewProxyPortlabel" Content="New Proxy Port" HorizontalAlignment="Left" Margin="280,105,0,0" VerticalAlignment="Top" Width="95" Foreground="White" FontStyle="Italic"/>
        <TextBox x:Name="ChangeProxyServer" Text='Type Valid Proxy server and Port no' HorizontalAlignment="Left" Height="23" Margin="10,131,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="270" Background="#FFB4DC5A" Foreground="Black" IsReadOnly="True"/>
        <TextBox x:Name="ChangeProxyPort" Text='808' HorizontalAlignment="Left" Height="23" Margin="285,131,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="90" Background="#FFB4DC5A" Foreground="Black" IsReadOnly="True"/>
        <Button x:Name="ChangeProxyB" Content="Change Proxy" HorizontalAlignment="Left" Margin="380,131,0,0" VerticalAlignment="Top" Width="127" Height="24" IsEnabled="False"/>
        <Image x:Name="LogoImage" HorizontalAlignment="Left" Height="101" Margin="388,15,0,0" VerticalAlignment="Top" Width="119"/>
        <CheckBox x:Name="EnableProxy" Content="Enable or Disable Proxy" HorizontalAlignment="Left" Margin="15,164,0,0" VerticalAlignment="Top" Width="150" Foreground="White" IsChecked="True"/>
        <Button x:Name="CloseB" Content="Close Utility" HorizontalAlignment="Left" Margin="380,161,0,0" VerticalAlignment="Top" Width="127" Height="24"/>
    </Grid>
</Window>
"@

$RawXamlForm = $RawXamlForm -replace 'x:', ''
[xml]$XamlForm = $RawXamlForm
$XMLReader = (New-Object System.Xml.XmlNodeReader $XamlForm)
$ChangeProxyForm = [Windows.Markup.XamlReader]::Load($XMLReader)
$XamlForm.SelectNodes("//*[@Name]") | Foreach-Object {Set-Variable -Name ($_.Name) -Value $ChangeProxyForm.FindName($_.Name)}

#'HKEY_USERS\S-1-5-21-3215338630-3058045017-314744653-1000\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
#'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
#'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'

function Disable-Change {
    $ChangeProxyServer.IsReadOnly = $true
    $ChangeProxyPort.IsReadOnly = $true
    $ChangeProxyB.IsEnabled = $false
    $EnableProxy.IsEnabled = $false
}
function Enable-Change {
    $ChangeProxyServer.IsReadOnly = $false
    $ChangeProxyPort.IsReadOnly = $false
    $ChangeProxyB.IsEnabled = $true
    $EnableProxy.IsEnabled = $true
}

function Get-CurrentProxyInfo {
    try {
        $Script:CurrentInternetProxyInfo = Get-ItemProperty -Path $RegKey -ErrorAction Stop
        $CurrentProxyInfo = $Script:CurrentInternetProxyInfo.ProxyServer -split ':'
        Switch ($Script:CurrentInternetProxyInfo.ProxyEnable) {
           0 {$CProxyStatusLabel.Content = 'Proxy is Disabled'}
           1 {$CProxyStatusLabel.Content = 'Proxy is Enabled'}
           default {$CProxyStatusLabel.Content = 'Unknown Setting'}
        }
        $CProxyServerBox.Text = $CurrentProxyInfo[0]
        $CProxyPortBox.Text = $CurrentProxyInfo[1]
        Enable-Change
    }
    catch {
        $CProxyServerBox.Text = "You don't have permissions to read registry"
        Disable-Change
    }
}
Function Set-NewProxyConfiguration {
    if ($ChangeProxyPort.Text -match '\d' -and $ChangeProxyServer.Text -ne 'Type Valid Proxy server and Port no') {
        try {
            Switch ($EnableProxy.IsChecked) {
                True {Set-ItemProperty -Path $RegKey -Name ProxyEnable -Value 1 -ErrorAction Stop}
                False {Set-ItemProperty -Path $RegKey -Name ProxyEnable -Value 0 -ErrorAction Stop}
            }
            $NewProxy = "{0}:{1}" -f $ChangeProxyServer.Text, $ChangeProxyPort.Text
            Set-ItemProperty -Path $RegKey -Name ProxyServer -Value $NewProxy -ErrorAction Stop
        }
        catch {
            $ChangeProxyServer.Text = "You don't have permissions to read registry"
            Disable-Change
        }
    }
    Get-CurrentProxyInfo
}

Try {
    $Path = Split-Path $MyInvocation.MyCommand.Path -Parent -ErrorAction Stop
    $LogoImage.Source = "$Path\Proxy_Change.png"
}
Catch {
    
}
$RegKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
$UrlLabel.Add_MouseDoubleClick({[system.Diagnostics.Process]::start('http://vcloud-lab.com')})
$CloseB.Add_Click({$ChangeProxyForm.Close()})
$RefreshB.Add_Click({Get-CurrentProxyInfo})
Get-CurrentProxyInfo
$ChangeProxyB.Add_Click({Set-NewProxyConfiguration})

$ChangeProxyForm.Add_MouseDown({$ChangeProxyForm.DragMove()}) 
[void]$ChangeProxyForm.ShowDialog()
#ProxyEnable = 1  #1 = enabled & 0 = Disabled
#ProxyServer = 'OldProxyServer:808'

Useful Tools
COOL POWERSHELL FREE ONLINE GUI GENERATOR TOOL, POSHGUI
Generate random password GUI using powershell
Part 1: Create WPF XAML powershell GUI form with Visual studio
Powershell PoshGUI: Convert user to SID and vice versa using

vMotion from all VMs on selected Esxi Host to other Esxi host via PowerCLI GUI

Currently I am doing complete VMware environment upgrade in my office in terms of hardware as well, After few plans I found most of my Esxi servers in VMWare clusters in my office were over committed. First question was by my boss was how do we perform it without degrading current VMs performance. To tackle this we had few spare esxi servers, which we utilized for this purpose. Adding this Esxi to existing cluster, after adding them to clusters, there was another concern of EVC (Vmware Enhanced vMotion compatibilty), to address this I already had written separate script and article Powercli GUI: Determine the EVC Mode that vmware cluster should be configured

Everything was going good, but while putting a ESXi host into maintenance mode and initiating multiple vMotion once at a time I observed slowness on VMs accessing them over the network, there was also slowness between application in terms of network (for example when heavy I/O intending application trying to read/write backend database also backups over networks slowing down), This was specifically happening on the little bit legacy Esxi servers and they were still using 1 Gig network adapters. Multiple vMotion were saturating complete network bandwidth.

This is helping me in the scenario when I add new empty ESXi and vacate esxi with one go, also I wanted a virtual machine to be migrated one at a time, once previous vMotion finished. Also on few clusters DRS (distributed resource sceduler) was not available, I wrote this graphical powercli script, using .net winforms, After executing it graphical user interface looks like below.

After execution of this GUI essentially it first asks for vCenter to login, Once login is successful, It shows complete list of Clusters on the vCenter server, After choosing cluster it shows the ESXi server in Source and destination ESXi server along with VMs list from Source Esxi, Make your selection here on source and destination ESXi and click button Migrate-VMs, this will start emptying out Source Esxi and migrate VMs to destination esxi host, Once task is completed you can easily logoff from vCenter server and close tool.

To run this script there are certain requirements, I wrote and tested it on Windows 10, also used PowerCLI version 6.5 with PrimalForms community edition.
VMWARE VSPHERE POWERCLI INSTALLATION AND CONFIGURATION STEP BY STEP
POWERCLI INITIALIZE-POWERCLI ENVIRONMENT.PS1 CANNOT BE LOADED BECAUSE RUNNING SCRIPTS IS DISABLED 

graphical user interface powercli, vmware vsphere esxi, gui powercli, migrate vm, virtual machines cluster vmhost from, script

You can download this script here also This powercli script is available on Github.com

 #Designed and created by Kunal: http://vcloud-lab.com   
 #Tools used  
   #Windows 10  
   #Powercli 6.5  
   #PrimalForms Community Edition  
   
 #region Import the Assemblies  
 [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null  
 [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null  
 #endregion  
   
 #region Generated Form Objects  
 $vCenterForm = New-Object System.Windows.Forms.Form  
 $vcloudurl = New-Object System.Windows.Forms.LinkLabel  
 $LastVM = New-Object System.Windows.Forms.Label  
 $listlabel = New-Object System.Windows.Forms.Label  
 $CurrentVM = New-Object System.Windows.Forms.Label  
 $RemCount = New-Object System.Windows.Forms.Label  
 $RemainingCount = New-Object System.Windows.Forms.Label  
 $dataGrid1 = New-Object System.Windows.Forms.DataGrid  
 $DestEsxiLabel = New-Object System.Windows.Forms.Label  
 $ESXiInfo = New-Object System.Windows.Forms.Button  
 $MigrateVM = New-Object System.Windows.Forms.Button  
 $logoffvcenter = New-Object System.Windows.Forms.Button  
 $SourceEsxiLabel = New-Object System.Windows.Forms.Label  
 $DestinationEsxi = New-Object System.Windows.Forms.ComboBox  
 $SourceEsxi = New-Object System.Windows.Forms.ComboBox  
 $ClusterList01 = New-Object System.Windows.Forms.CheckedListBox  
 $vCenterServer = New-Object System.Windows.Forms.TextBox  
 $statusBar1 = New-Object System.Windows.Forms.StatusBar  
 $LoginvCenter = New-Object System.Windows.Forms.Button  
 $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState  
 $Info = New-Object System.Windows.Forms.Label  
   
 #----------------------------------------------  
 #region Generated Form Code  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 540  
 $System_Drawing_Size.Width = 659  
 $vCenterForm.ClientSize = $System_Drawing_Size  
 $vCenterForm.DataBindings.DefaultDataSourceUpdateMode = 0  
 $vCenterForm.Name = "vCenterForm"  
 $vCenterForm.Text = "Migrate VMs from one ESXi to another"  
   
 $Info.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 517  
 $System_Drawing_Point.Y = 88  
 $Info.Location = $System_Drawing_Point  
 $Info.Name = "Info"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 33  
 $System_Drawing_Size.Width = 75  
 $Info.Size = $System_Drawing_Size  
 $Info.TabIndex = 17  
 $Info.Text = "Windows 10  Powercli 6.5"  
 $Info.add_Click($handler_label1_Click)  
   
 $vCenterForm.Controls.Add($Info)  
   
 $vcloudurl.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 478  
 $System_Drawing_Point.Y = 486  
 $vcloudurl.Location = $System_Drawing_Point  
 $vcloudurl.Name = "vcloudurl"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 114  
 $vcloudurl.Size = $System_Drawing_Size  
 $vcloudurl.TabIndex = 15  
 $vcloudurl.TabStop = $True  
 $vcloudurl.Text = "http://vcloud-lab.com"  
 $vcloudurl.add_Click({[system.Diagnostics.Process]::start('http://vcloud-lab.com')})   
 $vCenterForm.Controls.Add($vcloudurl)  
   
 $logoffvcenter.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 13  
 $System_Drawing_Point.Y = 485  
 $logoffvcenter.Location = $System_Drawing_Point  
 $logoffvcenter.Name = "logoffvcenter"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 127  
 $logoffvcenter.Size = $System_Drawing_Size  
 $logoffvcenter.TabIndex = 16  
 $logoffvcenter.Text = "LogOff-vCenter"  
 $logoffvcenter.UseVisualStyleBackColor = $True  
 $logoffvcenter.add_Click($logoffvcenter_OnClick)  
   
 $vCenterForm.Controls.Add($logoffvcenter)  
   
 $LastVM.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 147  
 $System_Drawing_Point.Y = 406  
 $LastVM.Location = $System_Drawing_Point  
 $LastVM.Name = "LastVM"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 29  
 $System_Drawing_Size.Width = 446  
 $LastVM.Size = $System_Drawing_Size  
 $LastVM.TabIndex = 13  
 $LastVM.Text = "Last VM Migrated"  
 $LastVM.Font = 'Microsoft Sans Serif,14'  
   
 $vCenterForm.Controls.Add($LastVM)  
   
 $CurrentVM.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 146  
 $System_Drawing_Point.Y = 339  
 $CurrentVM.Location = $System_Drawing_Point  
 $CurrentVM.Name = "CurrentVM"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 54  
 $System_Drawing_Size.Width = 446  
 $CurrentVM.Size = $System_Drawing_Size  
 $CurrentVM.TabIndex = 12  
 $CurrentVM.Text = "Current VM"  
 $CurrentVM.Font = 'Microsoft Sans Serif,16'  
   
 $vCenterForm.Controls.Add($CurrentVM)  
   
 $RemCount.BackColor = [System.Drawing.Color]::FromArgb(255,0,192,192)  
 $RemCount.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 13  
 $System_Drawing_Point.Y = 380  
 $RemCount.Location = $System_Drawing_Point  
 $RemCount.Name = "RemCount"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 103  
 $System_Drawing_Size.Width = 127  
 $RemCount.Size = $System_Drawing_Size  
 $RemCount.TabIndex = 11  
 $RemCount.Text = 0  
 $RemCount.TextAlign = 32  
 $RemCount.Font = 'Microsoft Sans Serif,40'  
   
 $vCenterForm.Controls.Add($RemCount)  
   
 $RemainingCount.BackColor = [System.Drawing.Color]::FromArgb(255,0,128,128)  
 $RemainingCount.DataBindings.DefaultDataSourceUpdateMode = 0  
 $RemainingCount.ForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 13  
 $System_Drawing_Point.Y = 339  
 $RemainingCount.Location = $System_Drawing_Point  
 $RemainingCount.Name = "RemainingCount"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 41  
 $System_Drawing_Size.Width = 127  
 $RemainingCount.Size = $System_Drawing_Size  
 $RemainingCount.TabIndex = 10  
 $RemainingCount.Text = "Remaing VMs count to migrate"  
 $RemainingCount.TextAlign = 32  
   
 $vCenterForm.Controls.Add($RemainingCount)  
   
 $dataGrid1.DataBindings.DefaultDataSourceUpdateMode = 0  
 $dataGrid1.DataMember = ""  
 $dataGrid1.HeaderForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)  
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 12  
 $System_Drawing_Point.Y = 213  
 $dataGrid1.Location = $System_Drawing_Point  
 $dataGrid1.Name = "dataGrid1"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 119  
 $System_Drawing_Size.Width = 581  
 $dataGrid1.Size = $System_Drawing_Size  
 $dataGrid1.TabIndex = 9  
   
 $vCenterForm.Controls.Add($dataGrid1)  
   
 $DestEsxiLabel.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 90  
 $System_Drawing_Point.Y = 186  
 $DestEsxiLabel.Location = $System_Drawing_Point  
 $DestEsxiLabel.Name = "DestEsxiLabel"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 139  
 $DestEsxiLabel.Size = $System_Drawing_Size  
 $DestEsxiLabel.TabIndex = 8  
 $DestEsxiLabel.Text = "Destination ESXi server"  
   
 $vCenterForm.Controls.Add($DestEsxiLabel)  
   
 $SourceEsxiLabel.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 90  
 $System_Drawing_Point.Y = 158  
 $SourceEsxiLabel.Location = $System_Drawing_Point  
 $SourceEsxiLabel.Name = "SourceEsxiLabel"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 139  
 $SourceEsxiLabel.Size = $System_Drawing_Size  
 $SourceEsxiLabel.TabIndex = 7  
 $SourceEsxiLabel.Text = "Source ESXi server"  
   
 $vCenterForm.Controls.Add($SourceEsxiLabel)  
   
 $DestinationEsxi.DataBindings.DefaultDataSourceUpdateMode = 0  
 $DestinationEsxi.FormattingEnabled = $True  
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 235  
 $System_Drawing_Point.Y = 186  
 $DestinationEsxi.Location = $System_Drawing_Point  
 $DestinationEsxi.Name = "DestinationEsxi"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 21  
 $System_Drawing_Size.Width = 358  
 $DestinationEsxi.Size = $System_Drawing_Size  
 $DestinationEsxi.TabIndex = 6  
   
 $vCenterForm.Controls.Add($DestinationEsxi)  
   
 $SourceEsxi.DataBindings.DefaultDataSourceUpdateMode = 0  
 $SourceEsxi.FormattingEnabled = $True  
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 235  
 $System_Drawing_Point.Y = 158  
 $SourceEsxi.Location = $System_Drawing_Point  
 $SourceEsxi.Name = "SourceEsxi"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 21  
 $System_Drawing_Size.Width = 358  
 $SourceEsxi.Size = $System_Drawing_Size  
 $SourceEsxi.TabIndex = 5  
   
 $vCenterForm.Controls.Add($SourceEsxi)  
   
 $MigrateVM.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 452  
 $System_Drawing_Point.Y = 126  
 $MigrateVM.Location = $System_Drawing_Point  
 $MigrateVM.Name = "MigrateVM"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 140  
 $MigrateVM.Size = $System_Drawing_Size  
 $MigrateVM.TabIndex = 18  
 $MigrateVM.Text = "Migrate-VMs"  
 $MigrateVM.UseVisualStyleBackColor = $True  
 $MigrateVM.add_Click($MigrateVM_OnClick)  
 $MigrateVM.Enabled = $false  
   
 $vCenterForm.Controls.Add($MigrateVM)  
   
 $ClusterList01.DataBindings.DefaultDataSourceUpdateMode = 0  
 $ClusterList01.FormattingEnabled = $True  
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 13  
 $System_Drawing_Point.Y = 42  
 $ClusterList01.Location = $System_Drawing_Point  
 $ClusterList01.Name = "ClusterList01"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 79  
 $System_Drawing_Size.Width = 423  
 $ClusterList01.Size = $System_Drawing_Size  
 $ClusterList01.TabIndex = 3  
 $ClusterList01.CheckOnClick = $True  
   
 $vCenterForm.Controls.Add($ClusterList01)  
   
 $listlabel.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 452  
 $System_Drawing_Point.Y = 42  
 $listlabel.Location = $System_Drawing_Point  
 $listlabel.Name = "listlabel"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 41  
 $System_Drawing_Size.Width = 141  
 $listlabel.Size = $System_Drawing_Size  
 $listlabel.TabIndex = 17  
 $listlabel.Text = "Clusters List"  
 $listlabel.Font = 'Microsoft Sans Serif,14'  
   
 $vCenterForm.Controls.Add($listlabel)  
   
 $vCenterServer.DataBindings.DefaultDataSourceUpdateMode = 0  
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 165  
 $System_Drawing_Point.Y = 12  
 $vCenterServer.Location = $System_Drawing_Point  
 $vCenterServer.Name = "vCenterServer"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 20  
 $System_Drawing_Size.Width = 428  
 $vCenterServer.Size = $System_Drawing_Size  
 $vCenterServer.TabIndex = 2  
   
 $vCenterForm.Controls.Add($vCenterServer)  
   
 $statusBar1.DataBindings.DefaultDataSourceUpdateMode = 0  
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 0  
 $System_Drawing_Point.Y = 518  
 $statusBar1.Location = $System_Drawing_Point  
 $statusBar1.Name = "statusBar1"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 22  
 $System_Drawing_Size.Width = 659  
 $statusBar1.Size = $System_Drawing_Size  
 $statusBar1.TabIndex = 1  
   
 $vCenterForm.Controls.Add($statusBar1)  
   
   
 $LoginvCenter.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 13  
 $System_Drawing_Point.Y = 11  
 $LoginvCenter.Location = $System_Drawing_Point  
 $LoginvCenter.Name = "LoginvCenter"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 146  
 $LoginvCenter.Size = $System_Drawing_Size  
 $LoginvCenter.TabIndex = 0  
 $LoginvCenter.Text = "Login-vCenter"  
 $LoginvCenter.UseVisualStyleBackColor = $True  
 $LoginvCenter.add_Click($LoginvCenter_OnClick)  
   
 $vCenterForm.Controls.Add($LoginvCenter)  
   
   
 $ESXiInfo.DataBindings.DefaultDataSourceUpdateMode = 0  
   
 $System_Drawing_Point = New-Object System.Drawing.Point  
 $System_Drawing_Point.X = 13  
 $System_Drawing_Point.Y = 127  
 $ESXiInfo.Location = $System_Drawing_Point  
 $ESXiInfo.Name = "ESXiInfo"  
 $System_Drawing_Size = New-Object System.Drawing.Size  
 $System_Drawing_Size.Height = 23  
 $System_Drawing_Size.Width = 146  
 $ESXiInfo.Size = $System_Drawing_Size  
 $ESXiInfo.TabIndex = 16  
 $ESXiInfo.Text = "Get-EsxiInfo"  
 $ESXiInfo.UseVisualStyleBackColor = $True  
 $ESXiInfo.add_Click($ESXiInfo_OnClick)  
 $ESXiInfo.Enabled = $false  
   
 $vCenterForm.Controls.Add($ESXiInfo)  
   
 #endregion Generated Form Code  
   
 #Save the initial state of the form  
 $InitialFormWindowState = $vCenterForm.WindowState  
 #Init the OnLoad event to correct the initial state of the form  
 $vCenterForm.add_Load($OnLoadForm_StateCorrection)  
   
 #region code here  
 function Show-FormOnTop {  
   $vCenterForm.TopMost = $true  
   $vCenterForm.TopMost = $false  
 }  
 Show-FormOnTop  
   
 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 Disconnect-vCenter {  
     
   try {  
     Disconnect-VIServer * -Confirm:$false -ErrorAction Stop  
     $ClusterList01.Items.Clear()  
   }  
   catch {  
     #Show-MessageBox -Message $error[0].Exception.Message -Title 'Error Connecting vCenter' | Out-Null  
   }  
 }  
   
 Function Connect-vCenter {  
   param (  
     [parameter(Mandatory=$true)]  
     [string]$vCenterName  
   )  
   Confirm-Powercli  
   Show-FormOnTop  
   if ($Global:DefaultVIServer -ne $null) {  
     Disconnect-vCenter  
   }  
   if (($vCenterServer.Text -eq $vCenterNameWaterMark) -or ($vCenterServer.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 {  
       $cred = Get-Credential  
       Connect-VIServer $vCenterName -Credential $Cred -ErrorAction Stop #| Out-Null  
       $Script:ClusterName = Get-Cluster  
       if ($Script:ClusterName -ne $null) {  
         $ClusterList01.Items.AddRange($Script:ClusterName.Name)  
       }  
       else {  
         Show-MessageBox -Message 'No cluster found in current vCenter' -Title 'Error: No cluster to select' | Out-Null  
       }  
     }  
     catch {  
       Show-FormOnTop  
       Show-MessageBox -Message $error[0].Exception.Message -Title 'Error Connecting vCenter' | Out-Null  
     }  
   }  
   Show-FormOnTop  
   $statusBar1.Text = 'Connected to vCenter successfully'  
 }  
   
 $vCenterNameWaterMark = 'Type vCenter server or IP'  
 $vCenterServer.Text = $vCenterNameWaterMark  
 $vCenterServer.ForeColor = 'DarkGray'  
 $vCenterServer.add_TextChanged({$vCenterServer.ForeColor = 'Black'})  
   
 $LoginvCenter.add_click({  
   Connect-vCenter -vCenterName $vCenterServer.Text.Trim()  
   Show-FormOnTop  
 })  
   
 $ClusterList01.add_ItemCheck({  
   $ESXiInfo.Enabled = $True  
 })  
   
 function Add-ComboBoxItem {  
   $Clusters = $script:ClusterName | Where-Object {$_.Name -in $ClusterList01.CheckedItems}  
   $Script:EsxiHosts = $Clusters | Get-VMHost | Where-Object {$_.ConnectionState -eq 'Connected' -and $_.PowerState -eq 'PoweredOn'}  
   if ($Script:EsxiHosts -eq $null) {  
     Show-MessageBox -Message "No esxi host found in selected cluster" -Title 'Select Cluster'  
     $MigrateVM.Enabled = $false  
   }  
   else {  
     $SourceEsxi.Items.AddRange($EsxiHosts.Name)  
     $SourceEsxi.Text = $SourceEsxi.Items[0]  
     $DestinationEsxi.Items.AddRange($EsxiHosts.Name)  
     $DestinationEsxi.Text = $SourceEsxi.Items[1]  
     $MigrateVM.Enabled = $True  
     Update-VMDataGrid  
   }  
 }  
   
 function Update-VMDataGrid {  
   $SourceEsxiInfo = $Script:EsxiHosts | Where-Object {$_.Name -eq $SourceEsxi.Text}  
   $Script:VMlist = $SourceEsxiInfo | Get-VM  
   if ($Script:VMlist -eq $null) {  
     Show-MessageBox -Message "No VMs found in selected source esxi" -Title 'Select an'  
   }  
   else {  
     $ArrayList = New-Object System.Collections.ArrayList  
     $VMs = $Script:VMlist | Select-Object Name, NumCpu, MemoryGB, PowerState  
     if ($VMs -ne $null) {  
       $ArrayList.AddRange($VMs)  
       $dataGrid1.DataSource = $ArrayList  
       $dataGrid1.ReadOnly = $True  
       $RemCount.text = $VMs.Count  
     }  
     else {  
       $statusBar1.Text = "Selected source esxi host doesn't have any VMs"  
     }  
   }  
 }  
   
 $ESXiInfo.Add_click({  
   $SourceEsxi.Items.Clear()  
   $DestinationEsxi.Items.Clear()  
   if ($ClusterList01.CheckedItems.Count -eq 0) {  
     Show-MessageBox -Message 'Choose atleast one Cluster from list' -Title 'Select cluster' | Out-Null  
   }  
   Add-ComboBoxItem  
 })  
   
 function Change-DestCombobox {  
   Show-MessageBox -Message 'Source and destination esxi servers are same' -Title 'Esxi name conflict' | Out-Null  
   $dataGrid1.DataSource = $null  
   $DestinationEsxi.Text = $SourceEsxi.Items[$SourceEsxi.SelectedIndex - 1]  
   $statusBar1.Text = 'Source and destination Esxi should different'  
 }  
   
 $SourceEsxi.Add_TextChanged({  
   if ($DestinationEsxi.Text -eq $SourceEsxi.Text) {  
     Change-DestCombobox  
   }  
   Update-VMDataGrid  
 })  
   
 $DestinationEsxi.Add_TextChanged({  
   if ($DestinationEsxi.Text -eq $SourceEsxi.Text) {  
     Change-DestCombobox  
   }  
 })  
   
 $MigrateVM.Add_Click({  
   $ConfirmMigrate = Show-MessageBox -Message 'Do you want to start migrating VMs' -Title 'Start VM migration' -Button 4 -Icon Question  
   $DestEsxi = Get-VMHost $DestinationEsxi.Text  
   $VMCount = $Script:VMlist.Count  
   if ($ConfirmMigrate -eq 'Yes') {  
     foreach ($VM in $Script:VMlist)     {  
       $CurrentVM.Text = "Currently migrating VM: $($VM.Name)"  
       $vCenterForm.Refresh()  
       try {  
         $VM | Move-VM -Destination $DestEsxi -ErrorAction Stop  
         $VMCount--  
         $LastVM.Text = "Last VM migrated: $($VM.Name)"  
       }  
       catch {  
         $statusBar1.Text = 'Few VMs cannot be migrated, check manually'  
       }  
       $RemCount.Text = $VMCount  
       $vCenterForm.Refresh()  
       Show-FormOnTop  
     }       
     $CurrentVM.Text = 'All VMs Migrated'  
   }  
 })  
   
 $logoffvcenter.Add_Click({  
   Disconnect-vCenter  
   $ESXiInfo.Enabled = $false  
   $dataGrid1.DataSource.Clear()  
   $MigrateVM.Enabled = $false  
   $SourceEsxi.Items.Clear()  
   $DestinationEsxi.Items.Clear()  
   $statusBar1.Text = 'Disconnected vCenter successfully'  
 })  
   
 #endregion Code here  
 Show-FormOnTop  
 #Show the Form  
 $vCenterForm.ShowDialog()| Out-Null  

Useful articles
POWERCLI: VMWARE ESXI CONFIGURE (VSWITCH) VMKERNEL NETWORK PORT FOR ISCSI STORAGE
POWERCLI VMWARE: CONFIGURE SOFTWARE ISCSI STORAGE ADAPTER AND ADD VMFS DATASTORE
POWERCLI: VIRTUAL MACHINE STORAGE MIGRATE/SVMOTION AND DATASTORE PORT BINDING MULTIPATHING

How to convert RDM disk (Raw Device Mapping) to VMDK

In my previous article I shown Adding and sharing RDM disk to multiple VMs in VMware step by step, I received one related task to convert virtual machine RDM (Raw device mapping) hard disk to VMDK disk. Basically I require it to convert because, I was not going to use microsoft clustering anymore, also I was planning to change backend storage due to end of life. To complete this task, you have to just vMotion the rdm disk to another datastore changing disk type. Before doing it make ensure  RDM disk compatibility mode must be Virtual mode, (Physical RDM disk cannot be changed VMDK). Here I have one with Physical RDM, To convert it to Virtual, go to VM edit settings, and expand the hard disk information. Click remove cross button on the same.

vmware vsphere esxi virtual machine rdm raw device mapping disk vmdk convert hard disk phyiscal compatibility mode, physical lun virtual device node iscsi, vm edit settings

Once hard disk remove is pressed, Check the box Delete files from datastore, Note, this device will be removed. but it is safe to remove, as you are just removing RDM pointer file, actual data is still on remote storage device. Click OK button to proceed.

vmware vsphere esxi virtual machine vm edit settings harddisk rdm convert to vmdk remove datastore, vml, compatibility mode physical

Now add same lun as new RDM hard disk, which still has data and change it's compatibility mode to Virtual. Click Ok.

For more on adding new RDM check Adding and sharing RDM disk to multiple VMs in VMware step by step.

vmware vsphere esxi virtual machine vm edit settings, new hard disk, add rdm, raw device mapping compatibility mode virtual disk vml, convert rdm to vmdk easy process

Next right click virtual machine and from VMs actions context menu click Migrate, in the wizard select the migration type to change storage only. (Migrate the virtual machines's storage to a compatible datastore or datastore cluster)

vmware vsphere esxi migrate storage vmotion, change storage, convert RDM to raw device mapping easy way, raw lun, migrate type

In the next select storage here I can move entire VM to different datastore, but I am migrating only RDM disk, for this click Advanced button. From here select the new storage location for RDM and next change disk format to any of the one from 3 type - Thick provision lazy Zeroed, Thick provision eagar zeroed and Thin provision. I am selecting thin. Make sure compatibility checks succeeded and it is green. On the next ready to complete review the changes and click finish to start migration.

vmware vsphere esxi vm virtual machine storage migration vmotion, select storage datastore hard disk format, RDM raw device mappping thin, thick provision.png

This will take time based on disk size. Here you can see the Recent Tasks has Relocate virtual machine is completed.

vmware vsphere esxi vm virtual machine vmotion migrate relocate virtual machine recent tasks status completed validation succeeded successfully

Now, again going to Edit settings of virtual machine, I see disk is VMDK now with type Thin provision. To reclaim raw disk back, Rescan datastores on esxi hosts. 

vmware vsphere esxi vm, virtual machine edit settings hard disk convert rdm to vmdk raw device mappping vmdk, shared type, extend vmdk

Useful articles
POWERCLI: VMWARE ESXI CONFIGURE (VSWITCH) VMKERNEL NETWORK PORT FOR ISCSI STORAGE
POWERCLI VMWARE: CONFIGURE SOFTWARE ISCSI STORAGE ADAPTER AND ADD VMFS DATASTORE
POWERCLI: VIRTUAL MACHINE STORAGE MIGRATE/SVMOTION AND DATASTORE PORT BINDING MULTIPATHING
Emulate HDD as SSD flash disk on Esxi and VMware workstation

ESXi 6.0 update offline bundle via esxcli commandline: DependencyError VIB bootbank requires VSAN ImageProfile

After completing updating my most of the ESXi 6.5 hosts in the environment as shown in ESXi 6.5 upgrade bundle via command line: No Space Left On Device Error, I wanted few standalone ESXi server to update to 6.0 version, for same offline bundle can be downloaded from my.vmware.com. I uploaded copy the update zip file on one of the connected datastore to ESXi Upload files to vmware ESXi datastore: Different methods. While running below update command I ran into error.

vSphere products distinguish between upgrades, which make major changes to the software, and updates, which make smaller changes to the software.

esxcli software vib update -d /vmfs/volumes/Share-Disk01/Esxi600-201611001.zip

[DependencyError]
VIB VMware_bootbank_esx_base_6.0.0-2.52.4600944 requires vsan << 6.0.0-2.53, but the requirement cannot be satisfied within the ImageProfile.
VIB VMware_bootbank_esx_base_6.0.0-2.52.4600944 requires vsan >= 6.0.0-2.52, but the requirement cannot be satisfied within the ImageProfile.

vmware esxi vsphere vcenter, ls -lh Esxi, vmfs volume datastore file, esxcli software vib update, datastore guid. vmware vib bootbank, offline bundle.png

To resolve this issue, this offline bundle should be updated using profile update. First I need to verify what profiles are exists in ESXi offline bundle using esxcli command line.
esxcli software sources profile list -d /vmfs/volumes/Share-Disk01/Esxi600-201611001.zip

This shows me 4 profiles and I will be using first name for update. Next command start update.
esxcli software profile update -d /vmfs/volumes/Share-Disk01/Esxi600-201611001.zip -p ESXi-6.0.0-20161104001-standard

Update Result
     Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
     Reboot Required: true

vmware vsphere esxi vcenter ssh standalone upgrade, vmware -v, esxcli software sources profile list, esxcli software profile update, ssh upgrade install - depot offline bundle

Once server is rebooted I can see vmware version using vmware -v or in the vsphere web client.

vmware vsphere esxi update, esxcli upgare image profile, vmware -v, configuration image profile, offline bundle upgrade esxi server vmware -v version and build number check

Useful Articles
VMWARE VSPHERE UPDATE MANAGER (VUM) - IMPORTING ESXI ISO AND CREATE UPGRADE BASELINE
VMWARE VSPHERE UPDATE MANAGER (VUM) - UPGRADE ESXI OS
VMWARE VCENTER 6.5 UPGRADATION ERROR
THERE WAS ERROR CONNECTING VMWARE VSPHERE UPDATE MANAGER [VCENTER:443] DATABASE TEMPORARILY UNAVAILABLE OR HAS NETWORK PROBLEMS

ESXi HP Blade start issue Enclosure power event detected, System Halted until power condition is corrected

Sometimes I receive below error on the HP Prolient Bladesystem ILO after server reboot, it refuses to complete post, shows message, 
Enclouse Power Even Detected
System Halted until Power Condition is Corrected

In most of the case to resolve it I reseat the blade in chassis enclosure (Remove blade and reinsert it again). This way issue is resolved by completely removing power source for that particular blade server.

vmware vCenter esxi HP Prolient blade enclosure power event detected halted until power condition is corrected, esxi server boot issues resolved, bay hp oa, onboard administrator .png

Most of the time servers are located in remote country and I have to take peer remote local administrator help to do the reseat blade server. This issue can be resolved from command line if you have complete information about Enclosure also called Active Onboard Administrator. To view info, Go to BL c-CLass menu, click on Active Onboard Administrator. Check the Blade location, in my case it is number 6.  Also note down the OA IP address this will require to putty later. Click launch button to open OA GUI.  

vmware vsphere esxi active onboard administrator hp prolient bladesystem enclosure, BL class launch OA, HP ILO esxi server

On the HPE BladeSystem Onboard Administrator again verify the device bay location. This is the same as shown in above screenshot.

1 HPE bladesystem Onboard Administrator, OA Vmware vsphere esxi, firmware upgrade device bay blade server, restart issue, hewlett Packard

Now open putty and log into HPE BladeSystem Onboard Administrator and run command RESET SERVER 6, this command is case sensitive, it shows user friendly message what will happen next.

Warning: Resetting the server trips its E-Fuse. This causes all power to be momentarily removed from the server. This command should only be used when physical access to the server is unavailable, and the server must be removed and reinsterted.

Any disk operations on direct attached storage devices will be affected. I/O will be interrupted on any direct attached I/O devices.

Entering anything other than 'YES' will result in the command not executing.

Type YES to proceed, it shows successful message - Successfully reset the E-Fuse for device bay 6.

2 vmware vsphere esxi, onboard administrator reset server blade device bay warning E-fuse hp system vmware vsphere esxi vcenter

As this completely power cycles blade, ILO will be inaccessible for a few minutes. Once it is accessible it can be viewed Post/reboot is successful in ILO remote console.

vmware vsphere esxi vcenter HP prolient bladesystem enclosure firmware upgrade cannot boot, stuck on power event detected

Useful Articles
Resolved: HP ILO this page cannot be displayed ERR_SSL_BAD_RECORD_MAC_ALERT
Reset/Restart HP ILO (Integrated Lights-outs) using putty
Reset HP ILO password from Esxi server

ESXi 6.5 upgrade bundle via command line: No Space Left On Device Error

I received few standalone ESXi 6.5 hosts for patching for branch office, I wanted to upgrade build number on server, As there was no option of VMWare update manager for standalone esxi. Here I upgraded them using offline bundle zip. These requires offline bundle zip to be be downloaded from url https://my.vmware.com/group/vmware/patch#search directly. It asks for valid login username and password, once logged in successfully, From the right hand side click Products, select Product Patches from drop down list. here you can filter and select the required patch bundles. and start download.

Once file is downloaded, upload,copy it to datastore using information shown on Upload files to vmware ESXi datastore: Different methods

my.vmware.com, my vmware, esxi embedded and installable vmware vsphere esxi product patches, esxi patches offline install, download link.png

Once file is uploaded to datastore, first command shows the existing version and build number, next is common command to update and patch Esxi OS build.
vmware -v
esxcli software vib update -d /vmfs/volumes/Share-Disk01/ESXi650-201803001.zip

While updating I received below error.
 [InstallationError]
 [Errno 28] No space left on device
       vibs = VMware_bootbank_esx-base_6.5.0-1.41.7967591
 Please refer to the log file for more details.

vmware vsphere esxi, esxcli software vib update offline bundle, ssh esxi upgrade esxi code vmware version command line

I checked and verified space using command stat -f / and didn't find any issue related space, there was enough Blocks and Inodes available, infact, only few Inodes where in use. df -h was showing enough available space.

vmware vsphere esxi vcenter, stat -f root, df -h disk space, vmfs6, vmfs5, upload offline esxi bundle, winscp, files datastores free diskspacen used mounted on

System swap is a memory reclamation process that can take advantage of unused memory resources across an entire system. To resolved this directly login to Esxi server UI website, and under Manage > System > Select Swap and click to Edit settings. On the the Edit swap configuration, select the Datastore from drop-down menu.

vmware esxi vsphere, vcenter, vmware esxi manage system swap, edit swap configuration, datastore save, lun storage on swap edit settings

This setting can also be enabled from logging into vCenter directly, Select ESXi server, go to Configure tab then select System Swap, Here Edit System swap settings, and use datastore specified by host for swap files. Under Can use datastore select the datastore and click Ok.

vmware vsphere esxi, web client ui, user interface, esxi configure system swap, can use datastore, ssd

After running the same command again I see installation result is successful as below screenshot, Reboot is required once upgrade is successful.

vmware esxi vsphere vcneter, ssh putty, esxcli software vib update, installation result , update completed successfully reboot, no space left on device.png

[VCLOUD-LAB\vkunal@esxi002:~] esxcli software vib update -d /vmfs/volumes/Share-Disk01/ESXi650-201803001.zip
Installation Result
   Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
   Reboot Required: true
   VIBs Installed: VMW_bootbank_i40en_1.3.1-5vmw.650.1.26.5969303, VMW_bootbank_igbn_0.1.0.0-15vmw.650.1.36.7388607, VMW_bootbank_ixgben_1.4.1-2vmw.650.1.26.5969303, VMW_bootbank_misc-drivers_6.5.0-1.36.7388607, VMW_bootbank_ne1000_0.8.0-16vmw.650.1.26.5969303, VMW_bootbank_ntg3_4.1.3.0-1vmw.650.1.36.7388607, VMW_bootbank_nvme_1.2.0.32-5vmw.650.1.36.7388607, VMW_bootbank_nvmxnet3_2.0.0.23-1vmw.650.1.36.7388607, VMW_bootbank_pvscsi_0.1-1vmw.650.1.26.5969303, VMW_bootbank_qlnativefc_2.1.50.0-1vmw.650.1.26.5969303, VMW_bootbank_sata-ahci_3.0-26vmw.650.1.26.5969303, VMW_bootbank_usbcore-usb_1.0-3vmw.650.1.26.5969303, VMW_bootbank_vmkata_0.1-1vmw.650.1.36.7388607, VMW_bootbank_vmkusb_0.1-1vmw.650.1.36.7388607, VMW_bootbank_vmw-ahci_1.0.0-39vmw.650.1.26.5969303, VMware_bootbank_cpu-microcode_6.5.0-1.41.7967591, VMware_bootbank_esx-base_6.5.0-1.41.7967591, VMware_bootbank_esx-dvfilter-generic-fastpath_6.5.0-1.36.7388607, VMware_bootbank_esx-tboot_6.5.0-1.41.7967591, VMware_bootbank_esx-ui_1.23.0-6506686, VMware_bootbank_esx-xserver_6.5.0-0.23.5969300, VMware_bootbank_lsu-hp-hpsa-plugin_2.0.0-5vmw.650.1.26.5969303, VMware_bootbank_lsu-lsi-lsi-mr3-plugin_1.0.0-10vmw.650.1.26.5969303, VMware_bootbank_lsu-lsi-lsi-msgpt3-plugin_1.0.0-7vmw.650.1.26.5969303, VMware_bootbank_lsu-lsi-megaraid-sas-plugin_1.0.0-8vmw.650.1.26.5969303, VMware_bootbank_lsu-lsi-mpt2sas-plugin_2.0.0-6vmw.650.1.26.5969303, VMware_bootbank_vmware-esx-esxcli-nvme-plugin_1.2.0.10-1.26.5969303, VMware_bootbank_vsan_6.5.0-1.41.7547709, VMware_bootbank_vsanhealth_6.5.0-1.41.7547710, VMware_locker_tools-light_6.5.0-1.33.7273056
   VIBs Removed: VMW_bootbank_i40en_1.1.0-1vmw.650.0.0.4564106, VMW_bootbank_igbn_0.1.0.0-12vmw.650.0.0.4564106, VMW_bootbank_ixgben_1.0.0.0-9vmw.650.0.14.5146846, VMW_bootbank_misc-drivers_6.5.0-0.14.5146846, VMW_bootbank_ne1000_0.8.0-11vmw.650.0.14.5146846, VMW_bootbank_ntg3_4.1.0.0-1vmw.650.0.0.4564106, VMW_bootbank_nvme_1.2.0.32-2vmw.650.0.0.4564106, VMW_bootbank_nvmxnet3_2.0.0.22-1vmw.650.0.0.4564106, VMW_bootbank_pvscsi_0.1-1vmw.650.0.0.4564106, VMW_bootbank_qlnativefc_2.1.30.0-11vmw.650.0.0.4564106, VMW_bootbank_sata-ahci_3.0-22vmw.650.0.0.4564106, VMW_bootbank_usbcore-usb_1.0-3vmw.650.0.0.4564106, VMW_bootbank_vmkata_0.1-1vmw.650.0.0.4564106, VMW_bootbank_vmkusb_0.1-1vmw.650.0.14.5146846, VMW_bootbank_vmw-ahci_1.0.0-34vmw.650.0.14.5146846, VMware_bootbank_cpu-microcode_6.5.0-0.0.4564106, VMware_bootbank_esx-base_6.5.0-0.19.5310538, VMware_bootbank_esx-dvfilter-generic-fastpath_6.5.0-0.0.4564106, VMware_bootbank_esx-tboot_6.5.0-0.0.4564106, VMware_bootbank_esx-ui_1.18.0-5270848, VMware_bootbank_esx-xserver_6.5.0-0.0.4564106, VMware_bootbank_lsu-hp-hpsa-plugin_2.0.0-3vmw.650.0.0.4564106, VMware_bootbank_lsu-lsi-lsi-mr3-plugin_1.0.0-7vmw.650.0.0.4564106, VMware_bootbank_lsu-lsi-lsi-msgpt3-plugin_1.0.0-6vmw.650.0.0.4564106, VMware_bootbank_lsu-lsi-megaraid-sas-plugin_1.0.0-7vmw.650.0.0.4564106, VMware_bootbank_lsu-lsi-mpt2sas-plugin_2.0.0-5vmw.650.0.0.4564106, VMware_bootbank_vmware-esx-esxcli-nvme-plugin_1.2.0.10-0.0.4564106, VMware_bootbank_vsan_6.5.0-0.19.5310540, VMware_bootbank_vsanhealth_6.5.0-0.19.5310541, VMware_locker_tools-light_6.5.0-0.0.4564106
   VIBs Skipped: VMW_bootbank_ata-libata-92_3.00.9.2-16vmw.650.0.0.4564106, VMW_bootbank_ata-pata-amd_0.3.10-3vmw.650.0.0.4564106, VMW_bootbank_ata-pata-atiixp_0.4.6-4vmw.650.0.0.4564106, VMW_bootbank_ata-pata-cmd64x_0.2.5-3vmw.650.0.0.4564106, VMW_bootbank_ata-pata-hpt3x2n_0.3.4-3vmw.650.0.0.4564106, VMW_bootbank_ata-pata-pdc2027x_1.0-3vmw.650.0.0.4564106, VMW_bootbank_ata-pata-serverworks_0.4.3-3vmw.650.0.0.4564106, VMW_bootbank_ata-pata-sil680_0.4.8-3vmw.650.0.0.4564106, VMW_bootbank_ata-pata-via_0.3.3-2vmw.650.0.0.4564106, VMW_bootbank_block-cciss_3.6.14-10vmw.650.0.0.4564106, VMW_bootbank_char-random_1.0-3vmw.650.0.0.4564106, VMW_bootbank_ehci-ehci-hcd_1.0-4vmw.650.0.14.5146846, VMW_bootbank_elxnet_11.1.91.0-1vmw.650.0.0.4564106, VMW_bootbank_hid-hid_1.0-3vmw.650.0.0.4564106, VMW_bootbank_ima-qla4xxx_2.02.18-1vmw.650.0.0.4564106, VMW_bootbank_ipmi-ipmi-devintf_39.1-4vmw.650.0.0.4564106, VMW_bootbank_ipmi-ipmi-msghandler_39.1-4vmw.650.0.0.4564106, VMW_bootbank_ipmi-ipmi-si-drv_39.1-4vmw.650.0.0.4564106, VMW_bootbank_lpfc_11.1.0.6-1vmw.650.0.0.4564106, VMW_bootbank_lsi-mr3_6.910.18.00-1vmw.650.0.0.4564106, VMW_bootbank_lsi-msgpt2_20.00.01.00-3vmw.650.0.0.4564106, VMW_bootbank_lsi-msgpt3_12.00.02.00-11vmw.650.0.0.4564106, VMW_bootbank_misc-cnic-register_1.78.75.v60.7-1vmw.650.0.0.4564106, VMW_bootbank_mtip32xx-native_3.9.5-1vmw.650.0.0.4564106, VMW_bootbank_nenic_1.0.0.2-1vmw.650.0.0.4564106, VMW_bootbank_net-bnx2_2.2.4f.v60.10-2vmw.650.0.0.4564106, VMW_bootbank_net-bnx2x_1.78.80.v60.12-1vmw.650.0.0.4564106, VMW_bootbank_net-cdc-ether_1.0-3vmw.650.0.0.4564106, VMW_bootbank_net-cnic_1.78.76.v60.13-2vmw.650.0.0.4564106, VMW_bootbank_net-e1000_8.0.3.1-5vmw.650.0.0.4564106, VMW_bootbank_net-e1000e_3.2.2.1-2vmw.650.0.0.4564106, VMW_bootbank_net-enic_2.1.2.38-2vmw.650.0.0.4564106, VMW_bootbank_net-fcoe_1.0.29.9.3-7vmw.650.0.0.4564106, VMW_bootbank_net-forcedeth_0.61-2vmw.650.0.0.4564106, VMW_bootbank_net-igb_5.0.5.1.1-5vmw.650.0.0.4564106, VMW_bootbank_net-ixgbe_3.7.13.7.14iov-20vmw.650.0.0.4564106, VMW_bootbank_net-libfcoe-92_1.0.24.9.4-8vmw.650.0.0.4564106, VMW_bootbank_net-mlx4-core_1.9.7.0-1vmw.650.0.0.4564106, VMW_bootbank_net-mlx4-en_1.9.7.0-1vmw.650.0.0.4564106, VMW_bootbank_net-nx-nic_5.0.621-5vmw.650.0.0.4564106, VMW_bootbank_net-tg3_3.131d.v60.4-2vmw.650.0.0.4564106, VMW_bootbank_net-usbnet_1.0-3vmw.650.0.0.4564106,VMW_bootbank_net-vmxnet3_1.1.3.0-3vmw.650.0.0.4564106, VMW_bootbank_nhpsa_2.0.6-3vmw.650.0.0.4564106, VMW_bootbank_nmlx4-core_3.16.0.0-1vmw.650.0.0.4564106, VMW_bootbank_nmlx4-en_3.16.0.0-1vmw.650.0.0.4564106, VMW_bootbank_nmlx4-rdma_3.16.0.0-1vmw.650.0.0.4564106, VMW_bootbank_nmlx5-core_4.16.0.0-1vmw.650.0.0.4564106, VMW_bootbank_ohci-usb-ohci_1.0-3vmw.650.0.0.4564106, VMW_bootbank_qedentv_2.0.3.29-1vmw.650.0.0.4564106, VMW_bootbank_qfle3_1.0.2.7-1vmw.650.0.0.4564106, VMW_bootbank_qflge_1.1.0.3-1vmw.650.0.0.4564106, VMW_bootbank_sata-ata-piix_2.12-10vmw.650.0.0.4564106, VMW_bootbank_sata-sata-nv_3.5-4vmw.650.0.0.4564106, VMW_bootbank_sata-sata-promise_2.12-3vmw.650.0.0.4564106, VMW_bootbank_sata-sata-sil24_1.1-1vmw.650.0.0.4564106, VMW_bootbank_sata-sata-sil_2.3-4vmw.650.0.0.4564106, VMW_bootbank_sata-sata-svw_2.3-3vmw.650.0.0.4564106, VMW_bootbank_scsi-aacraid_1.1.5.1-9vmw.650.0.0.4564106, VMW_bootbank_scsi-adp94xx_1.0.8.12-6vmw.650.0.0.4564106, VMW_bootbank_scsi-aic79xx_3.1-5vmw.650.0.0.4564106, VMW_bootbank_scsi-bnx2fc_1.78.78.v60.8-1vmw.650.0.0.4564106, VMW_bootbank_scsi-bnx2i_2.78.76.v60.8-1vmw.650.0.0.4564106, VMW_bootbank_scsi-fnic_1.5.0.45-3vmw.650.0.0.4564106, VMW_bootbank_scsi-hpsa_6.0.0.84-1vmw.650.0.0.4564106, VMW_bootbank_scsi-ips_7.12.05-4vmw.650.0.0.4564106, VMW_bootbank_scsi-iscsi-linux-92_1.0.0.2-3vmw.650.0.0.4564106, VMW_bootbank_scsi-libfc-92_1.0.40.9.3-5vmw.650.0.0.4564106, VMW_bootbank_scsi-megaraid-mbox_2.20.5.1-6vmw.650.0.0.4564106, VMW_bootbank_scsi-megaraid-sas_6.603.55.00-2vmw.650.0.0.4564106, VMW_bootbank_scsi-megaraid2_2.00.4-9vmw.650.0.0.4564106, VMW_bootbank_scsi-mpt2sas_19.00.00.00-1vmw.650.0.0.4564106, VMW_bootbank_scsi-mptsas_4.23.01.00-10vmw.650.0.0.4564106, VMW_bootbank_scsi-mptspi_4.23.01.00-10vmw.650.0.0.4564106, VMW_bootbank_scsi-qla4xxx_5.01.03.2-7vmw.650.0.0.4564106, VMW_bootbank_shim-iscsi-linux-9-2-1-0_6.5.0-0.0.4564106, VMW_bootbank_shim-iscsi-linux-9-2-2-0_6.5.0-0.0.4564106, VMW_bootbank_shim-libata-9-2-1-0_6.5.0-0.0.4564106, VMW_bootbank_shim-libata-9-2-2-0_6.5.0-0.0.4564106, VMW_bootbank_shim-libfc-9-2-1-0_6.5.0-0.0.4564106, VMW_bootbank_shim-libfc-9-2-2-0_6.5.0-0.0.4564106, VMW_bootbank_shim-libfcoe-9-2-1-0_6.5.0-0.0.4564106, VMW_bootbank_shim-libfcoe-9-2-2-0_6.5.0-0.0.4564106, VMW_bootbank_shim-vmklinux-9-2-1-0_6.5.0-0.0.4564106, VMW_bootbank_shim-vmklinux-9-2-2-0_6.5.0-0.0.4564106, VMW_bootbank_shim-vmklinux-9-2-3-0_6.5.0-0.0.4564106, VMW_bootbank_uhci-usb-uhci_1.0-3vmw.650.0.0.4564106, VMW_bootbank_usb-storage-usb-storage_1.0-3vmw.650.0.0.4564106, VMW_bootbank_vmkplexer-vmkplexer_6.5.0-0.0.4564106, VMW_bootbank_xhci-xhci_1.0-3vmw.650.0.0.4564106, VMware_bootbank_emulex-esx-elxnetcli_11.1.28.0-0.0.4564106, VMware_bootbank_native-misc-drivers_6.5.0-0.0.4564106, VMware_bootbank_rste_2.0.2.0088-4vmw.650.0.0.4564106

After reboot, login to SSH and verify build number with vmware -v command.

vmware vsphere esxi version, vmware -v build version reboot bundle zip update esxcli ssh putty esxi

I can also verify the build number using on Esxi ui web client or vCenter server on summary page.

vmware esxi ui web client summary page hypervisor version build number update, esxcli upload file offline bundle esxi update

Useful Articles
VMWARE VSPHERE UPDATE MANAGER (VUM) - IMPORTING ESXI ISO AND CREATE UPGRADE BASELINE
VMWARE VSPHERE UPDATE MANAGER (VUM) - UPGRADE ESXI OS
VMWARE VCENTER 6.5 UPGRADATION ERROR
THERE WAS ERROR CONNECTING VMWARE VSPHERE UPDATE MANAGER [VCENTER:443] DATABASE TEMPORARILY UNAVAILABLE OR HAS NETWORK PROBLEMS

Upload files to vmware ESXi datastore: Different methods

Copying files to VMware Datastores is an easy task. Here in this article, I am showing 3 different methods to upload files to VMware datastores, You can use these methods to copy offline bundle zip, VIB, VMDK or ISO files. Ifyou are using VMWare vSphere web client to upload files to datastore, make sure DNS server entry is added for esxi server in DNS server

Method 1

Login to Vmware Vsphere web client, Select Esxi server or datastore, on the Configure tab / Manage tab for esxi, Select Storage/ Datastores, right click datastore, where you want to upload files, click Browse Files from context menu. 

vmware vsphere esxi storage datastores shared disk lun disk browse files, upload files to datastore, vcenter.png

Next this shows the Files and folder inside select datastore, click upload a file to the Datastore button. This popup opens new browse file wizard, From list select the file you want to upload and click open.

vmware vsphere esxi, esxi offline bundle shared disk datastore lun storage, upload a file, zip bundle, error no disk space

Next you can monitor the progress of uploading file on selected datastore.

vmware vsphere esxi, datastore upload file, lun storage, upload progress, offline bundle upload datastore files upload, disk space error.png

SubMethod 1.1

In case if you have standalone Esxi server and no vCenter is available, connect directly to Esxi using url https://esxi002.vcloud-lab.com/ui. here you should aware of root password. Files can be copied on directly connected Esxi. As shown in the screenshot, go to storage, double click the the datastore where you want to copy files, select Datastore browser, next from the wizard upload the file, it takes time based on file size.

Reset forgotten ESXi root password on Domain joined Esxi using vSphere web client and Powercli
Reset ESXi root password using Host Profiles on vCenter server: VMWare vSphere Web client
Resolved: Reset Esxi forgotten root password using hiren bootCD step by step

vmware vsphere esxi ui, wb client, datastore browser, upload file, shared disk, powercli, powershell, manage esxi, monitor vsphere vcenter


Method 2

In the next method, File can be uploaded using winscp or any other tool which supports SCP protocol, to use winscp enable SSH service on the esxi first VMWARE SECURITY BEST PRACTICES: POWERCLI ENABLE OR DISABLE ESXI SSH. Login to the ESXi using root password or with domain account. Drag and drop the selected file to right hand side on ESXi server, All the datastores are mounted under /vmfs/volumess.

vmware vsphere esxi vcenter upload esxi offline bundle zip, winscp tool upload file.png


Method 3

This method is my favorite one of using VMware Vsphere powercli to upload files on datastore, VMWARE VSPHERE POWERCLI INSTALLATION AND CONFIGURATION STEP BY STEP. first use Connect-VIServer command to login either vCenter or Esxi server where you want to upload copy file. Once logged in successful, Run command to show valid powershell datastore drives.
Get-PSDrive -PSProvider VimDatastore

Next to list the files and folder within directory use below command, Here from GUI you can see how folder path is listed under datastores view and it consist of foldername, datacenter and datastore name.
dir vmstore:\India\Pune\Share-Disk01

POWERCLI INITIALIZE-POWERCLIENVIRONMENT.PS1 CANNOT BE LOADED BECAUSE RUNNING SCRIPTS IS DISABLED

vmware vsphere esxi, connect-viserver, get-psdrive, dir vmstore, datastore, storage upload files to esxi using powercli, copy-datastoreitem, powershell

In the directory listing I can see the files files and folder, One screenshot is from commandline and another is from vsphere web client. I have already downloaded required vib zip files under folder on my windows system C:\temp\EsxiApps. Start copying file using below command.
Copy-DatastoreItem -Item C:\Temp\EsxiApps\VIb.zip -Destination vmstore:\India\Pune\Share-Disk01

List the directory items using below command again. File should be listed and you can verify the saem from GUI.
dir vmstore:\India\Pune\Share-Disk01

vmware vsphere esxcli, copy-datastoreitem, datastore copy file powercli esxi, get-datastore, vmstore, vib file, offline bundle zip file upload to datastore, install.png

In the next command I am using same task but different way, mounting datastore drive in PowerCLI,
Get-Datastore Share-Disk01 | New-DatastoreDrive -Name DS

Drive is mounted and This command list the new mapped drive.
Get-PSDrive -PSProvider VimDatastore

Now I can directly list the files and folder from the new mapped drive.
Dir Ds:\

And use simmilar drive to copy files to destination mapped drive.
Copy-DatastoreItem -Item C:\Temp\EsxiApps\VIBfile.zip -Destination DS:\
Dir Ds:\

get-datastore, new-datastoredrive, get-psdrive psprovider vimdatatstore, dir, copy-datastoreitem, vmware vsphere vcenter esxi powercli, commandline

In the last one of the method I even used is login to NFS server or upload files to NFS drive directly and copy files. Microsoft Windows 2016 Install and configure NFS server for ESXi and Linux.

Useful Articles
VMWare Web Client: Datastore browse files upload copy failed error
VMWARE ESXI INSTALL AND CONFIGURE SOFTWARE ISCSI STORAGE ADAPTER FOR VMFS VERSION 6 DATASTORE
Unmount NFS datastores from VMware ESXi and NFS is in use

Resolved: Reset Esxi forgotten root password using hiren bootCD step by step

Reset forgotten ESXi root password on Domain joined Esxi using vSphere web client and Powercli
Reset ESXi root password using Host Profiles on vCenter server: VMWare vSphere Web client

This is third part of the above related articles reset forgotten root password on esxi and there is a disclaimer Use this procedure on your own risk because method mentioned here is unsupported by VMware and unofficial. Before making any changes to Esxi make sure you have taken complete Esxi server configuration backup. Also to reset esxi root password using offline ISO, you will require reboot so make sure you plan and put Esxi server into maintenance mode, this will ensure no VMs are running on subjected Esxi host and it is good for activities. This document I created for my colleague who are windows administrator and bit hesitant on using Linux command to make changes, 80% changes are made using Linux user interface.

For this demo, I have downloaded hiren boot cd from url location http://www.hirensbootcd.org/download/. I mostly use either Dell or HP server, and use DRAC and ILO respectively for remote console. Once ISO is mounted on ILO or DRAC of server, Reboot esxi and go to BIOS and change BOOT option to CD-ROM, Exit with saving changes, One more time server is rebooted and ISO boot is loaded.

vmware vsphere esxi physical server bios basic input output, phoenixBios, set boot cd-rom drive, reset esxi server root password

Once server is booted from bootable Hiren's BootCD, Select 3rd option from the  list >> Linux based rescue environment (Parted Magic), and hit enter to start live CD OS.

vmware vsphere esxi hiren bootcd iso 16.2, grub2dos, boot from iso, linux based rescue environment (Parted Magic), reset password esxi

Next hit enter on Start (Options: Language us). This will start loading OS from CD.

reset esxi root password, hiren bootcd start options grub2dos, password reset root esxi vmware vsphere esxi unofficial, unsupported

Once OS is loaded, There is Partition Editor software icon on the desktop, double click it, this loads Gparted utility. Here in the partition lists Esxi configuration is stored on physical hard disk partition /dev/sda5 and /dev/sda6. As Esxi maintains configuration backup, For Esxi 6.5 sda5 partition contains backup of esxi configuration files/folders, and Sda6 has current configuration files and folders.

vmware vsphere esxi reset 6.5 root password dev sda5. hiren bootcd fat 16 partition mount using bootable ubuntu CD dvd, reset any password offline

I am going to mount both the drive one by one first I am going to show it for Sda5 then same configuration need to be done on sda6 as well. First right click on /dev/sda5 and click Mount, then select the mount location to /dev/sda5.

vmware vsphere esxi reset root password using hiren boot cd isounofficial, partition editor dev sda dvice mount mdeia mnt, Gparted utility.png

Once Esxi partition is mounted successfully, open File Manager icon on desktop twice and on first file manger navigate to sda5 250M/media/sda5 and on other file manager go to folder location /tmp. Locate file name state.tgz from folder path /media/sda5, copy it and paste it under /tmp folder.

vmware vsphere esxi bootable hiren bootcd ubuntu reset root password, filemanager, esxi state.tgz tar file

Once file is copied, under /tmp, either double click state.tgz or right click it go to context menu Open>> Extract. This untar/unzip data under state folder.

copy state.tgz file extract tar file esxi 6.5 reset root password, vmware vsphere command line using hiren bootcd bootable, unofficial unsupported risk

There is a untarred local.tgz file under folder /tmp/state now. Double click local.tgz or in the context menu right click, Open then extract it, to the local folder, inside local folder there is etc folder.

vmware vsphere esxi state tgz local tgz configuration copy esxi root password configuration reset esxi 6.5 root password

Go to the path /tmp/state/local/etc. Find shadow file inside, right click and open it with Text Editor as shown.

vmware vsphere esxi reset root administrator password extract local.tgz state.tgz, Shadow file, passwd reset root unofficial unsupported

Passwords are registered under shadow file, Remove the hash info, this is encoded password (This almost impossible to break or decrypt dcode this password). Removing this code means root password is made empty or blank. Save this file.

vmware vsphere esxi vi reset change root password using shadow file, passwd. esxi rroot reset using iso file of hiren bootable , root entry grep, vpxuser, daemon dcui, nobody

Next open RoxTerm from taskbar, this is similar to putty or Terminal command tool. Type command cd /tmp/state/local. This location has the esxi configuration  files and modified shadow folder with blanked root password inside etc folder. Tar the etc folder using tar -czf local.tgz etc and next run next command tar -czf state.tgz local.tgz, to make ready state.tgz.

As you can see when I list the directory. I see local.tgz and state.tgz already present, because I tested it before hand, running tar command again update both tgz file. No need to rerun tar command again and again, this is just for demo purpose.

vmware vsphere esxi reset forgotten esxi password using iso roxterm putty, hiren boot cd, state.tgz, local.tgz, change direcotyr temp state local tar czf tgz file

Here I am copying processed state.tgz file from /tmp/state/local to /media/sda5 ESXi server, this will show message of overwrite, as file already exist. Go ahead with the same and replace it.

vmware esxi reset forgotten password offline vsphere, vmware esxi state.tgz, local.tgz, overwrite state.tgz etc file and passwd file

Next on GParted partition editor,  right click sda5 device (it shows a lock means it is mounted) and click unmount.

reset esxi forgotten root password using hiren boot cd Ui, dev sda5 sda6, fat 16 root password changed, unmount media, manage flags, offline password reset administrator

Next Do the same for /dev/sda6 partition, mount it, copy state.tgz, untar, and under local/etc folder local shadow file and make necessary changes to root user by removing hashed encoded password string. You can also perform this trick completely using command line on RoxTerm  as below.

# This mounts the sda6 partition
mount /dev/sda6  /mnt

# Change directory location to /mnt
cd /mnt

# Copy file state.tgz to /tmp folder
cp state.tgz /tmp

# Change directory location to /tmp 
cd /tmp

# Untar state.tgz file
tar -xzf state.tgz

# Untar local.tgz file
tar -xzf local.tgz

# Change directory location to etc
cd etc

# Edit shadow file using vi editor, Press i to start editing, once password hash is removed, press esc button and save it with :wq.
vi shadow

# Tar (update) etc folder into local.tgz 
tar -czf local.tgz etc

# Tar (update) local.tgz folder into state.tgz
tar -czf state.tgz local.tgz

# Copy new state.tgz to /mnt/ on esxi server
cp state.tgz /mnt/

# Unmount partition /mnt and reboot.
unmount /mnt
reboot

Before rebooting esxi server make sure you unmount Hiren's ISO file from remote console and change BIOS to boot from hard disk. Once server is restarted and Esxi OS is loaded. After pressing F2, I am able to login with empty blank root password.

vmware vsphere esxi empty dcui password no password, authentication required, find password, reset password, log in name hiren boot cd

Once logged onto Esxi successfully change the password under Configure Password. As you can see Old Password is in grayed out in color means there is no password set, it is empty. Change it with new password.

vmware esxi configure root password without knowing, change root password, unknown password, no passoword, change esxi root offline password hiren boot cd.png

Useful articles
PART 1 : INSTALLING ESXI ON VMWARE WORKSTATION HOME LAB
Reset/Restart HP ILO (Integrated Lights-outs) using putty
Reset HP ILO password from Esxi server
PART 3 : MY VSPHERE LAB CONFIGURATION ON VMWARE WORKSTATION

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

Resolved syslog error: Call OptionManager.UpdateValues for object ha-adv-options on ESXi failed

I configured successfully syslog on esxi server around thousand of esxi server in my environment with Configure syslog on VMware ESXi hosts: VMware best practices. But while configuring syslog on few esxi server I receive below error. In the Esxi edit advanced option on Syslog.global.logHost it was showing A general system error occurred: internal error.

vmware vsphere esxi syslog server edit advanced options system.global.loghost a general system error occurred internal error port 514, tcp udp.png

I can see same message under Esxi >> Monitor tab >> Tasks and Events with message, Update option values: A general system error occurred: internal error

vmware vsphere esxi syslog server edit advanced options system.global.loghost a general system error occurred internal error port 514, tcp udp, esxi monitor tab, tasks update option values

I decided to chek and configure syslog advanced settings directly connecting to esxi, but was seeing different error. 

Call “OptionManager.UpdateValues” for object “ha-adv-options” on ESXi failed.

vmware esxi advanced settings a general system error occurred internal error call optionmanager updatevalues for object ha-adv-options syslog.global.loghost

First troubleshooting diagnosis should be checked is, login to esxi server using putty, then verify nslookup and ping is working for syslog server correctly. also check ports is reachable vice versa using nc -z command. In my case there was a issue with dns name resolution but IP was pinging.

vmware vsphere esxi, putty enable ssh, secure shell, nslookup, ping syslog server failed, successded, syslog error

If everything ok and you are still facing issues, to troubleshoot further on esxi putty tried set syslog using below command.
esxcli system syslog config set –loghost=syslogserver.vcloud-lab.com:514

This shown new error Got no data from process, ideally in the background it is running esxcfg-syslog command as below, and it is another command to run it.
/usr/lib/vmware/vmsyslog/bin/esxcfg-syslog --plugin=esxcli --loghost='syslogserver.vcloud-lab.com:514'

vsphere vmware esxi vsphere security documentationa information, syslog server, esxcli system syslog config set loghost, plugin, configuration error got no data from process

Next to troubleshoot it further I checked hostd.log with below command.

less /var/log/hostd.log

Upon analyzing I found it is showing errors due to some MemoryError. As it can be seen from below screenshot.

vmware vsphere esxi, ssh configuration, less logs hostd.log, memoryerror, review logs, syslog plugin esxcli issue configuring error info, Powercli

Next to resolve the same, restart syslog process daemon. First we need to know the ID number of syslog process, which can be found using command.
ps | grep -i syslog

The second number shown in the list is the process ID, using command kill ProcessID restarts syslog service daemon. Again running ps | grep -i syslog, I see it has got another ID now, it is kind of refreshed, reloaded now.

Next I can verify using same esxcli command to set syslog and it doesn't show any error message now, I also verified the same on VMware web client, configuration is modified successfully and then on syslog server checked, logs are getting gathered, everything is good.

vmware vsphere esxi , ssh, enabled shell, ps grep syslog, kill processes esxcli system syslog config set loghost python esxi process, vmsyslogd daemon, restart process linux esxi

Useful Blogs
Configure syslog on VMware ESXi hosts: VMware best practices
vSphere PowerCLI - Configure syslog on VMware ESXi hosts and Enable security profile firewall
PART 1 : INSTALLING ESXI ON VMWARE WORKSTATION HOME LAB
PART 2 : CONFIGURING ESXI ON VMWARE WORKSTATION HOME LAB
PART 3 : ACCESSING STANDALONE ESXI SERVER IN HOME LAB USING VSPHERE CLIENT

View older posts »

Blog Search

Page Views

1077439

Guestbook
Please add a comment below
 
Follow me on Blogarama