-
- Service Provider
- Posts: 13
- Liked: never
- Joined: Feb 11, 2016 6:13 pm
- Full Name: Frode Åbø Wiersen
- Contact:
Copy Backup Objects between Jobs
Hi
I am doing some redesigning of our backup jobs, and want to merge multiple jobs to larger jobs.
Being an IT-pro, doing this manually is just something I don't do, so I turned to Powershell to automate this process.
Using Get-VBRJob, Get-VBRJobObject and Add-VBRHvJobObject I have tried automating this process, but it seems like the objects I get when doing "Get-VBRJobObject" isn't usable as Entity in the "Add-VBRHvJobObject" cmdlet.
What I have done to make this happen using powershell is doing a Find-VBRHvEntity first, then using the Add-VBRHvJobObject after, but this is enumerating the cluster every time it is doing the find (it takes between 60-120 seconds for every find). This means adding 60 VMs takes me between one and two hours - automated still, but very slow!
Any help in writing the proper script/cmdlet to add all objects from one job to another (which goes fast) would be highly appreciated!
Thanks!
I am doing some redesigning of our backup jobs, and want to merge multiple jobs to larger jobs.
Being an IT-pro, doing this manually is just something I don't do, so I turned to Powershell to automate this process.
Using Get-VBRJob, Get-VBRJobObject and Add-VBRHvJobObject I have tried automating this process, but it seems like the objects I get when doing "Get-VBRJobObject" isn't usable as Entity in the "Add-VBRHvJobObject" cmdlet.
What I have done to make this happen using powershell is doing a Find-VBRHvEntity first, then using the Add-VBRHvJobObject after, but this is enumerating the cluster every time it is doing the find (it takes between 60-120 seconds for every find). This means adding 60 VMs takes me between one and two hours - automated still, but very slow!
Any help in writing the proper script/cmdlet to add all objects from one job to another (which goes fast) would be highly appreciated!
Thanks!
Frode @ Netscenario
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Copy Backup Objects between Jobs
Have you though about creating a hash table (as described here) to run the said query only once? Thanks.
-
- Service Provider
- Posts: 13
- Liked: never
- Joined: Feb 11, 2016 6:13 pm
- Full Name: Frode Åbø Wiersen
- Contact:
Re: Copy Backup Objects between Jobs
Hi, and thanks for quick reply
The problem I am having, is that for each "Find-VBRHvEntity" it is enumerating the cluster, which is causing each line to take "forever" (in this case forever equals to 1-2 minutes). So it have just taken me 90 minutes to loop between a table of 50 objects.
Is there no way I can do this faster?
Please give me some examples if possible - thanks!
The problem I am having, is that for each "Find-VBRHvEntity" it is enumerating the cluster, which is causing each line to take "forever" (in this case forever equals to 1-2 minutes). So it have just taken me 90 minutes to loop between a table of 50 objects.
Is there no way I can do this faster?
Please give me some examples if possible - thanks!
Frode @ Netscenario
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Copy Backup Objects between Jobs
Kindly, check the link I've provided - it contains an example.
The idea here is to run Find-VBRHvEntity only once, assign its result to a hash table ( $vms=@{} ) and, starting from that moment, work with the hash table, instead of querying infrastructure directly.
Thanks.
The idea here is to run Find-VBRHvEntity only once, assign its result to a hash table ( $vms=@{} ) and, starting from that moment, work with the hash table, instead of querying infrastructure directly.
Thanks.
-
- Service Provider
- Posts: 13
- Liked: never
- Joined: Feb 11, 2016 6:13 pm
- Full Name: Frode Åbø Wiersen
- Contact:
Re: Copy Backup Objects between Jobs
Sorry if I am being a bit slow on this one, but how do I run the Find-VBRHvEntity against a specific (already exsisting) backup job?
"Get-VBRJob -name "Job Name" | Get-VBRJobObject | Find-VBRHvEntity" don't work, as Find-VBRHvEntity can't take pipeline input.
Any idea?
"Get-VBRJob -name "Job Name" | Get-VBRJobObject | Find-VBRHvEntity" don't work, as Find-VBRHvEntity can't take pipeline input.
Any idea?
Frode @ Netscenario
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Copy Backup Objects between Jobs
So, the process would like the following:
1) Get an old backup job
2) Get its source objects
3) Find VMs in virtual infrastructure which correspond to the gotten objects (object references comparison)
4) Get a new backup job
5) Add objects returned on step 3 to the new backup job
Let me illustrate it with simple example that doesn't contain cycle (necessary to get all source objects) and hash table (required to speed up the process):
Thanks.
1) Get an old backup job
2) Get its source objects
3) Find VMs in virtual infrastructure which correspond to the gotten objects (object references comparison)
4) Get a new backup job
5) Add objects returned on step 3 to the new backup job
Let me illustrate it with simple example that doesn't contain cycle (necessary to get all source objects) and hash table (required to speed up the process):
Code: Select all
asnp VeeamPSSnapin
$OldJob = Get-VBRJob -Name "Name of an old backup Job"
$JobObject = Get-VBRJobObject -Job $OldJob -name "Name of source object"
$Server = Get-VBRServer -Name "Name of cluster"
$Entity = Find-VBRHvEntity -Server $Server | where {$_.Reference -eq $JobObject.GetObject().ObjectRef}
$NewJob = Get-VBRJob -Name "Name of new Job"
Add-VBRHvJobObject -Job $NewJob -Entities $Entity
-
- Service Provider
- Posts: 13
- Liked: never
- Joined: Feb 11, 2016 6:13 pm
- Full Name: Frode Åbø Wiersen
- Contact:
Re: Copy Backup Objects between Jobs
Hi again
Thanks, that got me going!
This is what I ended up with:
Thanks for helping me out
Thanks, that got me going!
This is what I ended up with:
Code: Select all
asnp VeeamPSSnapin
$clusterName = "Cluster Name"
$NewJobInput = "New Job"
$OldJob = "Old Job"
$vms = Find-VBRHvEntity -server $clusterName | Where-Object {$_.Type -eq "Vm"}
$OldJob = Get-VBRJob -Name $OldJob
$JobObject = Get-VBRJobObject -Job $OldJob
$Server = Get-VBRServer -Name $clusterName
$Entity = $vms | where {$_.Reference -in $JobObject.GetObject().ObjectRef}
$NewJob = Get-VBRJob -Name $NewJobInput
Add-VBRHvJobObject -Job $NewJob -Entities $Entity
Frode @ Netscenario
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Copy Backup Objects between Jobs
Since you're passing cluster name directly to Find-VBRHvEntity cmdlet, this line is not needed:
Thanks.$Server = Get-VBRServer -Name $clusterName
Who is online
Users browsing this forum: No registered users and 4 guests