Need script to check if a tape job is running please

PowerShell script exchange

Re: Need script to check if a tape job is running please

Veeam Logoby PTide » Thu Jun 02, 2016 11:21 am

You should place it in Backup Job Advanced settings
PTide
Veeam Software
 
Posts: 3019
Liked: 246 times
Joined: Tue May 19, 2015 1:46 pm

Re: Need script to check if a tape job is running please

Veeam Logoby WinstonWolf » Fri Jun 03, 2016 4:21 am

Thanks i will try it in an Test
WinstonWolf
Expert
 
Posts: 181
Liked: 4 times
Joined: Thu Jan 06, 2011 8:33 am

Re: Need script to check if a tape job is running please

Veeam Logoby WinstonWolf » Fri Jun 03, 2016 1:08 pm

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
WinstonWolf
Expert
 
Posts: 181
Liked: 4 times
Joined: Thu Jan 06, 2011 8:33 am

Re: Need script to check if a tape job is running please

Veeam Logoby v.Eremin » Fri Jun 03, 2016 2:02 pm

It seems that you're trying to pass a PS script directly as a pre-job command. Thus, the error.

Use something similar instead:

Code: Select all
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe <Path to your script>


Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Need script to check if a tape job is running please

Veeam Logoby WinstonWolf » Fri Jun 03, 2016 2:49 pm

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
WinstonWolf
Expert
 
Posts: 181
Liked: 4 times
Joined: Thu Jan 06, 2011 8:33 am

Re: Need script to check if a tape job is running please

Veeam Logoby v.Eremin » Fri Jun 03, 2016 2:54 pm

Try to place while portion inside the first braces and see whether it makes any diffence:
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")
    }


Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 8 guests