Q. What PowerCLI commands can I use to create a user account on an ESXi host?

Greg Shields

December 31, 2010

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. While most of us rarely need additional user accounts in ESXi, there occasionally comes the time to create one. You can easily create new user accounts using VMware's vSphere PowerCLI Windows PowerShell interface. Once inside the PowerCLI interface and connected to an ESXi host, the following command will create a new user and assign that user to the localadmin and root groups:

New-VMHostAccount -Id gshields -password PassW0rd -Description "SpecialUser" -AssignGroups localadmin,root

You can view a list of information about any ESXi user with the command

Get-VMHostAccount -User gshields | fl *

You can assign permissions to an existing user with the New-VIPermission cmdlet:

New-VIPermission -Role admin -Principal gshields -Entity server1.company.pri
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like