Help Center
Choose product document...
Veeam Backup & Replication 9.5
PowerShell Reference

Working with Hyper-V Virtual Lab

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:

  1. Get the Hyper-V host on which you want to create the virtual lab with Get-VBRServer and save it to a variable.
  2. Run Add-VSBHvVirtualLab with this variable to create the virtual lab.

// Get the host:

PS C:\PS> $host = Get-VBRServer -Type Hyper-V

 

// Create the virtual lab:

PS C:\PS> Add-VSBHvVirtualLab -Name "Microsoft Exchange Vlab" -Server $server -Folder "c:\VirtualLabs"

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:

  1. Get the virtual lab that you want to remove with Get-VSBHvVirtualLab.
  2. Run Remove-VSBHvVirtualLab to remove it.

// Get the virtual lab and pipe it down:

PS C:\PS> Get-VSBHvVirtualLab -Name "Microsoft Exchange Vlab" | Remove-VSBHvVirtualLab

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:

  1. Run Find-VSBHvVirtualLab to look for the virtual lab. You will need to get the host where it is located first.
  2. Add them with Connect-VSBHvVirtualLab.

Note that the Find-VSBHvVirtualLab 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-VSBHvVirtualLab cmdlet. For all other purposes, run Get-VSBHvVirtualLab.

// Find the virtual lab:

PS C:\PS> $newvlab = Get-VBRServer -Type HvServer | Find-VSBHvVirtualLab -Name "Virtual Lab 02"

 

// Connect the virtual lab:

PS C:\PS> Connect-VSBHvVirtualLab -VirtualLab $newvlab

Veeam Large Logo

User Guide for VMware vSphere

User Guide for Microsoft Hyper-V

Enterprise Manager User Guide

Veeam Cloud Connect Guide

Veeam Backup Explorers User Guide

PowerShell Reference

RESTful API Reference

Veeam Backup FREE Edition User Guide

Veeam Backup for Microsoft Office 365

Veeam ONE Documentation

Veeam Agent for Windows Documentation

Veeam Agent for Linux Documentation

Veeam Management Pack Documentation