Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Remoting must be enabled on the BackupExec Server
- # And user must have access to complete task on Veeam and BE
- if ((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null) {
- Add-PsSnapin VeeamPSSnapIn
- }
- $veeamJobName = "Main Nightly Backup"
- $backupExecJob = "BU Job Name"
- $backupExecSvr = "BackupExec01"
- $backupExecPath = "C:\Program Files\Symantec\Backup Exec"
- 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()
- $storage.FilePath
- $file = Get-Item $storage.FilePath
- if ($file.Attributes -band ([System.IO.FileAttributes]::Archive)) {
- Invoke-Command -ComputerName $backupExecSvr -ScriptBlock {
- param (
- [PSObject]$storage,
- [PsObject]$file,
- [String]$backupExecJob,
- [String]$backupExecPath
- )
- & "$backupExecPath\bemcmd.exe" -o2 -j:$backupExecJob -s:$storage.FilePath -m Tapes-Weekdays -r -w
- $file.Attributes = 'Archive'
- } -ArgumentList $storage, $file, $backupExecJob, $backupExecPath
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement