Exporting a job and re-importing it

PowerShell script exchange

Exporting a job and re-importing it

Veeam Logoby mgratla » Mon Jan 05, 2015 5:42 pm

I'm trying to find a way to export an entire Replication or Backup job in powershell, then import it on another server.

The intention is to take all the data and throw it into some variables so we can recreate with things like the name appended with _test or _reverse or swap the source and destination proxies etc.
mgratla
Influencer
 
Posts: 19
Liked: never
Joined: Tue Feb 04, 2014 11:13 pm
Full Name: Mark

Re: Exporting a job and re-importing it

Veeam Logoby mgratla » Tue Jan 06, 2015 6:57 pm

I'm not sure if we're even starting in the right place.

We're trying to build 'reverse replica jobs' from the Get-VBRJob command so that we can put everything into variables and essentially create a mirror of the jobs we have. The reason is because we're moving datacenters, and while we can failover temporarily with no problem we would need to move into the other DR datacenter for a few weeks before failing back to the new production Datacenter. We can't run on snapshots for that long so we would need to do a permanent failover.
We would therefore need to take our existing jobs going from Site A to Site B and create mirrors of them to begin replicating everything from B back to A since you can't 'undo' a permanent failover by design.
Because of the number of jobs and objects in the jobs, we want to do this all through powershell.

We've gotten as far as using a Foreach statement in the script to run things like Get-VBRJob -name $name against things like Get-VBRJobObject and then another statement within that to get the VSS settings for individual machines.
On the subject of the VSS options for individual machines, the output of the .vssoptions section yeilds something like this which, I'm not sure we can use when it comes to re-creating the jobs. (By use, I mean call this part of the variable and use it as an input when creating a job)


Code: Select all
 VssSnapshotOptions: [Enabled: [True], IgnoreErrors: [True], IsCopyOnly: [True]],
 WinGuestFSIndexingOptions: [Type: [None]], LinGuestFSIndexingOptions: [Type: [None]],
 SqlBackupOptions: [TransactionLogsProcessing: [NeverTruncate], BackupLogsFrequencyMin: [15],
 UseDbBackupRetention: [True], RetainDays: [15], ProxyAutoSelect: [True]], ExchangeBackupOptions:
 [TransactionLogsProcessing: [TruncateOnlyOnSuccessJob]], WinCredsId:
 [00000000-0000-0000-0000-000000000000], LinCredsId: [00000000-0000-0000-0000-000000000000], Old
 Properties: [Enabled: [True], IgnoreErrors: [True], GuestFSIndexingType: [None],
 IncludedIndexingFolders: [], ExcludedIndexingFolders: [%windir%; %ProgramFiles%; %TEMP%],
 LinGuestFSIndexingType: [None], LinIncludedIndexingFolders: [], LinExcludedIndexingFolders: [],
 IsFirstUsage: [False]]



We haven't got a problem with nesting foreach statements inside statements to get all the information. The problem comes with getting the rest of the relevant information.
Get-VBRJob proxy only lists one of the procies involved in a replica job. It doesn't list the proxy used in our secondary site

I can't find anything on how to get the Re-IP rules, nor the Network-Remapping either.

The hope was to be able to take each and every one of these items, throw it into a variable and then run a script to create the exact opposite.

The other hope and expectation was that this would be a one liner, but it seems like it's going to turn into a monster of a script. We've been banging our heads against a brick wall but there doesn't seem to be any one single command that lists a job, it's objects and their VSS options, the source and target proxies, the data repository for the metadata, the re-ip rule, and the network re-map rule, and the replica seeding / map to existing virtual machine rule.
If we could get all of those then we could easily flip them!
mgratla
Influencer
 
Posts: 19
Liked: never
Joined: Tue Feb 04, 2014 11:13 pm
Full Name: Mark

Re: Exporting a job and re-importing it

Veeam Logoby v.Eremin » Tue Jan 13, 2015 9:24 am

Before we discuss the code provided, may I ask you why configuration backup/import doesn't work for you? Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Exporting a job and re-importing it

Veeam Logoby mgratla » Tue Jan 13, 2015 3:43 pm

Because we don't need an exact duplicate created, we need reversed version.
mgratla
Influencer
 
Posts: 19
Liked: never
Joined: Tue Feb 04, 2014 11:13 pm
Full Name: Mark

Re: Exporting a job and re-importing it

Veeam Logoby v.Eremin » Wed Jan 14, 2015 9:38 am

Get-VBRJob proxy only lists one of the procies involved in a replica job. It doesn't list the proxy used in our secondary site

Required proxy can be gotten via Get-VBRProxy commandlet.

I can't find anything on how to get the Re-IP rules, nor the Network-Remapping either.

Depending on product version, you can use different approaches. There is a workaround for version 7. In version 8 we have added several switches and commandlets making your life easier, namely Add-VBRViReplicationJob -SourceNetwork -TargetNetwork -ReIPRule, Get-VBRViReplicaReIPRule, Get-VBRViServerNetworkInfo.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: Bing [Bot] and 4 guests