Veeam Home | Support | Downloads
Veeam Management Pack 8.0 for System Center Resource Kit Guide

Veeam Management Pack Help Center  > Veeam MP Resource Kit Guide > Add ESXi User PS Script

Add ESXi User PS Script

Previous page Next page Print this Topic

Table of contents

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
vCenter/ESXi 5.x


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.
Account name.
Permissions for the account.


1.To allow Veeam MP VM tasks (such as PowerOnVM, PowerOffVM, resetVM and so on) to work, you will need to 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 and hosts.

Add-ESXiUser.ps1 -ComputerName, -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 host and testVC vCenter Server.

Add-ESXiUser.ps1 -ComputerName, testVC  -NewUser testUser1 -Role "Admin" -NewUserDescription "User with administrator permissions"

Table of contents