PowerShell script exchange
Post Reply
hgrams
Service Provider
Posts: 78
Liked: 10 times
Joined: Jan 27, 2014 4:28 pm
Full Name: Harald Grams
Contact:

How can determine Tape Waiting jobs with Veeam 8

Post by hgrams »

Hi, at a given point in time I check the environment, if there are still running Copy-To-Tape jobs, e.g. because no tape was inserted. In Veeam 7, I do it on this way:

Code: Select all

Get-VBRTapeJob | ? {$_.GetLastState() -like "WaitingTape"}


With Veeam 8, it doesn't work anymore. Neither the property "GetLastState" seems to be existing nor another property hold such information. How can I do that with Veeam 8?
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

Just out of curiosity - doesn't the mail notification for this situation added in first patch remove the need of using PS code? Thanks.
hgrams
Service Provider
Posts: 78
Liked: 10 times
Joined: Jan 27, 2014 4:28 pm
Full Name: Harald Grams
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by hgrams »

This is not the wanted situation. I don't need a notification. The customer should insert a tape in the evening. After that time nobody is there to react on a notification. Next day at 09a.m. should run a script to determine if any active Copy-to-tape jobs are still running. If yes, abort them.

How can I do this with Veeam 8?
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

Something like this should answer your requirements:

Code: Select all

Get-VBRTapeJob | where {$_.LastState -eq "WaitingTape"}
As LastState is static parameter (not method), some sort of loop might be needed to actualize data.

Thanks.
hgrams
Service Provider
Posts: 78
Liked: 10 times
Joined: Jan 27, 2014 4:28 pm
Full Name: Harald Grams
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by hgrams »

Hi Vladimir

At the moment I have 2 running jobs. The Job "Last-VBK-Files Tu - Fr" has the status "WaitingTape" in the Veeam Console.
When I check tho job via PS, then I get this:

Code: Select all

PS C:\Users\Administrator.HA-HO> $TapeJob = Get-VBRTapeJob -name "Last-VBK-Files Tu - Fr"
PS C:\Users\Administrator.HA-HO> $TapeJob


FullBackupPolicy           : Daily
IncrementalBackupPolicy    : Daily
Object                     : {D:\Copy2Tape-Links}
UseVss                     : False
EjectCurrentMedium         : False
ExportCurrentMediaSet      : False
ExportDays                 : {Sunday, Monday, Tuesday, Wednesday...}
FullBackupMediaPool        : Day
IncrementalBackupMediaPool : Day
UseHardwareCompression     : False
NextRun                    :
Target                     : Day
Type                       : FileToTape
LastResult                 : Success
LastState                  : Stopped
Id                         : 765d97c3-d7c1-4eeb-bfe1-cca34ee5edaa
Name                       : Last-VBK-Files Tu - Fr
Description                : Copy last Veeam Full-Backup-Files to tape (Tuesday to Friday)
"LastState" reports "Stopped". Where stores Veeam the status "WaitingTape", which is diplayed in Veeam console?
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

Hmm, looks like a bug. I've notified dev.team about that already. For now you can use the following workaround:

Code: Select all

$Job = Get-VBRTapeJob -name "Last-VBK-Files Tu - Fr"
[Veeam.Backup.Core.CBackupJob]::GetLastState($Job.id)
Thanks.
hgrams
Service Provider
Posts: 78
Liked: 10 times
Joined: Jan 27, 2014 4:28 pm
Full Name: Harald Grams
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by hgrams »

Thanks, that works :-)
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

You're welcome. Feel free to reach us, if additional clarification is needed. Thanks.
bartvdw
Novice
Posts: 3
Liked: never
Joined: Feb 09, 2013 12:31 pm
Full Name: Bart Van den Wyngaert
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by bartvdw »

It seems this is still the case after Patch 1 , any news from Dev ?

Thanks
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

Patch#1 had been released before we found that bug. If everything goes as expected, it should be addressed in Update 2.

Anyway, feel free to use the provided workaround.

Thanks.
bartvdw
Novice
Posts: 3
Liked: never
Joined: Feb 09, 2013 12:31 pm
Full Name: Bart Van den Wyngaert
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by bartvdw »

Thanks for the feedback! Is there an ETA on Patch 2 ? (just asking)
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

Yep, it's expected to be released by the end of this month.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

Just to let you know. Update 2 is now generally available. Both laststate and lastresult parameters should reflect correct values now. Thanks.
hgrams
Service Provider
Posts: 78
Liked: 10 times
Joined: Jan 27, 2014 4:28 pm
Full Name: Harald Grams
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by hgrams »

I tested it with Update 2, it works like expected :D
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can determine Tape Waiting jobs with Veeam 8

Post by veremin »

You're right both lastresult and laststate parameters are now reflecting proper values. Thank you for confirming that; appreciated.
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests