vSphere PowerCLI Reference



Retrieves the host accounts available on a vSphere server.


Get-VMHostAccount [-Group] [-User] [[-Id] <String[]>] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version

Detailed Description

Retrieves the host accounts available on a vSphere server. If both User and Group parameters are set to $true, in the list returned by the command, group accounts come out on top. If no of the User and Group switch parameters are provided, the cmdlet retrieves only the user accounts. If the ID parameter is set, the cmdlet filters the host accounts by their IDs. To specify a server different from the default one, use the -Server parameter.
Note: The specified server must be an ESX host.


NameTypeDescriptionRequired?Pipeline InputDefault Value
IdString[]Specify the IDs of the host accounts you want to retrieve.falsefalse
GroupSwitchParameterIndicate that you want to retrieve only group host accounts.falsefalse
ServerVIServer[]Specifies a vSphere server to search for the specified vSphere .NET object. If no value is given to this parameter, the command runs on the server currently specified in the $DefaultVIServer variable.falsetrue (ByValue)
UserSwitchParameterIndicate that you want to retrieve only user host accounts.falsefalse

Return Type



Depending on what the user specified, the returned object can be of one of the child types: HostGroupAccount, HostUserAccount.


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

Get-VMHostAccount -Group

Retrieves the group accounts for the default ESX host.

Copyright © 1998 - 2011 VMware, Inc. All rights reserved.