This example shows how to create a virtual lab and perform other actions on virtual labs from your command line.
Create a virtual lab
To add a virtual lab, you will need to perform the following steps:
- Get the VMware host on which you want to create the virtual lab with Get-VBRServer and save it to a variable.
- Get the datastore that will be used for storing the redo logs running Find-VBRViDatastore and save it to a variable.
- Run Add-VSBVirtualLab with these variables to create the virtual lab.
// Get the host:
$host = Get-VBRServer -Type ESXi
// Get a datastore:
$datastore = Find-VBRViDatastore -Name "Datastore1" -Server $host
// Create the virtual lab:
Add-VSBVirtualLab -Name "Microsoft Exchange Vlab" -Server $host -Datastore $datastore
Remove the virtual lab
If you no longer need a virtual lab, you can remove it.
To remove a virtual lab, you will need to perform the following steps:
- Get the virtual lab that you want to remove with Get-VSBVirtualLab.
- Run Remove-VSBVirtualLab to remove it.
// Get the virtual lab and pipe it down:
Get-VSBVirtualLab -Name "Microsoft Exchange Vlab" | Remove-VSBVirtualLab
Connect an existing virtual lab
If you have virtual labs that are not added to your Veeam backup console, you can look for them and connect them.
You will need to perform the following steps:
- Run Find-VSBVirtualLab to look for the virtual lab. You will need to get the host where it is located first.
- Add them with Connect-VSBVirtualLab.
Note that the Find-VSBVirtualLab cmdlet can be used only to look for the virtual labs that are not connected to the Veeam backup server. You can use the objects that you obtain with it only with the Connect-VSBVirtualLab cmdlet. For all other purposes, run Get-VSBVirtualLab.
// Find the virtual lab:
$newvlab = Get-VBRServer -Name "ESXi01" | Find-VSBVirtualLab -Name "Virtual Lab 02"
// Connect the virtual lab:
Connect-VSBVirtualLab -VirtualLab $newvlab