-
- Influencer
- Posts: 10
- Liked: 2 times
- Joined: May 14, 2013 12:22 pm
- Contact:
Start-VBRQuickBackup without Find-VBRViEntity
Hi, i wonder if it would be possible to run Start-VBRQuickBackup -VM <IVmItem[]> without going through the process with Get-VBRServer | Find-VBRViEntity. it's very timeconsuming to search for the IVmItem on all the hosts if you got more than one.
Regards Tom
Regards Tom
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRQuickBackup without Find-VBRViEntity
The process emulates GUI to some extent, so, I'm not sure how it might look differently: you go to virtual machine node -> select appropriate host (Get-VBRServer) -> find required VM (Find-VBRViEntity) -> start quick backup (Start-VBRQuickBackup).
In order to speed up the process you can try to provide Get-VBRServer with the name of a host the needed VM resides on, so that, the script won't query all hosts vCenter consists of.
Thanks.
In order to speed up the process you can try to provide Get-VBRServer with the name of a host the needed VM resides on, so that, the script won't query all hosts vCenter consists of.
Thanks.
-
- VP, Product Management
- Posts: 6035
- Liked: 2860 times
- Joined: Jun 05, 2009 12:57 pm
- Full Name: Tom Sightler
- Contact:
Re: Start-VBRQuickBackup without Find-VBRViEntity
Calls to Find-VBRViEntity are fairly slow, so you want to limit them as much as possible. One of the simplest solutions, if you're sure you won't have duplicate VM names, is to make a single call at the start of the script to Find-VBRViEntity and load the resulting objects into a hash table like so:
Now, you can instantly access the ViEntity object of any VM in the entire environment by name with this simple code:
So to do a quick backup would just be:
If you do have a little more complex environment, especially in cases where there might be duplicate VM names in the environment, you might need to do something a little more complex, but the concept is the same, make on a single call to the long running cmdlets and load them into a variable (hash tables are great because of their speed to access individual objects).
Code: Select all
$vms = Find-VBRViEntity -VMsAndTemplates | Group-Object Name -AsHashTable
Code: Select all
$vms.<vm_name>
Code: Select all
Start-VBRQuickBackup -VM $vms.<vm_name>
-
- Influencer
- Posts: 10
- Liked: 2 times
- Joined: May 14, 2013 12:22 pm
- Contact:
Re: Start-VBRQuickBackup without Find-VBRViEntity
Hi thanks.
if i understand this correctly, Find-VBRViEntity connects to the esx-host if i specify -Server and connects to all hots in veeam if i dont specify -Server. This is what i want to avoid if possible.
We got aprox 20 vcenters and the same amount of standalone hosts in the Infrastructure-> Vmware vsphere list. I was thinking that the value i need for Start-VBRQuickBackup could be found in veeam somewhere, etc get-vbrbackup or get-vbrjobobject and prepare the Find-VBRViEntity command without asking any hosts.
/ Tom
if i understand this correctly, Find-VBRViEntity connects to the esx-host if i specify -Server and connects to all hots in veeam if i dont specify -Server. This is what i want to avoid if possible.
We got aprox 20 vcenters and the same amount of standalone hosts in the Infrastructure-> Vmware vsphere list. I was thinking that the value i need for Start-VBRQuickBackup could be found in veeam somewhere, etc get-vbrbackup or get-vbrjobobject and prepare the Find-VBRViEntity command without asking any hosts.
/ Tom
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRQuickBackup without Find-VBRViEntity
The way you've written a script it indeed walks through all servers added to a backup console, finding all VMs present there. (Get-VBRServer | Find-VBRViEntity)
In order to improve performance, limit the scope first:
Then, use tricks proposed by Tom:
Thanks.
In order to improve performance, limit the scope first:
Code: Select all
$Server = Get-VBRServer -name "Name of particular server"
Code: Select all
$vms = Find-VBRViEntity -Server $Server -VMsAndTemplates | Group-Object Name -AsHashTable
Start-VBRQuickBackup -VM $vms.<vm_name>
-
- VP, Product Management
- Posts: 6035
- Liked: 2860 times
- Joined: Jun 05, 2009 12:57 pm
- Full Name: Tom Sightler
- Contact:
Re: Start-VBRQuickBackup without Find-VBRViEntity
Perhaps I'm misunderstanding your use case, can you share a little more information about it? What information do you have available to perform the query? Server name and VM name perhaps? I mean, in all cases you'd have to have at least that to pass to Start-VBRQuickBackup, because there's no other way for it to know the specific VM.
When you said that it takes time to search for ViItem when you have more than one server it made me assume you only had a VM name and were then attempting to query each and every vc/host individually with Find-VBRViEntity, which would almost certainly take longer than just running Find-VBRViEntity without a server and grabbing everything (although perhaps not). We can't really work without the ViEntity because that's what the job uses to find the correct VM, but if you only have, for example, only the VM name, it should possible to query the job object first and use that to figure out which specific server it is on.
Maybe you can share some code to give us a better idea of what you are currently doing, and we can see if we can brainstorm a way to make it better. Another option might be to use the REST API instead of Powershell (or even call the REST API from Powershell) as it's quite a bit faster at this task.
When you said that it takes time to search for ViItem when you have more than one server it made me assume you only had a VM name and were then attempting to query each and every vc/host individually with Find-VBRViEntity, which would almost certainly take longer than just running Find-VBRViEntity without a server and grabbing everything (although perhaps not). We can't really work without the ViEntity because that's what the job uses to find the correct VM, but if you only have, for example, only the VM name, it should possible to query the job object first and use that to figure out which specific server it is on.
Maybe you can share some code to give us a better idea of what you are currently doing, and we can see if we can brainstorm a way to make it better. Another option might be to use the REST API instead of Powershell (or even call the REST API from Powershell) as it's quite a bit faster at this task.
Who is online
Users browsing this forum: No registered users and 25 guests