Move Tapes Script as Post Script

Everything about backing up to tape

Move Tapes Script as Post Script

Veeam Logoby Aerospace » Wed Mar 16, 2016 7:00 am

Hello,

i have a script which move all Tapes from my Temp Pool in the Free Pool.
But as Post Script this Script does not work, only manuelly.

In the Log the Script was success

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

Re: Move Tapes Script as Post Script

Veeam Logoby PTide » Thu Mar 17, 2016 12:02 pm

Hi,

Please try wrapping a .bat file around your .ps1 script and see if calling .bat instead of .ps1 will do the job.

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

Re: Move Tapes Script as Post Script

Veeam Logoby Aerospace » Thu Mar 17, 2016 1:11 pm

i do this currentlly via batch

Code: Select all
cd /d %~dp0
cls

powershell.exe -Noninteractive -file "Taeglich Temp - Tape in Media Pool Free verschieben.ps1"
Aerospace
Influencer
 
Posts: 11
Liked: 1 time
Joined: Thu Mar 03, 2016 9:18 am
Full Name: Martin Müller

Re: Move Tapes Script as Post Script

Veeam Logoby PTide » Thu Mar 17, 2016 2:13 pm

That looks unexpected - please contact our support team and post your case ID in this thread.

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

Re: Move Tapes Script as Post Script

Veeam Logoby v.Eremin » Mon Mar 21, 2016 12:12 pm

But as Post Script this Script does not work, only manuelly.

Are you positive you were using the same account in both cases? I mean doesn't Veeam service account lack required permissions by any chance? Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Move Tapes Script as Post Script

Veeam Logoby Aerospace » Tue Mar 29, 2016 6:01 am 1 person likes this post

this works fine

1. Change the Backup Job to run a batch file instead of the powershell directly, e.g. "E:\Batches\TestBatchFile.bat"
2. Inside the batch file, use the "start" command to launch the powershell, e.g. Start powershell.exe -Noninteractive -File E:\Batches\TestPowershell.ps1
3. Inside the Powershell, pause the script for 60 seconds e.g. Start-Sleep -s 60
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 4 guests