Skip to main content

Veeam Data Re-use All Backups Continued……

Veeam Data Re-use All Backups Continued……

So, this is a Continuation of Blog post PART 3 of Data Re-use blog series, Part 3 Here  addressed Business Intelligence with Veeam Re-Use API.

** If you can view the above image, I have associated numbers with each step below representing the progress or flow in image. (1)

Continuation

In My initial Blog posts:

  1. Part one  Here  addressed Data Classification with Veeam Re-Use API.
  2. Part two Here addressed Security Analysis with Veeam Re-Use API.
  3. Part three Here addressed Business Intelligence with Veeam Re-Use API.

In this continuation I further added to scripts used in Part 1, 2 & 3, specifically Part 3…

In part 3 I used First and last Recovery point associated to a Server that was backed up by Veeam.

In this post I use all points associated to server and add more variables to execute more commands against.

Let’s start…

The Use case:  

I wanted to mount Multiple backups at the same time & the assigned volume letters to the partitions associated to see each volume through windows explorer. I mounted all Restore points associated to a server within a specific backup job. I could then through explorer see multiple copies of the same volume mounted & browsable.

The server that I use in this use case is “windev2001eval"

This server has 1 Disk but multiple Partitions

System Reserved & the C: Os/Primary partition

For the use case I decided to only assign drive letter to partition two “the Os/Primary partition “

“windev2001eval" VM
 

Now that we know the disk layout of the Source Backup Image that we are mounting we can move to the next steps..

Veeam Data Re-Use APIs

So how do we address the data held in backups by Veeam?

In V10 Veeam released the Data Re-use API , more can be read here on the different syntax available:

Veeam help centre https://helpcenter.veeam.com/docs/backup/powershell/veeam-data-integration-api.html?ver=100

This command is a different to previous posts 1, 2 & 3 as I now address all recovery points to use as source backup data for the mount process

(1) On My backup server I have 6 Recovery Points (Backups) for “windev2001eval"

Restore Points for “windev2001eval"

My Script:

(2)

# Add Veeam snapin

Add-PSSnapin VeeamPSSnapin

# Connect to Veeam backup server

Connect-VBRServer -Server "veeam" -User "Administrator" -Password "*****"

# Assign variables to each restore point being used & Credentials for mount process

$Jobname = "Vm test Data"

$Servername = "windev2001eval"

$creds = Add-VBRCredentials -User "windev2001eval\Administrator" -Password "*****"

# Create an Array of all backups associated with Job "Vm test data" & Server "windev2001eval"

(3)

# Then publish with each restore point in array

$RParray = Get-VBRBackup -Name $Jobname | Get-VBRRestorePoint -Name $Servername

foreach ($RP in $RParray)

{

  Publish-VBRBackupContent -RestorePoint $RP -TargetServerName "veeam" -TargetServerCredentials $creds

}

Now That the Backups Are published, I can see that the mount process was successful from the Veeam Console, there should be 6!

In instant Recovery Navigation you can see column heading Restore Point which indicates that each is from a different point in time & not the same RP.

Running Publish Tasks x 6 in Veeam Console

(4) In windows disk management we could also see all disks attached and we can see 2 partitions for each, but no volume letters assigned.

Windows Disk Management

At this point you can address all the data without assigning a volume letter through the FLR directory on the mount server as done in my previous posts :

 C:\VeeamFLR

Veeam FLR directory view on CMD

The second part of my script will find all disks associated with the mount process, get the second partition and assign the next available Drive letter as this mount server would already have disks with assignments.

If we look at the output of get-disk

Get-Disk Command in Powershell Output

We can see disks associated with the Mount server and those that where mounted by Veeam under the friendly Name “VEEAM VIRTUAL-DISK “

The script only needs to reference those that were mounted from backup:

My Script continued:

# Using Disk management filter drives to get disks with "Veeam" friendly name, isolate disk number for each and assign variable

$Diskarray = get-disk -friendlyname "veeam virtual-disk" | Select-Object disknumber| ForEach-Object {$_ -replace '\D',''}

The Variable $Diskarray will return only disk numbers for each mounted disk with Friendly Name “VEEAM VIRTUAL-DISK “

I can now assign the next drive letter available on the system to the 2nd partition of each disk in the $Diskarray

(5) My Script continued:

# For each disk in Disk array assign next available volume letter to partition 2

foreach ($Disk in $diskarray)

{

Add-PartitionAccessPath -DiskNumber $disk -PartitionNumber 2 -AssignDriveLetter

}

If we look in disk management once again, we can now see that each has a volume letter assigned to partition 2 and we can browse all through explorer.

 

Disk Management Drive letters assigned

In Windows Explorer:

Windows Explorer Partitions are accessable

Now you can do any number of application requests against the mounted volumes, using this script UN-interrupted you can mount backups & automatically assign Volume letters, then run the required command to run functions against the data on each volume.

At this point I can UN-mount / UN-publish the backup/s

For this I use foreach again to neatly remove all active sessions assigned to $sessionarray

$sessionarray = Get-VBRPublishedBackupContentSession

foreach ($session in $sessionarray)

{

Unpublish-VBRBackupContent -Session $session -RunAsync

}

Hope this was easy enough to follow & assist with enhancing your current data re-use API Scripts

Please leave a comment, share or like

Here is the full Script :


Thank you for reading

Comments