-
- Expert
- Posts: 117
- Liked: 4 times
- Joined: Mar 03, 2011 1:49 pm
- Full Name: Steven Stirling
- Contact:
Need script to check if a tape job is running please
I'd like to run a script on my main backup jobs, that check to see if a tape job is running, and if so, wait for that to complete. Does anyone know of any that already exists out there?
Thank you!
Thank you!
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Need script to check if a tape job is running please
Hi,
Please check this thread. You'll need to replace Get-VBRJob with Get-VBRTapeJob and $Job.GetLastState() -eq "Working" with $J.LastState -eq "Working"
Thank you.
Please check this thread. You'll need to replace Get-VBRJob with Get-VBRTapeJob and $Job.GetLastState() -eq "Working" with $J.LastState -eq "Working"
Thank you.
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
I didn't have a time to test it, but I think the following script should work fine:
Thanks.
Code: Select all
asnp VeeamPSSnapin
$TapeJob = Get-VBRTapeJob -name "Name of Tape Job"
if ($TapeJob.LastState -ne "Working"){exit}
else
{
do
{
Start-sleep -s 300 #5 minute waiting interval
$TapeJob = Get-VBRTapeJob -name "Name of Tape Job"
}
}while ($TapeJob.LastState -ne "Working")
-
- Expert
- Posts: 117
- Liked: 4 times
- Joined: Mar 03, 2011 1:49 pm
- Full Name: Steven Stirling
- Contact:
Re: Need script to check if a tape job is running please
Thanks. I managed to manually install the powershell plugin, launched it from the top left menu, but there seems to be no get-vbrtapejob command.... do i have an old version? i'm running 8.0.0.2021 but i installed the powershell plugiun from the origional version before the patch.
Just noticed that when i launch the powershell from the left menu, i get a "no snapins have been registered for windows poershell version 4"
Just noticed that when i launch the powershell from the left menu, i get a "no snapins have been registered for windows poershell version 4"
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
What if you try to start a PowerShell outside of backup console and check whether VeeamPSSnapin has been registered successfully, using "Get-PSSnapin" (to be sure run PS as administrator)?
-
- Expert
- Posts: 117
- Liked: 4 times
- Joined: Mar 03, 2011 1:49 pm
- Full Name: Steven Stirling
- Contact:
Re: Need script to check if a tape job is running please
get-pssnapin just gives me the 1, and it's the core one. nothing else.
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
Can you try to re-install snap-in either manually, using Install-VeeamToolkit.ps1 script in "C:\Program Files\Veeam\Backup and Replication", or automatically through general setup wizard and see whether it helps?
-
- Expert
- Posts: 117
- Liked: 4 times
- Joined: Mar 03, 2011 1:49 pm
- Full Name: Steven Stirling
- Contact:
Re: Need script to check if a tape job is running please
Tried both, didn't work The wizard didn't actually get very far because i have jobs running and it told me to disable them.
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
Let's wait till there is a time window without running jobs and re-install snap-in at that time. Thanks.
-
- Veteran
- Posts: 284
- Liked: 11 times
- Joined: Jan 06, 2011 8:33 am
- Contact:
[MERGED] Let the Backup Job wait on an running Tape Job
Hello ,
I need an Script who lets the Backup Job Waits when an Tape Job for this Files is running .
I have at the End of the Month an "big" Tape Job who Backups 30 Hours from Monday Morning at 03.00 . But on Monday Evening at 7 PM the Backup to Disk Job starts and when Merging begins the Backup To Disk Job Ends the Tape Job .
What i want is an Script who lets the backup to Disk Job waits till the "big" Backup to Tape Job is finished . It is ok when on Monday Evening no Backup to Disk Job runs .
Thanks
Michael
I need an Script who lets the Backup Job Waits when an Tape Job for this Files is running .
I have at the End of the Month an "big" Tape Job who Backups 30 Hours from Monday Morning at 03.00 . But on Monday Evening at 7 PM the Backup to Disk Job starts and when Merging begins the Backup To Disk Job Ends the Tape Job .
What i want is an Script who lets the backup to Disk Job waits till the "big" Backup to Tape Job is finished . It is ok when on Monday Evening no Backup to Disk Job runs .
Thanks
Michael
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Need script to check if a tape job is running please
Please check the script Vladimir has provided and feel free to request an assistance.
Thank you.
Thank you.
-
- Veteran
- Posts: 284
- Liked: 11 times
- Joined: Jan 06, 2011 8:33 am
- Contact:
Re: Need script to check if a tape job is running please
Hello again ,
Im totally new on Veeam Scripting . What i need for Scripting from Veeam Side ?
How can i insert an Script in Veeam ?
Vladimir , How can Look the Script when i want to prevent an Backup to Disk Job to start when an Tape Job runs at this Time ?
Thanks for Help .
Michael
Im totally new on Veeam Scripting . What i need for Scripting from Veeam Side ?
How can i insert an Script in Veeam ?
Vladimir , How can Look the Script when i want to prevent an Backup to Disk Job to start when an Tape Job runs at this Time ?
Thanks for Help .
Michael
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Need script to check if a tape job is running please
You need to specify .ps1 file containing the script in Advanced settings of your job so that the script starts before the job.What i need for Scripting from Veeam Side ?
How can i insert an Script in Veeam ?
This part of the script should prevent backup job from starting until tape job is finished:How can Look the Script when i want to prevent an Backup to Disk Job to start when an Tape Job runs at this Time ?
Code: Select all
if ($TapeJob.LastState -ne "Working"){exit}
else
{
do
{
Start-sleep -s 300 #5 minute waiting interval
$TapeJob = Get-VBRTapeJob -name "Name of Tape Job"
}
}while ($TapeJob.LastState -ne "Working")
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
And don't forget to add our PS snap-in in the beginning of the script, so that PowerShell has access to VB&R related commandlets.
Thanks.
Code: Select all
Asnp VeeamPSSnapin
-
- Veteran
- Posts: 284
- Liked: 11 times
- Joined: Jan 06, 2011 8:33 am
- Contact:
Re: Need script to check if a tape job is running please
Should i placed the script in the Tape Job Advanced Settings or in the Backup Job Advanced Settings ?
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Need script to check if a tape job is running please
You should place it in Backup Job Advanced settings
-
- Veteran
- Posts: 284
- Liked: 11 times
- Joined: Jan 06, 2011 8:33 am
- Contact:
Re: Need script to check if a tape job is running please
Thanks i will try it in an Test
-
- Veteran
- Posts: 284
- Liked: 11 times
- Joined: Jan 06, 2011 8:33 am
- Contact:
Re: Need script to check if a tape job is running please
Hello again ,
I become an Warning when the Job now starts :
03.06.2016 15:03:52 :: Error running pre-job script: The specified executable is not a valid application for this OS platform.
This is my Script :
running-monthly-FS-EXCH-SQL.ps1
And in this Script is this :
Asnp VeeamPSSnapin
if ($TapeJob.LastState -ne "Working"){exit}
else
{
do
{
Start-sleep -s 300 #5 minute waiting interval
$TapeJob = Get-VBRTapeJob -name "MONTHLY_FILE_EXCH-SQL-AD"
}
}while ($TapeJob.LastState -ne "Working")
But it dont work . What is wrong ?
Thanks
I become an Warning when the Job now starts :
03.06.2016 15:03:52 :: Error running pre-job script: The specified executable is not a valid application for this OS platform.
This is my Script :
running-monthly-FS-EXCH-SQL.ps1
And in this Script is this :
Asnp VeeamPSSnapin
if ($TapeJob.LastState -ne "Working"){exit}
else
{
do
{
Start-sleep -s 300 #5 minute waiting interval
$TapeJob = Get-VBRTapeJob -name "MONTHLY_FILE_EXCH-SQL-AD"
}
}while ($TapeJob.LastState -ne "Working")
But it dont work . What is wrong ?
Thanks
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
It seems that you're trying to pass a PS script directly as a pre-job command. Thus, the error.
Use something similar instead:
Thanks.
Use something similar instead:
Code: Select all
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe <Path to your script>
-
- Veteran
- Posts: 284
- Liked: 11 times
- Joined: Jan 06, 2011 8:33 am
- Contact:
Re: Need script to check if a tape job is running please
New Problem , The Powershell says that in the "while" loop is an keyword "while" or "until" missin .
Can everyone give me an working Script ? And please so that an powershell beginner can check it .
Thanks
Can everyone give me an working Script ? And please so that an powershell beginner can check it .
Thanks
-
- Product Manager
- Posts: 20406
- Liked: 2299 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Need script to check if a tape job is running please
Try to place while portion inside the first braces and see whether it makes any diffence:
Thanks.
Code: Select all
asnp VeeamPSSnapin
$TapeJob = Get-VBRTapeJob -name "Name of Tape Job"
if ($TapeJob.LastState -ne "Working"){exit}
else
{
do
{
Start-sleep -s 300 #5 minute waiting interval
$TapeJob = Get-VBRTapeJob -name "Name of Tape Job"
}while ($TapeJob.LastState -ne "Working")
}
Who is online
Users browsing this forum: No registered users and 10 guests