This may happen when you had the same vcenter server but another uuid or certificate previously registered or the instance was not clear and you try now to register it once again. Here the steps to fix this.

1) Checkout if the old vcenter server adapter instance is still in vcops

open a web browser, go to http(s)://<vcops>/vcops-custom/ and logon with the “admin” account
open the “adapter inctances” in the “enviroment” > “configuration”

vcops1

find the vcenter server adapter inctance and remove it

vcops2

2) Checkout if the old uuid is still sored and remove it if so

log on to vcops UI VM via ssh and edit vc_uuid file

fist-internal:~ # vi /usr/lib/vmware-vcops/user/conf/vc_uuid

you should see some lines like

https:///sdk
0X0XXXX-00XX-0000-000X-XX000X0X00X0
REGISTERED

Delete the three lines but ensure you don’t drop the wrong one. Maybe better you make a copy of the original file

Then log on to vcops Analytics VM and run the drup unique constraint script

secondvm-external:~ # ./drop_unique_constraint.sh

Note: if the drop inuque constraint script fail tu run ensure you’re connected to the Analytics VM and the host name is “secondvm-external”. If there’s anyother host name but you’re sure you’re on the proper VM change the host name with “~# hostname secondvm-external”.
If you get a permission denied error just make it with the chmode +w command executable

3) check out if the old ssl fingerprint is still stored in the truststore

log on to vcops UI VM via ssh change to /usr/lib/vmware-vcops/jre/bin and run the following command

./keytool -list -keystore /usr/lib/vmware-vcops/user/conf/truststore -storepass oxygen

You will now get the list of stored fingerprints of acepted ssl certificates from resent or prevusly registered vcenter servers

if the one server that failed to register match with one in the list, just remove it with the following command but replace https://<server name>/sdk-a0a0a0a0-a0a0-0000-a000-0a0a000aaa00” with your actual alias you want to remove

./keytool -delete -alias https://<server name>/sdk-a0a0a0a0-a0a0-0000-a000-0a0a000aaa00 -keystore /usr/lib/vmware-vcops/user/conf/truststore -storepass oxygen

I have an Auto Deploy server with two network adapters and had the problem that the configured ePXE Boot URL on the auto deploy server was different to the one that the ePXE boot server received.

Nic1 has the IP X.X.237.9 and communicates to the ESX hosts
Nic2 has the IP X.X.133.112 and communicates to the vCenter server only

ePXE boot server should receive files from Nic1 but for some reason it has the ip from  Nic2

auto-deploy-pxe2

auto-deploy-pxe1

Well after some investigation I found the problem but not the root cause.

If you download and unzip the tftp packet from the auto deploy page in vshpere client you’ll find also a file called tramp. Open it with an editor of your choice

Its content should look like this 😉 Yep the IP of Nic2 was written in the tramp file.

#!gpxe
set filename https://xxx.xxx.133.112:6501/vmw/rbd/tramp
chain https://xxx.xxx.133.112:6501/vmw/rbd/tramp

Well, I have no idea why and honestly I don’t care but what I know is since I corrected the IP the ePXE boot server received the correct IP and could continue with auto deployment.

#!gpxe
set filename https://xxx.xxx.237.9:6501/vmw/rbd/tramp
chain https://xxx.xxx.237.9:6501/vmw/rbd/tramp

I’m using vSphere 5.0

this procedure was tested under vSphere version 5.0u3

Connecting to a vCenter server with a different language can usually be worked around using the -locale on VpxClient.exe (details kb.vmware.com/kb/1020512) or change the language of vSphere email alerts my moving language files (details kb.vmware.com/kb/1015646) but the most beautiful way is to simply change the default language using the session manager in powercli

$si = Get-View ServiceInstance
$sm = Get-View $si.Content.SessionManager

Use “get-member” or “gm” after a pipe to list available methods and properties

$sm|gm

   TypeName: VMware.Vim.SessionManager

Name                        MemberType Definition
----                        ---------- ----------
AcquireCloneTicket          Method     string AcquireCloneTicket()
AcquireGenericServiceTicket Method     VMware.Vim.SessionManagerGenericServiceTicket AcquireGenericServiceTicket(VMware.Vim.SessionManagerServiceRequestSpec spec)
AcquireLocalTicket          Method     VMware.Vim.SessionManagerLocalTicket AcquireLocalTicket(string userName)
CloneSession                Method     VMware.Vim.UserSession CloneSession(string cloneTicket)
Equals                      Method     bool Equals(System.Object obj)
GetHashCode                 Method     int GetHashCode()
GetType                     Method     type GetType()
ImpersonateUser             Method     VMware.Vim.UserSession ImpersonateUser(string userName, string locale)
Login                       Method     VMware.Vim.UserSession Login(string userName, string password, string locale)
LoginBySSPI                 Method     VMware.Vim.UserSession LoginBySSPI(string base64Token, string locale)
LoginByToken                Method     VMware.Vim.UserSession LoginByToken(string locale)
LoginExtensionByCertificate Method     VMware.Vim.UserSession LoginExtensionByCertificate(string extensionKey, string locale)
LoginExtensionBySubjectName Method     VMware.Vim.UserSession LoginExtensionBySubjectName(string extensionKey, string locale)
Logout                      Method     System.Void Logout()
SessionIsActive             Method     bool SessionIsActive(string sessionID, string userName)
SetLocale                   Method     System.Void SetLocale(string locale)
SetViewData                 Method     System.Void SetViewData(VMware.Vim.ObjectContent objectContent, string[] properties)
TerminateSession            Method     System.Void TerminateSession(string[] sessionId)
ToString                    Method     string ToString()
UpdateServiceMessage        Method     System.Void UpdateServiceMessage(string message)
UpdateViewData              Method     System.Void UpdateViewData(Params string[] properties), System.Void UpdateViewData()
WaitForTask                 Method     System.Object WaitForTask(VMware.Vim.ManagedObjectReference taskReference)
Client                      Property   VMware.Vim.VimClient Client {get;}
CurrentSession              Property   VMware.Vim.UserSession CurrentSession {get;}
DefaultLocale               Property   System.String DefaultLocale {get;}
Message                     Property   System.String Message {get;}
MessageLocaleList           Property   System.String[] MessageLocaleList {get;}
MoRef                       Property   VMware.Vim.ManagedObjectReference MoRef {get;}
SessionList                 Property   VMware.Vim.UserSession[] SessionList {get;}
SupportedLocaleList         Property   System.String[] SupportedLocaleList {get;}

To determine the current settings use the “DefaultLocale” property.

$sm.DefaultLocale
en

A list of supported languages can be queried with “SupportedLocaleList” property

$sm.SupportedLocaleList|sort
en
en_AU
en_BZ
en_CA
en_CB
en_GB
en_IE
en_JM
en_NZ
en_PH
en_TT
en_US
en_ZA
en_ZW
...

To change the language open a new PCLI Session with no VI Servr connected.
Change the variable in the code below and execute it

$VIServer = 'SERVER' # vCenter Server
$lang = 'en_US'         # language code

Connect-VIServer $VIServer -Credential $cred | Out-Null
$si = Get-View ServiceInstance
$sm = Get-View $si.Content.SessionManager
$sm.SetLocale($lang)

Reboot the vCenter Server and check the language with the “DefaultLocale” property

I’m using a simple one-liner to determine the WWN of a LUN. I use this information to identify the data stores on VMware with the LUNs on the storage sub system. Usually the proper naming convention shall help identifying this but in historical grown environments you might run into the same problem and a simple one-line returns the proper information which makes your life easier 😉

Get-Datastore '<DATASTORE>'|Get-View|select name,@{n='wwn';e={$_.Info.Vmfs.Extent[0].DiskName}}|ft -a

It’s always a challenge to ensure HA restarts Virtual Machines in case of a Hardware failure.

We had long discussions with VMware consultants and other specialists but at least the only suitable way is to enable admission control on the Cluster object and set resource reservation on each Virtual Machine.

As more host are within a cluster as higher is the risk of an outage that’s why I different between Clusters with more than 5 Host and increase the resource reservation for bigger clusters. You can change this value in row 8

Load Vi Toolkit in powershell

add-pssnapin VMware.VimAutomation.Core

Connect to one or more vCenter Server

Connect-VIServer "<VISever1>","<VISever2>","..." -wa 0 | out-null

Check if min one vCenter Server is connected

if ($global:DefaultVIServers.Count -gt 0){

Load only clusters who are HA and admission control enabled. This makes sense to control this script with the vCenter client. To exclude a Cluster simply disable AC

    foreach($cluster in (get-view -viewtype "clustercomputeresource"|?{$_.configuration.dasconfig.admissioncontrolenabled -eq $true -and $_.configuration.dasconfig.enabled -eq $true})){

Count hosts within a cluster and calculate the correct percentage of reserved cluster resources as failover spare capacity. In this example a cluster with more than 6 hosts I calculate a failover spare capacity for two possible failing host

        $amount_hosts=$cluster.host.count
        $currentCpuFailoverResourcesPercent=$cluster.configuration.dasconfig.admissioncontrolpolicy.cpufailoverresourcespercent
        $currentMemoryFailoverResourcesPercent=$cluster.configuration.dasconfig.admissioncontrolpolicy.memoryfailoverresourcespercent
        if ($amount_hosts -gt 0 -and $amount_hosts -lt 6){
            $cpuFailoverResourcesPercent    = [math]::round(100/$amount_hosts)
            $memoryFailoverResourcesPercent = [math]::round(100/$amount_hosts)
        }
		if ($amount_hosts -ge 6){
            $cpuFailoverResourcesPercent    = [math]::round(200/$amount_hosts)
            $memoryFailoverResourcesPercent = [math]::round(200/$amount_hosts)
        }

Load Cluster objects and handover previously defined variables. Compare the current failover capacity values and apply the newly calculated values only if they don’t match.

        $spec = New-Object VMware.Vim.ClusterConfigSpecEx
        $spec.vmSwapPlacement = "vmDirectory"
        $spec.dasconfig = New-Object VMware.Vim.ClusterDasConfigInfo
        $spec.dasconfig.admissioncontrolpolicy = New-Object VMware.Vim.ClusterFailoverResourcesAdmissionControlPolicy
        $spec.dasconfig.admissioncontrolpolicy.cpufailoverresourcespercent = $cpuFailoverResourcesPercent
        $spec.dasconfig.admissioncontrolpolicy.memoryfailoverresourcespercent = $memoryFailoverResourcesPercent
        if($currentCpuFailoverResourcesPercent -ne $cpuFailoverResourcesPercent -or $currentMemoryFailoverResourcesPercent -ne $memoryFailoverResourcesPercent){
            $cluster.ReconfigureComputeResource_Task($spec, $true)
        }
}

At his point we are finished with the cluster configuration and continue in the same loop with the VMs within this cluster. The folowing query searchs for VMs within the previously checked or configured cluster that are NOT Fault Tolerance (FT) enabled and loads Virtual machine PS objects

        foreach($vm in (get-view -viewtype "virtualmachine" -searchroot $cluster.moref|?{$_.Config.FtInfo -eq $null})){
            $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
            $spec.cpuAllocation = New-Object VMware.Vim.ResourceAllocationInfo
            $spec.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo

If you make difference between more or less important VMs like Production and Development or Test VMs you have to identify them accordantly and set the proper reservation. In my case I’m looking for Production VMs and reserve 75% of the allocated memory. (VIEPAPPAT101)

            if($vm.name.length -eq 12 -and $vm.name.substring(3,1)-eq "p"){
                $MemReservationMB=[math]::round($vm.config.hardware.memorymb*0.75,0)
                if($vm.config.memoryAllocation.Reservation -ne $MemReservationMB -and $vm.runtime.connectionstate -eq "connected"){
                    $spec.memoryAllocation.reservation = $MemReservationMB
                    $vm.ReconfigVM_Task($spec)
                }
            }

Same for Development and UAT VMs but with only 50% memory reservation of the actual allocated memory (VIEDAPPAT101)

            if($vm.name.length -eq 12 -and $vm.name.substring(3,1)-eq "d" -or $vm.name.substring(3,1)-eq "u"){
                $MemReservationMB=[math]::round($vm.config.hardware.memorymb*0.50,0)
                if($vm.config.memoryAllocation.reservation -ne $MemReservationMB -and $vm.runtime.connectionstate -eq "connected"){
                    $spec.memoryAllocation.reservation = $MemReservationMB
                    $vm.ReconfigVM_Task($spec)
                }
            }

Close open brakets

        }
    }
}

Copy the whole code

add-pssnapin VMware.VimAutomation.Core
Connect-VIServer "<VISever1>","<VISever2>","..." -wa 0 | out-null
if ($global:DefaultVIServers.Count -gt 0){
    foreach($cluster in (get-view -viewtype "clustercomputeresource"|?{$_.configuration.dasconfig.admissioncontrolenabled -eq $true -and $_.configuration.dasconfig.enabled -eq $true})){
        $amount_hosts=$cluster.host.count
        $currentCpuFailoverResourcesPercent=$cluster.configuration.dasconfig.admissioncontrolpolicy.cpufailoverresourcespercent
        $currentMemoryFailoverResourcesPercent=$cluster.configuration.dasconfig.admissioncontrolpolicy.memoryfailoverresourcespercent
        if ($amount_hosts -gt 0 -and $amount_hosts -lt 6){
            $cpuFailoverResourcesPercent    = [math]::round(100/$amount_hosts)
            $memoryFailoverResourcesPercent = [math]::round(100/$amount_hosts)
        }
		if ($amount_hosts -ge 6){
            $cpuFailoverResourcesPercent    = [math]::round(200/$amount_hosts)
            $memoryFailoverResourcesPercent = [math]::round(200/$amount_hosts)
        }
        $spec = New-Object VMware.Vim.ClusterConfigSpecEx
        $spec.vmSwapPlacement = "vmDirectory"
        $spec.dasconfig = New-Object VMware.Vim.ClusterDasConfigInfo
        $spec.dasconfig.admissioncontrolpolicy = New-Object VMware.Vim.ClusterFailoverResourcesAdmissionControlPolicy
        $spec.dasconfig.admissioncontrolpolicy.cpufailoverresourcespercent = $cpuFailoverResourcesPercent
        $spec.dasconfig.admissioncontrolpolicy.memoryfailoverresourcespercent = $memoryFailoverResourcesPercent
        # set failover capacaty if cpu or memory value are unequal to current configuration
        if($currentCpuFailoverResourcesPercent -ne $cpuFailoverResourcesPercent -or $currentMemoryFailoverResourcesPercent -ne $memoryFailoverResourcesPercent){
            $cluster.ReconfigureComputeResource_Task($spec, $true)
        }

        foreach($vm in (get-view -viewtype "virtualmachine" -searchroot $cluster.moref|?{$_.Config.FtInfo -eq $null})){
            $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
            $spec.cpuAllocation = New-Object VMware.Vim.ResourceAllocationInfo
            $spec.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo

            if($vm.name.length -eq 12 -and $vm.name.substring(3,1)-eq "p"){
                $MemReservationMB=[math]::round($vm.config.hardware.memorymb*0.75,0)
                if($vm.config.memoryAllocation.Reservation -ne $MemReservationMB -and $vm.runtime.connectionstate -eq "connected"){
                    $spec.memoryAllocation.reservation = $MemReservationMB
                    $vm.ReconfigVM_Task($spec)
                }
            if($vm.name.length -eq 12 -and $vm.name.substring(3,1)-eq "d" -or $vm.name.substring(3,1)-eq "u"){
                $MemReservationMB=[math]::round($vm.config.hardware.memorymb*0.50,0)
                if($vm.config.memoryAllocation.reservation -ne $MemReservationMB -and $vm.runtime.connectionstate -eq "connected"){
                    $spec.memoryAllocation.reservation = $MemReservationMB
                    $vm.ReconfigVM_Task($spec)
                }
            }
        }
    }
}