Last active
April 6, 2018 17:48
-
-
Save pablitocli/387deb1bf4f4b98e0bc98ea58ada6011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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