This article provides steps that need to be performed in order to automate moving tapes to the Free media pool in Veeam B&R

Description

While configuring StarWind VTL Cloud replication, in Tape File Retention Settings, there is a possibility to create new empty tape automatically when the existing tape is removed from the Virtual Library for replication.

Once the tape is created automatically, it should be processed and moved from the Unrecognized media pool to the Free media pool, so that Veeam B&R could use it for backups. Instead of doing it manually, the administrator can automate this process by configuring a scheduled task, which will be triggered by the tape creation event and will execute the script to move the tape to the Free media pool.

The script will be different, depending on the StarWind VTL and Veeam B&R location in the infrastructure.  Below are the steps for the configuration of the scheduled task and two options for the script (when Veeam B&R and StarWind VTL are located on the same host or on separate hosts).

Steps

Scenario 1: Veeam B&R and StarWind VTL are located on the same host.

  • Login to Veeam B&R host where StarWind VTL is installed as well.
  • Create a PowerShell script, name it “automate_retention.ps1” and save it on the C:\ drive (file’s location can be changed if required).
    Example for “automate_retention.ps1” script:

Add-PSSnapin VeeamPSSnapin
Connect-VBRServer
timeout 10
Rescan-VBREntity -AllTapeServers
timeout 5
Get-VBRTapeMedium -MediaPool “Unrecognized” | Move-VBRTapeMedium -MediaPool “Free”
Disconnect-VBRServer

  • Create a scheduled task (Control Panel -> Administrative Tools -> Task Scheduler -> Create Basic Task) and follow the wizard’s steps:
    – Specify the task name, select When a specific event is logged, and click Next.
    – Select Application in the Log dropdown, type StarWindService as the event source and 4352 for the event ID. Click the Next button.
    – Choose Start a Program as the action that the task will perform and click Next.
    – Type powershell.exe in the Program/script field. In the Add Arguments field, type:

    -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File C:\automate_retention.ps1

    – Click the Next button to continue and Finish to exit the wizard.

NOTE: Configure the task to run with the highest privileges by enabling the checkbox at the bottom of the window. Also, make sure that the “Run whether user is logged on or not” option is selected.

Scenario 2: Veeam B&R and StarWind VTL are located on separate hosts:

  • Login to StarWind VTL host and create Veeam folder in C:\Program Files\ folder;
  • Login to Veeam B&R host and copy all files from the folder C:\Program Files\Veeam\Backup and Replication\Console to the previously created folder C:\Program Files\Veeam on StarWind VTL host;
    NOTE: Make sure that Veeam.Backup.PowerShell.dll is copied to C:\Program Files\Veeam folder on StarWind VTL host;
  • Login to StarWind VTL host and create a PowerShell script, name it “automate_retention.ps1” and save on the C:\ drive (file’s location can be changed if required).
    Example for “automate_retention.ps1” script:

Import-Module “C:\Program Files\Veeam\Veeam.Backup.PowerShell.dll”
Connect-VBRServer -User username_here -Password password_here -Server vbr_server_fqdn_here
timeout 10
Rescan-VBREntity -AllTapeServers
timeout 10 #inrecrease the value if the rescan does not work
Get-VBRTapeMedium -MediaPool “Unrecognized” | Move-VBRTapeMedium -MediaPool “Free”
Disconnect-VBRServer

  • Create a scheduled task (Control Panel -> Administrative Tools -> Task Scheduler -> Create Basic Task) and follow the wizard’s steps:
    – Specify the task name, select When a specific event is logged, and click Next.
    – Select Application in the Log dropdown, type StarWindService as the event source and 4352 as the event ID. Click the Next button.
    – Choose Start a Program as the action that the task will perform and click Next.
    – Type powershell.exe in the Program/script field. In the Add Arguments field, type:

    -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File C:\automate_retention.ps1

    – Click the Next button to continue and Finish to exit the Wizard.

NOTE: Configure the task to run with the highest privileges by enabling the checkbox at the bottom of the window. Also, make sure that the “Run whether user is logged on or not” option is selected.

Now the automatically created tape will be moved from the Unrecognized media pool to the Free media pool no administrator’s manual interaction.

Request a Product Feature

To request a new product feature or to provide feedback on a StarWind product, please email to our support at [email protected] and put “Request a Product Feature” as the subject.

Back to Knowledge Base