Add Networkmappings to Replica (v8 and newer)

PowerShell script exchange

Add Networkmappings to Replica (v8 and newer)

Veeam Logoby Andreas Neufert » Wed Mar 18, 2015 9:49 am 2 people like this post

Hi Team,

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
$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}

#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}

#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
Andreas Neufert
Veeam Software
Posts: 2370
Liked: 390 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Return to PowerShell

Who is online

Users browsing this forum: No registered users and 1 guest