--- title: "Add ESXi User PS Script" description: "If you plan to use the vCenter Connection Failover feature, configure the Veeam VMware Direct ESX(i) Connection Account. While configuring the account, specify a user name and password that will be used for direct-to-host connections." canonical: "https://helpcenter.veeam.com/docs/mp/resource_kit/add_esxi_user_ps_script.html" breadcrumb: "Veeam MP Resource Kit Guide > Add ESXi User PS Script" dateModified: "2026-09-17" --- # Add ESXi User PS Script If you plan to use the vCenter Connection Failover feature, configure the *Veeam VMware Direct ESX(i) Connection Account*. While configuring the account, specify a 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, see the [vCenter Connection Failover](https://helpcenter.veeam.com/docs/mp/vmware_guide/vcenter_connection_failover.html?ver=90) section in the Veeam MP for VMware Operations Guide. Before you run the script, make sure your environment meets the following requirements: - vSphere PowerCLI 5.x or later - VEShell 6.5 or later - vCenter/ESXi 5.x or later ## Pre-requisites - 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. - 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 [this Microsoft KB article](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/hh994562(v=ws.10)?redirectedfrom=MSDN). - Before you run the script, call `Set-ExecutionPolicy` and set the execution policy to *RemoteSigned* or *Unrestricted*. ## Input - Text file that contains a list of host names or a vCenter Server name. - Account name. - Permissions for the account. ::: note 1. To allow Veeam MP VM tasks (such as PowerOnVM, PowerOffVM, resetVM and so on) to work, you must create an account with the Administrator role. 2. Non-standard vCenter Server ports are not supported. ::: ## Example 1 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" ``` ## Example 2 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" ``` ## Example 3 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" ```