Hello LucD
I managed to run it for multiple hosts, of for user create but i still have issues for role assignment
This is what i'm using right now
$esxSrv="HOST2","HOST2"
Foreach ($esxSrv In $esxSrv)
{
Connect-VIServer -Server $esxSrv -User root -Password @@@@
$user = New-VMHostAccount -Server $esxSrv -Id testuser2 -Password VMware1! -UserAccount -GrantShellAccess
$rootFolder = Get-Folder -Name root -Server $esxSrv
$role = Get-VIRole -Name Admin -Server $esxSrv
New-VIPermission -Role Admin -Principal testuser2 -Entity $rootFolder
Disconnect-VIServer -Server $esxSrv -Confirm:$false
}
I have this error

I tried using the ha-folder-root as root folder but i got this instead

Checked with Get-ViAccount and i get

What am i missing?
Thanks :smileyhappy: