PowerCLI Reference

New-VMHostAccount

Synopsis

This cmdlet creates a new host user or group account.

Syntax

New-VMHostAccount [-Id] <String> [-Password] <String> [-Description <String>] [-UserAccount] [-AssignGroups <String[]>] [-GrantShellAccess] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-VMHostAccount [-Id] <String> [-GroupAccount] [-AssignUsers <String[]>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Set-VMHostAccount
Get-VIAccount
Remove-VMHostAccount

Detailed Description

This cmdlet creates a new host user or group account using the provided parameters.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
IdStringSpecifies an ID for the new host account.truefalse
PasswordStringSpecifies a password for the new host account.truefalse
AssignGroupsString[]If the UserAccount parameter is set to $true, use AssignGroups to specify the groups to which the newly created user belongs.falsefalse
AssignUsersString[]If the GroupAccount parameter is set to $true, use AssignUsers to specify the users that belong to the newly created group account.falsefalse
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse
DescriptionStringProvide a description of the new host account. The maximum length of the text is 255 symbols.falsefalse
GrantShellAccessSwitchParameterIndicates that the new account is allowed to access the ESX shell.falsefalse
GroupAccountSwitchParameterIndicates that the new host account is a group account. Starting with ESXi 5.1, this parameter is not supported.falsefalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.
Passing values to this parameter through a pipeline is deprecated and will be disabled in a future release.
falsetrue (ByValue)
UserAccountSwitchParameterIndicates that the new host account is a user account.falsefalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

The newly created HostUserAccount or HostGroupAccount object

Notes

Starting with ESXi 5.1, you cannot create group host accounts.

Examples

-------------- Example 1 --------------

New-VMHostAccount -ID MyUser1 -Password MyPassword1 -UserAccount

Creates a user account with a specified user ID and password. The user account is created on the default server.

-------------- Example 2 --------------

$myUser1 = Get-VMHostAccount -ID MyUser1 -User
New-VMHostAccount -Id MyGroup1 -GroupAccount -AssignUsers $myUser1

Creates a group account with a specified ID and assigns a specified user to the group account. Starting with ESXi 5.1, you cannot create group host accounts.


Copyright © VMware, Inc. All rights reserved.