backup naming when using reversed incremental

PowerShell script exchange

Re: backup naming when using reversed incremental

Veeam Logoby McClane » Mon Jul 02, 2012 6:27 pm 1 person likes this post

If backup target is a local disk, I do this to get a consistent vkb filename after every backup job:
Code: Select all
if ((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null) {
   Add-PsSnapin VeeamPSSnapIn
}

$veeamJobName = "TaeglicheSicherung"
$jobFilename = "TaeglicheSicherung.vbk"

$BackupPath = "e:\VeeamBackups\TaeglicheSicherung"


if ((Get-VBRJob | ?{$_.Name -eq $veeamJobName}).GetLastResult() ) {
   $latestOib = Get-VBRBackup | ?{$_.JobName -eq $veeamJobName} | Get-VBRRestorePoint | Sort CreationTime -Descending | Select -First 1
   $latestOib
   $storage = $latestOib.GetStorage()
   $file = $storage.FileName

   & del $BackupPath\$jobFilename
   & cmd /c "mklink /H $BackupPath\$jobFilename $BackupPath\$file"
   
}


And for a backup target on a linux smb share I do that:

Code: Select all
if ((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null) {
   Add-PsSnapin VeeamPSSnapIn
}

$veeamJobName = "Taegliche_Sicherung"
$jobFilename = "Taegliche_Sicherung.vbk"

$toolPath = "c:\bktools"
$nasPath = "/share/backup"
$puttySession = "nas02"
$user = "admin"
$pw = "Passwort"


if ((Get-VBRJob | ?{$_.Name -eq $veeamJobName}).GetLastResult() -eq "Success") {
   $latestOib = Get-VBRBackup | ?{$_.JobName -eq $veeamJobName} | Get-VBRRestorePoint | Sort CreationTime -Descending | Select -First 1
   $latestOib
   $storage = $latestOib.GetStorage()
   $file = $storage.FileName

    & $toolPath\plink.exe "$puttySession" -pw "$pw" -l "$user" "rm $nasPath/$jobFilename;ln -s $nasPath/$file $nasPath/$jobFilename"
   
}
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest