If you are planning to use the vCenter Connection Failover feature, you will need to configure the Veeam VMware Direct ESX(i) Connection Account. While configuring the account, you will be asked to specify user name and password that will be used for direct-to-host connections. The specified credentials must be the same for all vCenter managed ESX(i) hosts in your environment (even hosts in different vCenter Servers).
The Add-ESXiUser.ps1 script uses vSphere PowerCLI to create accounts on ESX(i) hosts. The script allows you to automatically create identical local accounts (Read-only, by default) on vSphere hosts for use in vCenter Connection Failover. For more details about vCenter Connection Failover, refer to the Veeam MP for VMware Operations Guide.
Before you run the script, make sure your environment meets the following requirements:
|•||vSphere PowerCLI 5.x|
|•||VEShell 6.5 or later|
|1.||Hosts on which you are willing to create direct ESX(i) connection accounts cannot be Disconnected or Not Responding.|
These hosts also cannot be in the Lockdown mode.
|2.||The password that will be used for direct-to-host connections must meet security requirements, or else the New-VMHostAccount command will return the following error:|
“User name or password has an invalid format. If requirements (weak password).”
To learn more about password policy, see the Microsoft KB article.
|3.||Before you run the script, call Set-ExecutionPolicy and set the execution policy to RemoteSigned or Unrestricted.|
|•||Text file that contains a list of host names or a vCenter Server name.|
|•||Permissions for the account.|
The following command creates new users on the esx-main1.dev.veeam.local and esx-main2.dev.veeam.local hosts.
Add-ESXiUser.ps1 -ComputerName esx-main1.dev.veeam.local, esx-main2.dev.veeam.local -NewUser testUser1 -Role "ReadOnly" -NewUserDescription "User with read only permissions"
The following command uses a text file with a list of host names as a source for the ComputerName parameter:
Add-ESXiUser.ps1 -ComputerName (Get-Content D:\hosts.txt) -NewUser testUser1 -Role "ReadOnly" -NewUserDescription "User with read only permissions"
The following command creates new users on the esx-main1.dev.veeam.local host and testVC vCenter Server.
Add-ESXiUser.ps1 -ComputerName esx-main1.dev.veeam.local, testVC -NewUser testUser1 -Role "Admin" -NewUserDescription "User with administrator permissions"