< Back

New-VMHostAccount

Sun Jan 19, 2020 7:02 pm

NAME New-VMHostAccount



SYNOPSIS

This cmdlet creates a new host user or group account.





SYNTAX

New-VMHostAccount [-Id] <String> [-Password] <String> [-AssignGroups <String[]>] [-Description <String>]

[-GrantShellAccess] [-Server <VIServer[]>] [-UserAccount] [-Confirm] [-WhatIf] [<CommonParameters>]



New-VMHostAccount [-Id] <String> [-AssignUsers <String[]>] [-GroupAccount] [-Server <VIServer[]>] [-Confirm]

[-WhatIf] [<CommonParameters>]





DESCRIPTION

This cmdlet creates a new host user or group account using the provided parameters.





PARAMETERS

-AssignGroups <String[]>

If the UserAccount parameter is set to $true, use AssignGroups to specify the groups to which the newly

created user belongs.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-AssignUsers <String[]>

If the GroupAccount parameter is set to $true, use AssignUsers to specify the users that belong to the newly

created group account.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Description <String>

Provide a description of the new host account. The maximum length of the text is 255 symbols.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-GrantShellAccess [<SwitchParameter>]

Indicates that the new account is allowed to access the ESX shell.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-GroupAccount [<SwitchParameter>]

Indicates that the new host account is a group account. 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 an ID for the new host account.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Password <String>

Specifies a password for the new host account.



Required? true

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? 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. Passing values to this parameter through a pipeline is deprecated and will

be disabled in a future release.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



-UserAccount [<SwitchParameter>]

Indicates that the new host account is a user account.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value $true

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



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

The newly created HostUserAccount or HostGroupAccount object







NOTES





Starting with ESXi 5.1, you cannot create group host accounts.



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



New-VMHostAccount -ID MyUser1 -Password MyPassword1 -UserAccount



Creates a user account with a specified user ID and password. The user account is created on the default server.

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



$myUser1 = Get-VMHostAccount -ID MyUser1 -User

New-VMHostAccount -Id MyGroup1 -GroupAccount -AssignUsers $myUser1



Creates a group account with a specified ID and assigns a specified user to the group account. Starting with ESXi

5.1, you cannot create group host accounts.



RELATED LINKS

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

Set-VMHostAccount

Get-VIAccount

Remove-VMHostAccount