Please enable Javascript for better experience...
Migrate Roles & Permissions from one vCenter to another vCenter
By Pranay Jha | Jan 12, 2017 | In Tips | Total Views [ 1243 ]
Taged In
(2 Like)

During one of the activity we performed in our orgnaziation to rebuild Virtual Center, we faced issue that few of the admins were reporting access issue. It was because if we rebuild virtual center, it didn't add existing Roles and Permissions in Virtual Center. Hence I planned to export roles from one vcenter to this newly rebuilt vcenter. However creating manual roles and adding to permission take longer if we have large number of users listed in ACL. Hence performed automation through below script to reduce manual efforts. It worked perfectly and save few hours.

# Variables
# Set the PowerCLI Configuration to connect to multiple vCenters
Set-PowerCLIConfiguration -DefaultVIServerMode multiple -Confirm:$false
# Connect to both the source and destination vCenters
connect-viserver -server $VC1, $VC2
# Get roles to transfer
$roles = get-virole -server $VC1
# Get role Privileges
foreach ($role in $roles) {
[string[]]$privsforRoleAfromVC1=Get-VIPrivilege -Role (Get-VIRole -Name $role -server $VC1) |%{$}
# Create new role in VC2
New-VIRole -name $role -Server $VC2
# Add Privileges to new role.
Set-VIRole -role (get-virole -Name $role -Server $VC2) -AddPrivilege (get-viprivilege -id $privsforRoleAfromVC1 -server $VC2)
disconnect-viserver –server $VC1, $VC2

Thanks for visiting here. Share this article if you found it useful.
Join Facebook Group
Like Facebook Page
Connect to twitter
Share this on Social Media

About the Author

Pranay Jha
Pranay Jha
Founder, Contributer
Follow me

facebook linkedin twitter G+ VMTN

My name is Pranay Jha, working in IBM as Technical Solution Architect for Virtualization platform. I have been working in IT for near around 11 years. Passionate to get involved as an Independent blogger for my blog I am carrying few industrial certifications as VMware vExpert 2016/2017, VCIX6, VCAP6-DCD, VCAP5-DCD/DCA, VCP6-DCVVCP5-DCV, VCA-Cloud, VCE-CIA, VSP, MCSE, MCITP, MCSA(Messaging). For any query or suggestion, please connect me at Thanks for visiting here.

Please SignUp/Login to comment...

Or comment as anonymous...
* Name
* Email ID
Facebook Likes