vSphere PowerCLI Reference

New-VMHostAccount

Synopsis

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

Creates a new host user or group account using the provided parameters.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
IdStringSpecify an ID for the new host account.truefalse
PasswordStringSpecify 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$true
DescriptionStringProvide a description of the new host account. The maximum length of the text is 255 symbols.falsefalse
GrantShellAccessSwitchParameterIndicate that the new account is allowed to access the ESX shell.falsefalse
GroupAccountSwitchParameterIndicate that the new host account is a group account. Starting with ESXi 5.1, this parameter is not supported.falsefalse
ServerVIServer[]Specify 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)
UserAccountSwitchParameterIndicate that the new host account is a user account.falsefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

HostUserAccount or HostGroupAccount

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 © 1998 - 2012 VMware, Inc. All rights reserved.