Created
June 30, 2020 08:23
-
-
Save mritsurgeon/c01f19d3f680078c5e6313a02ada7e78 to your computer and use it in GitHub Desktop.
Veeam Publish with Drive letter assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add veeam snapin | |
Add-PSSnapin VeeamPSSnapin | |
# Connect to veeam backup server | |
Connect-VBRServer -Server "veeam" -User "Usernamer" -Password "****" | |
# Assign veriables to each restore point being used & Credntials for mount process | |
$Jobname = "Vm test Data" | |
$Servername = "windev2001eval" | |
$creds = Add-VBRCredentials -User "domainl\username" -Password "****" | |
# Create an Array of all backups associated with Job "Vm test data" & Server "windev2001eval" | |
# 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 | |
} | |
# Using Dsk managment 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',''} | |
# For each disk in Disk array assign next availvle volume letter to partion 2 | |
foreach ($Disk in $diskarray) | |
{ | |
Add-PartitionAccessPath -DiskNumber $disk -PartitionNumber 2 -AssignDriveLetter | |
} | |
#end | |
#Unmount Un Publish | |
$sessionarray = Get-VBRPublishedBackupContentSession | |
foreach ($session in $sessionarray) | |
{ | |
Unpublish-VBRBackupContent -Session $session -RunAsync | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment