## PowerCLI Reference

# Set-VMHostAccount

## Synopsis

This cmdlet configures a host account.

Syntax

Set-VMHostAccount [-GroupAccount] <HostGroupAccount[]> [-AssignUsers <String[]>] [-UnassignUsers <String[]>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-VMHostAccount [-UserAccount] <HostUserAccount[]> [-Password <String>] [-Description <String>] [-AssignGroups <String[]>] [-UnassignGroups <String[]>] [-GrantShellAccess <Boolean>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
New-VMHostAccount
Get-VIAccount
Remove-VMHostAccount

Detailed Description

This cmdlet configures a host account. When configuring a host user account, you can include or exclude the user from the specified groups.
When configuring a host group account, you can include or exclude the specified users from this group.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
GroupAccount | HostGroupAccount[] | Specifies the host group account you want to configure. Starting with ESXi 5.1, you cannot configure group host accounts. | true | true (ByValue)
UserAccount | HostUserAccount[] | Specifies the host user account you want to configure. | true | true (ByValue)
AssignGroups | String[] | If a user host account is to be configured, specifies the group to which you want to add the account. Starting with ESXi 5.1, you cannot configure group host accounts. | false | false
AssignUsers | String[] | If a group host account is configured, specify the users you want to add to the account. Starting with ESXi 5.1, you cannot configure group host accounts. | 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 | Provides a description of the specified account. The maximum length of the text is 255 symbols. | false | false
GrantShellAccess | Boolean | Indicates that the account is allowed to access the ESX shell. | false | false
Password | String | Specifies a new password for the account. | 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. | false | false
UnassignGroups | String[] | If a user host account is to be configured, specifies a group from which you want to remove the account. Starting with ESXi 5.1, you cannot configure group host accounts. | false | false
UnassignUsers | String[] | If a group host account is to be configured, specifies the users you want to remove from the 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

Zero or more modified HostUserAccount or HostGroupAccount objects

Notes

If both of the AssignUsers (AssignGroup) and UnassignUsers (UnassignGroup) parameters are specified, the Assign* parameter is applied first. If the same user and group are specified for Assign* and Unassign*, a terminating error is thrown. Starting with ESXi 5.1, you cannot configure group host accounts.

Examples

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

    $myUserAccount = New-VMHostAccount -ID MyUser1 -Password MyPassword1 -UserAccount
    $myGroupAccount = New-VMHostAccount -ID MyGroup1 -GroupAccount -AssignUsers $myUserAccount
    Set-VMHostAccount -UserAccount $myUserAccount -UnassignGroups $myGroupAccount

Creates a user account with an ID MyUser1. Then creates a group account with an ID MyGroup1 and assigns the user account MyUser1 to the group account MyGroup1. Finally, excludes the MyUser1 account from the MyGroup1 account.
Starting with ESXi 5.1, you cannot configure group host accounts.

Copyright © VMware, Inc. All rights reserved.