This is a simple and quick blog post on how to create or add user to vCenter Permission or Roles Using Powershell or PowerCLI. This is very useful since the decomission of the flash client in vCenter and VCSA 6.7u1 and below having limited support for using the browse option when adding a user from AD
$cred = Get-Credential
Connect-VIServer lab-vc01.lab.local -Credential $cred
param(
[Parameter(Mandatory=$true)][string]$vCenter,
[Parameter(Mandatory=$true)][string]$Username,
[Parameter(Mandatory=$true)][string]$Domain
)
$Lab_User = "$Domain\$Username"
# Add to Root of vCenter
$rootFolder = Get-Folder -NoRecursion
#Add to Existing Permission
$Add_To_Admin = New-VIPermission -Entity $rootFolder -Principal $Lab_User -Role Admin -Propagate:$true | Out-Null
Thanks for the simple script!