Well, I spent way too much time trying to kick off a Backup Copy Job to rotated media. I accept defeat. After creating a repository for two daily disks, for 8 days worth of backups, and their corresponding jobs, I'm deleting all of it.
The scheduler is downright useless for this purpose, and unless you disable the job you'll receive ~10,000,000 errors before a disk comes back the following week, because the repo is offline. What I tried was using a PS script to enable the Backup Copy Job after my Backup Jobs as a post-job script, and using a post-job script on the Backup Copy Job to disable itself. It was fairly easy to incorporate logic to only process on a "Success"ful job completion. But it wasn't netting me much time, if any, due to it needing to "transform" backups at the Backup Copy Job destination. This would often take hours...
Anyway, here is a script I use to mount my offsite drives, in case anyone may find it useful. I'm not a programmer, the best I can do is sometimes write functions. I don't bother with parameters and the like
. This script get's called by the script below it, and I'm also going to schedule it in Task Manager in case they forget to run the script.
Code: Select all
<#
Chris R | MOSERS | 4/10/2014
This script will find a drive based on the size
specified, mount the drive to the specified
letter, and utilize encryption.
Red text indicates failure, Green is success.
This script requires PowerShell 3.0 on Server
2012 or Windows 8!
#>
Clear-Host
#
# Stuff you may edit:
#
## Disk Stuff
$pPath = "Q:\" #This will be the target drive letter (default "Q:\")
#$pSize = 2000398934016
$pSize = 4000787030016 #The size of your drive in bytes
## Encryption Stuff
$pEncPath = 'C:\Program Files\dcrypt\dccon.exe'
$pEncPass = "password" #Encryption password
##################################################
########## DO NOT EDIT BELOW THIS LINE ###########
# Check to see if path exists
Function PathTest {Test-Path -Path $pPath}
# Mount the encrypted partition
Function MountEncryption {
& $pEncPath -mount $pPath.Substring(0,2) -p $pEncPass > $null
}
# Online the disk if it is offline
Function OnlineDisk {
If ($pDisk.OperationalStatus -ne "Online") {
Write-Host "Disk" $pDisk.Number "is not online, trying to online it..."
Set-Disk -Number $pDisk.Number -IsOffline $false
Start-Sleep 2
}
}
################ START OF SCRIPT #################
# Use PathTest func to find if disk is already mounted
If (PathTest -eq $True) {
Write-Host "Drive is already mounted! Exiting in 5 seconds..." -ForegroundColor Green -BackgroundColor DarkGreen
Start-Sleep -s 5
exit
}
#Introduce tolerance for drive size, it varies
$pSizeL = ($pSize * .99)
$pSizeH = ($pSize * 1.01)
#Find a disk based on $pSize in user edit section
$pDisk = Get-Disk | Where-Object {$_.Size -ge $pSizeL -and $_.Size -le $pSizeH}
#Check if we found a disk
If ($pDisk) {
Write-Host ("Found disk *" + $pDisk.Model + "*, size " + $('{0:N0}' -f ($pDisk.Size / 1GB)) + "GB, as disk number " + $pDisk.Number + ".")
OnlineDisk #check if disk is online
#Find the right partition on the disk
$pPart = Get-Partition -DiskNumber $pDisk.Number | Where-Object {$_.Size -ge $pSizeL -and $_.Size -le $pSizeH}
#Simple empty check, then give the disk the correct drive letter if incorrect
if ($pPart.DriveLetter -ne $pPath.Substring(0,1)) {
Set-Partition -PartitionNumber $pPart.PartitionNumber -NewDriveLetter $pPath.Substring(0,1) -DiskNumber $pDisk.Number
}
#Use the MountEncryption func and wait
MountEncryption
Start-Sleep 5
#Check to see if it really mounted
If (PathTest -eq $True) {
Write-Host "Disk" $pPath.Substring(0,1) "is now mounted." -ForegroundColor Green -BackgroundColor DarkGreen
}
Else {
Write-Host "Disk" $pPath.Substring(0,1) "didn't mount." -ForegroundColor Red -BackgroundColor DarkRed
}
}
#We didn't find a disk
Else {Write-Host "Suitable disk not found! Exiting..." -ForegroundColor Red -BackgroundColor DarkRed}
Here is a script we will be using to make sure the drives mount, remotely:
Code: Select all
Clear-Host
Write-Host "*** REMOTE MOUNT DRIVE SCRIPT ***"
Write-Host "Attempting to mount Q Drive..."
invoke-command { powershell.exe -noprofile -executionpolicy Bypass "C:\Scripts\MountDrives\MountQ.ps1" } -computername Veeam
Write-Host "."
Write-Host "Attempting to mount R Drive..."
invoke-command { powershell.exe -noprofile -executionpolicy Bypass "C:\Scripts\MountDrives\MountR.ps1" } -computername Veeam
Write-Host "."
$pQ = Test-Path \\Veeam\Q$
$pR = Test-Path \\Veeam\R$
If ($pQ -and $pR -eq "True"){
Write-Host "SUCCESS: Finished mounting drives! You may close this window." -ForegroundColor Green -BackgroundColor DarkGreen
}
Else {
Write-Host "FAILURE: One or more drives failed to mount, you're on your own!" -ForegroundColor Red -BackgroundColor DarkRed
}
Start-Sleep 5
I'm back to using RoboCopy to copy my .vbk's.
Veeam, I strongly encourage you to implement built-in encryption, and a real way of incorporating rotating disks. The registry edit for ForceCreateMissingVBK (and the other one) isn't nearly enough... I feel there is a lot of "potential" in the Backup Copy Jobs reusing previous backup chains. I feel like I was trying to push Veeam a little too far. Looking forward to a next version, that's for sure!