top of page

PowerShell PowerCLI Create VMHost Admin  Account

    $VMHost="MyVMHostName"

    $Account="BuAdmin"

    Connect-VIServer -Protocol https -Server $VMHost -User root -Password "YourPassword"

    #Create User with Shell Access
    Write-Host "Creating User For: $Account"
       
    New-VMHostAccount -Id $Account -Password "YourNewAccountPassword" -GrantShellAccess
       
   
#Assign Administrator Permission
    $RootFolder = Get-Folder -Name ha-folder-root

    New-VIPermission -Entity $RootFolder -Principal $Account -Role Admin
    

    Disconnect-VIServer  $VMHost -Confirm:$false
        
        

bottom of page