PowerShell script exchange
Post Reply
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders » 1 person likes this post

I am trying to set up a script that will update Re-IP rules and Network Mapping of replica jobs. This is to allow us to switch them to an isolated network for testing and back again post testing. I am running into the same error for each command. The replica jobs target a cluster. When i switch them to target a host instead then the script appears to work successfully. Is it possible to target a cluster when performing these commands?

Error

Code: Select all

Set-VBRViReplicaJob : Server should be host or cluster.
At line:24 char:9
+         Set-VBRViReplicaJob -Job $job -EnableReIp -ReIpRule $reiprule
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-VBRViReplicaJob], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Cmdlets.SetVBRViReplicaJob
 
Set-VBRViReplicaJob : Server should be host or cluster.
At line:28 char:9
+         Set-VBRViReplicaJob -Job $job -SourceNetwork $SourceNW -Targe ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-VBRViReplicaJob], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Cmdlets.SetVBRViReplicaJob

Script

Code: Select all

# Variables
$JobNameFilter = "Test_Replica*"
$reiprule = New-VBRViReplicaReIpRule -SourceIp x.x.x.* -SourceMask 255.255.255.0 -TargetIp x.x.x.* -TargetMask 255.255.255.0 -TargetGateway x.x.x.x
$SourceNW = Get-VBRViServerNetworkInfo -Server xxxx | Where-Object {$_.NetworkName -eq "VM Network"}
$TargetNW = Get-VBRViServerNetworkInfo -Server xxxxx | Where-Object {$_.NetworkName -eq "Isolated VM Network"}

#SCRIPT Body


# Get jobs that match the name filter
$targetJobs = Get-VBRJob | Where { $_.Name -like $JobNameFilter -and $_.IsReplica }
Write-Host ("Processing changes for " + $targetJobs.Count + " job(s):")

# Make the settings change for each job
ForEach ($job In $targetJobs) {
        Write-Host ("Job: [" + $job.Name + "]... ")

#Backup configuration
        $jobname = $job.name
        Get-VBRViReplicaReIpRule -Job $job | Out-File "c:\temp\$jobname+REIP+_$(get-date -format yyyyMMdd_hhmmtt).txt"

#Set Ip Rules for Isolated DR Network

        Set-VBRViReplicaJob -Job $job -EnableReIp -ReIpRule $reiprule

#Set Network Mapping for Isolated DR Network
       
        Set-VBRViReplicaJob -Job $job -SourceNetwork $SourceNW -TargetNetwork $TargetNW
} 
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by oleg.feoktistov » 1 person likes this post

Hi Martin,

Reproduced the same behavior in my lab. Let me discuss it with QA and follow up on this thread after.

Best regards,
Oleg
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

Thanks Oleg. Much appreciated !
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by oleg.feoktistov »

Hi Martin,

Confirmed as a bug. Can't promise that we will manage to fix it before v12 release though.
Just so you know if the fix won't make it to the release, in the latest v12 beta the behavior is the same, but the exception thrown is different.


Best regards,
Oleg
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

Thanks Oleg. Fingers crossed it can be fixed for v12.
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

I was just wondering if this bug was resolved in v12?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by oleg.feoktistov »

Yes, should be resolved. Haven't tried in GA build yet, but in RTM the bug is not reproducible anymore. Thanks!
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

Brilliant thanks Oleg!
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

Was able to test this today successfully on V12 however when MFA is enabled it won't work. I saw mention of improvements in MFA with Powershell in the initial 12.1 announcements. Will it be possible to run pre/post failover scripts when MFA is enabled in that release?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by oleg.feoktistov » 1 person likes this post

You cannot use VBR powershell module under MFA-enabled account. Nor will you be able to in v12.1. If MFA is enabled for VBR, use service accounts to connect to VBR with Powershell as described here. Thanks!
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

Thanks Oleg, for a planned failover there is an option to run scripts pre and post failover however i didn't see an option to run these scripts under a different account. How would you go about running these planned failover scripts in this scenario?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by oleg.feoktistov » 1 person likes this post

There is no option to run pre/post-failover scripts under a different account because they are being ran under the currently authenticated account on a backup server. Hence, it depends on how you trigger a failover plan: if through UI - then scripts are ran under the MFA-enabled account that has already logged in, if through Powershell - you'd have to authenticate with a service account (MFA-disabled), the scripts will be ran under it. Hope it helps!
mbroaders
Service Provider
Posts: 121
Liked: 8 times
Joined: May 15, 2012 9:06 am
Full Name: Martin Broaders
Contact:

Re: Re-IP and Network Re-Mapping - Server should be host or cluster

Post by mbroaders »

Appreciate it Oleg. Seems a little clunky but at least i can update the process to reflect that.
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests