Get-VIAccount/New-VIPermission throws error shortly after running Set-VMHostAuthentication.
book
Article ID: 301574
calendar_today
Updated On:
Products
VMware Aria SuiteVMware vSphere ESXi
Issue/Introduction
Adding an ESXi host to a domain using Set-VMHostAuthentication cmdlet completes successfully, but if Get-VIAccount cmdlet is called immediately after that to check the status, it throws a "Can't bind to LDAP server for domain" error.
Symptoms: The issue is with Get-VIAccount/New-VIPermission shortly after running Set-VMHostAuthentication, particularly for the first time after a host has had the OS installed. Get-VIAccount will throw a “Can't bind to LDAP server for domain” error and New-ViPermission will throw a “Cannot find an Active Directory group object with identity“ error.
Write-Error “Getting VIAccount with Id ‘$userNameToGrantPermissions’ failed with the following error: rn $_”
Write-Host “Next attempt in 5 seconds”
Start-Sleep -Seconds 5
}
$retryCount--
}
Please note that the number of retries($retryCount =5) and sleep intervals(Start-Sleep -Seconds 5) in the sample script may need to be adjusted according to the individual environment performance.
Additional Information
Impact/Risks: Shortly after running Set-VMHostAuthentication, particularly for the first time after a host has had the OS installed, Get-VIAccount/New-VIPermission will experience the specified errors.
“Can't bind to LDAP server for domain” error and “Cannot find an Active Directory group object with identity“ error.