VMware Cloud Community
Gsanty
Contributor
Contributor

AD group rename has to be applied in vCenter permission

Hello All,

Have an AD group called Test. With that group name in vCenter at Datacenter, folders, cluster and datastore permissions are provided.

Lets say now AD team is renaming the Test group name to Test1 group name.

Let me know any scripts to apply the new group name(Test1) inplace of old name(Test) where the permission applied.

Thanks in adavce,

0 Kudos
2 Replies
LucD
Leadership
Leadership

You could try something like this

$oldName = 'domain\Test'

$newName = 'domain\Test1'

Get-VIPermission | where{$_.Principal -eq $oldName} | %{

    New-VIPermission -Entity $_.Entity -Principal $newName -Role $_.Role -Propagate $_.Propagate -Confirm:$false

    Remove-VIPermission -Permission $_ -Confirm:$false

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Gsanty
Contributor
Contributor

Thanks Ton LucD 
0 Kudos