Thanks, Adrian! I have modified your script slightly since my AD groups already exist. The only line I changed was
$mrdgrp = Get-ADGroup $ADVMGroupName
The very last line in your script is giving me problems.
$authMgr.SetEntityPermissions($vmi.MoRef, $perm) is throwing the error:
Exception calling "SetEntityPermissions" with "2" argument(s): "The user or group named 'CN=VMCA_group_name,OU=CloudVMConsoleAccessGroups,DC=a***,DC=C********,DC=EDU' does not exist."
At C:\Util\VMwareGroupTest.ps1:34 char:33
+ $authMgr.SetEntityPermissions <<<< ($vmi.MoRef, $perm)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
That group does exist in AD and is found when I run the Get-ADGroup line. Any thoughts?