Skip to content

Instantly share code, notes, and snippets.

@pablitocli
Last active April 6, 2018 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablitocli/387deb1bf4f4b98e0bc98ea58ada6011 to your computer and use it in GitHub Desktop.
Save pablitocli/387deb1bf4f4b98e0bc98ea58ada6011 to your computer and use it in GitHub Desktop.
WRITE-HOST "INGRESAR CREDENCIALES DE LOGON @pablitocli"
$cred=get-credential
WRITE-HOST "REALIZANDO CONEXION A LOS VCENTERS!!!!"
$vc1=read-host "INGRESE EL vCenter ORIGEN"
$vc2=read-host "INGRESE EL vCenter Destino"
WRITE-HOST "CONNECTANDO!!!!....."
Connect-viserver $vc1 -credential $cred | OUT-NULL
Connect-viserver $vc2 -credential $cred | OUT-NULL
$Rolesvc1=Get-VIRole -server $VC1
foreach ($role in $Rolesvc1){
$rolesvc2=Get-VIRole -server $VC2
if ($rolesvc2.name -notcontains $role.name ) {
[string[]]$RolesDelVC1=Get-VIPrivilege -Role (Get-VIRole $role.name -server $VC1) |%{$_.id}
New-VIRole -name $role.name -Server $VC2
Set-VIRole -role (get-virole -Name $role.name -Server $VC2) -AddPrivilege (get-viprivilege -id $RolesDelVC1 -server $VC2)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment