just a small example for the new v8 functionallity round about setting network mappings.
This code is not compatible with v7 and older.
Code: Select all
#Input
$JobName = "Test-replication"
$SourceManagedServer = "esxi55u1" #Veeam reads network objects here
$SourceNetworks = @(“MGMT”,"DMZ”)
$TargetManagedServer = "esxi55u1" #Veeam reads network objects here
$TargetNetworks = @("LAN","LAN")
#Load Veeam Plugin
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
#Create arraylist and place all SourceNetwork Objects there
$SourceNetworkObjects = New-Object System.Collections.ArrayList
Foreach($SourceNetwork in $SourceNetworks) {
$snetwork = Get-VBRServer -Name $SourceManagedServer | Get-VBRViServerNetworkInfo | where {$_.Name -eq $SourceNetwork}
$SourceNetworkObjects.add($snetwork);
}
#Create arraylist and place all TargetNetwork Objects there
$TargetNetworkObjects = New-Object System.Collections.ArrayList
Foreach($TargetNetwork in $TargetNetworks) {
$tnetwork = Get-VBRServer -Name $TargetManagedServer | Get-VBRViServerNetworkInfo | where {$_.Name -eq $TargetNetwork}
$TargetNetworkObjects.add($tnetwork);
}
#Read out the Jobobject
$JobObject = Get-VBRJob -Name $JobName
#Write the network list to the job
Set-VBRViReplicaJob -job $JobObject -EnableNetworkMapping -SourceNetwork $SourceNetworkObjects -TargetNetwork $TargetNetworkObjects