Discussions related to exporting backups to tape and backing up directly to tape.
Post Reply
Aerospace
Influencer
Posts: 11
Liked: 1 time
Joined: Mar 03, 2016 9:18 am
Full Name: Martin Müller
Contact:

Scripting

Post by Aerospace »

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

 }
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Scripting

Post by PTide »

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.
Aerospace
Influencer
Posts: 11
Liked: 1 time
Joined: Mar 03, 2016 9:18 am
Full Name: Martin Müller
Contact:

Re: Scripting

Post by Aerospace »

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
 }
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests