vSphere PowerCLI Reference

Set-VMHostAccount

Synopsis

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

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[]Specify the host group account you want to configure. Starting with ESXi 5.1, this parameter is not supported.truetrue (ByValue)
UserAccountHostUserAccount[]Specify the host user account you want to configure.truetrue (ByValue)
AssignGroupsString[]If a user host account is to be configured, specify 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. This parameter is not supported on ESXi 5.1 and later.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 specified account. The maximum length of the text is 255 symbols.falsefalse
GrantShellAccessBooleanIndicates that the account is allowed to access the ESX shell.falsefalse
PasswordStringSpecify a new password for the account.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.falsefalse
UnassignGroupsString[]If a user host account is to be configured, specify 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, specify the users you want to remove from the 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

HostAccount

Notes

If both parameters AssignUsers (AssignGroup) and UnassignUsers (UnassignGro up) are specified, first the Assign* parameter is applied. If the same user and group are specified for Assign and Unassign, then 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 © 1998 - 2012 VMware, Inc. All rights reserved.