PowerShell script exchange
Post Reply
rmf
Novice
Posts: 4
Liked: never
Joined: Jan 15, 2015 7:59 pm
Full Name: Ryan
Contact:

HyperV - New reIPing rule with powershell

Post by rmf »

I have been unsuccessful with setting a NEW reIP rule with powershell. I get a readonly error when trying to set a new rule within the Options container. Could someone point me in the right direction for this? Thanks in advance.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: HyperV - New reIPing rule with powershell

Post by veremin »

Information regarding RE-IP rules can be found inside $Job.info.Options.RootNode.ReIPRules.Rule. For instance, example provide below updates the gateway settings:

Code: Select all

Asnp VeeamPSSnapin
$Job = Get-VBRJob -Name "Name of replication Job"
$Info = $Job.Info
$Info.Options.RootNode.ReIPRules.Rule.Target.Gateway = "172.18.0.2"
[Veeam.Backup.Core.CBackupJob]::Update($Info)
Though, this example will work only if RE-IP has been enabled previously in the job settings and at least one rule has been created.

While RE-IP can be enabled through the following example, the rule creation is a different story:

Code: Select all

$Job = Get-VBRJob -Name "Name of Replication Job"
$Info = $Job.info
$Info.Options.RootNode.UseReIP = "True"
[Veeam.Backup.Core.CBackupJob]::Update($Info)
$Job.info.Options.RootNode.ReIPRules that has all information regarding RE-IP rules is an XML element. So, you can try to generate XML file containing desired rules and try to assign it somehow as RE-IP rule.

Otherwise, you can create a job with some pre-defined RE-IP rules that can be utilized as a template later on. The idea here is to copy that job and change RE-IP settings in accordance with their needs, using the script mentioned in my previous post.

Thanks.
rmf
Novice
Posts: 4
Liked: never
Joined: Jan 15, 2015 7:59 pm
Full Name: Ryan
Contact:

Re: HyperV - New reIPing rule with powershell

Post by rmf »

Thanks v.Eremin. This was my original conclusion but was hoping for a different approach... disappointing. :cry:
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: HyperV - New reIPing rule with powershell

Post by veremin »

I think one "dummy" job that has one RE-IP rule created is the easiest approach here. This job can be used as a template and you can modify corresponding settings however you like. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests