< Back

Get-VMHostAccount

Sun Jan 19, 2020 6:54 pm

NAME Get-VMHostAccount



SYNOPSIS

This cmdlet retrieves the host accounts available on a vCenter Server system.





SYNTAX

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





DESCRIPTION

This cmdlet retrieves the host accounts available on a vCenter Server system. If both User and Group parameters

are set to $true, in the list returned by the command, group accounts come out on top. If none 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/ESXi host.





PARAMETERS

-Group [<SwitchParameter>]

Indicates that you want to retrieve only group host accounts. Starting with ESXi 5.1, this parameter is not

supported.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Id <String[]>

Specifies the IDs of the host accounts you want to retrieve.



Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that

matches exactly one of the string values in that list.



Required? false

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Server <VIServer[]>

Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this

parameter, the command runs on the default servers. For more information about default servers, see the

description of Connect-VIServer.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



-User [<SwitchParameter>]

Indicates that you want to retrieve only user host accounts.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Zero or more HostAccount objects







NOTES





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

HostUserAccount. Starting with ESXi 5.1, you cannot retrieve group host accounts.



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



Get-VMHostAccount -Group



Retrieves the group accounts for the default ESX/ESXi host. Starting with ESXi 5.1, you cannot retrieve group

accounts.

-------------------------- Example 2 --------------------------



$myServer1 = Connect-VIServer -Server 10.23.112.235

$myUserAccount1 = New-VMHostAccount -ID MyUser1 -Password MyPass1 -UserAccount

Get-VMHostAccount -Server $myServer1 -ID $myUserAccount1.Id -User



Retrieves a host account specified by an ID and an ESX/ESXi host.

-------------------------- Example 3 --------------------------



$myServer1 = Connect-VIServer -Server 10.23.112.235

$myGroupAccount1 = New-VMHostAccount -ID MyGroup1 -Password MyPassword1 -GroupAccount

Get-VMHostAccount -Server $myServer1 -Id $myGroupAccount.Id -Group



Retrieves a group host account specified by an ID and an ESX/ESXi host. Starting with ESXi 5.1, you cannot

retrieve group host accounts.

-------------------------- Example 4 --------------------------



$myServer1 = Connect-VIServer 10.23.112.235

Get-VMHostAccount -Server $myServer1 -User -Group



Retrieves all user and group accounts on a specified ESX/ESXi host. Starting with ESXi 5.1, you cannot retrieve

group host accounts.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... count.html

Remove-VMHostAccount

New-VMHostAccount

Set-VMHostAccount