## 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

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Id | String | Specifies an ID for the new host account. | true | false
Password | String | Specifies a password for the new host account. | true | false
AssignGroups | String[] | If the UserAccount parameter is set to $true, use AssignGroups to specify the groups to which the newly created user belongs. | false | false
AssignUsers | String[] | If the GroupAccount parameter is set to $true, use AssignUsers to specify the users that belong to the newly created group account. | false | false
Confirm | SwitchParameter | If 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. | false | false
Description | String | Provide a description of the new host account. The maximum length of the text is 255 symbols. | false | false
GrantShellAccess | SwitchParameter | Indicates that the new account is allowed to access the ESX shell. | false | false
GroupAccount | SwitchParameter | Indicates that the new host account is a group account. Starting with ESXi 5.1, this parameter is not supported. | false | false
Server | VIServer[] | 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. | false | true (ByValue)
UserAccount | SwitchParameter | Indicates that the new host account is a user account. | false | false
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false

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.