Hey LucD, I am having a few issues with the script. When I use "Administrators" as the Principal, the script runs perfectly. The role is created and access is granted to the Administrators group. However, when I add a domain user and/or group as the Principal, the script fails. I see messages like:
New-VIPermission Could not find VIAccount with name "Domain\Group"
New VIPermission Value cannot be found for the mandatory parameter Principal
I am accessing vCenter with a domain account that has full privileges. Is there something else I need in the script? Thank you again.
I modified the script some, but am still unable to get my desired result. I have added:
$principal = Get-VIAccount -Domain "DOMAIN" -User "username"
$myPermissions = New-VIPermission -Entity $rootfolder -Principal $principal -Role mycustomrole -Propagate:$true
This DOES work for one particular username.However, when I run Get-VIAccount using the -Group -Id switches, it does NOT find my desired group. Am I heading in the right direction?