Scripting

Everything about backing up to tape

Scripting

Veeam Logoby Aerospace » Wed Mar 09, 2016 12:41 pm

Hey Guys,

i need your help on my Script.
I have more MediaPools, because i need each day a Fullbackup with all files, so i move all Tapes befor a backup to an other MediaPool.
Now i need a script which move the Tapes from the temporary mediapool back to the free mediapool, when the Backup was success.

Powershell says always he don't know this parameter "GetLastResult"

Code: Select all
Add-PSSnapin VeeamPSSnapIn

$jobName = "Backup2Tape - Täglich"

if ((Get-VBRJob | where {$_.Name -eq $jobName}).GetLastResult() -eq "Success")
 {
$tape = Get-VBRTapeMedium -MediaPool "Täglich Temp"
Move-VBRTapeMedium -Medium $tape -MediaPool "Free" -Confirm:$false

 }
Aerospace
Influencer
 
Posts: 11
Liked: 1 time
Joined: Thu Mar 03, 2016 9:18 am
Full Name: Martin Müller

Re: Scripting

Veeam Logoby PTide » Wed Mar 09, 2016 3:20 pm

Hi,

Code: Select all
Get-VBRJob | where {$_.Name -eq $jobName}).GetLastResult() -eq "Success")
Will give you nothing. Please use Get-VBRTapeJob instead:

Code: Select all
Get-VBRTapeJob | where {$_.name -eq ""Backup2Tape - Täglich"}
The value you are looking for is stored in the Last.Result field:

Code: Select all
$job = Get-VBRTapeJob | where {$_.Name -eq "Test"}
echo $job.LastResult
Success


Hope this helps.

Thank you.
PTide
Veeam Software
 
Posts: 3019
Liked: 246 times
Joined: Tue May 19, 2015 1:46 pm

Re: Scripting

Veeam Logoby Aerospace » Thu Mar 10, 2016 7:13 am

it work's, thank you very much!

Code: Select all
Add-PSSnapin VeeamPSSnapIn

$jobName = "Backup2Tape - Täglich"

$job = Get-VBRTapeJob | where {$_.Name -eq "$jobName"}

if ($job.LastResult -eq "Success")
 {
$tape = Get-VBRTapeMedium -MediaPool "Täglich Temp"
Move-VBRTapeMedium -Medium $tape -MediaPool "Free" -Confirm:$false
 }
Aerospace
Influencer
 
Posts: 11
Liked: 1 time
Joined: Thu Mar 03, 2016 9:18 am
Full Name: Martin Müller


Return to Tape



Who is online

Users browsing this forum: No registered users and 6 guests