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

NameTypeDescriptionRequired?Pipeline InputDefault Value
GroupAccountHostGroupAccount[]Specifies the host group account you want to configure. Starting with ESXi 5.1, you cannot configure group host accounts.truetrue (ByValue)
UserAccountHostUserAccount[]Specifies the host user account you want to configure.truetrue (ByValue)
AssignGroupsString[]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.falsefalse
AssignUsersString[]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.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
DescriptionStringProvides a description of the specified account. The maximum length of the text is 255 symbols.falsefalse
GrantShellAccessBooleanIndicates that the account is allowed to access the ESX shell.falsefalse
PasswordStringSpecifies a new password for the account.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.falsefalse
UnassignGroupsString[]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.falsefalse
UnassignUsersString[]If a group host account is to be configured, specifies the users you want to remove from the 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

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.