V8 Get-VBRTapeJob changed

PowerShell script exchange

Re: V8 Get-VBRTapeJob changed

Veeam Logoby pdef » Fri Mar 13, 2015 3:06 pm

Veeam BR 8 with Patch 1 installed.

Code: Select all
Get-VBRTapeJob | ? {$_.GetLastState() -like "WaitingTape"} | Stop-VBRJob


Still does not working..

Code: Select all
Get-VBRTapeJob : Value cannot be null.
Parameter name: name
At line:1 char:1
+ Get-VBRTapeJob | ? {$_.GetLastState() -like "WaitingTape"} | Stop-VBRJob
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VBRTapeJob], ArgumentNullException
    + FullyQualifiedErrorId : System.ArgumentNullException,Veeam.Backup.PowerShell.Cmdlets.GetVBRTapeJob


Does anybody know how to Stop WaitingTape Jobs with Script?
pdef
Novice
 
Posts: 4
Liked: never
Joined: Tue Sep 30, 2014 6:27 am

Re: V8 Get-VBRTapeJob changed

Veeam Logoby smarechal » Tue Jan 05, 2016 12:37 pm 1 person likes this post

Hi,

Maybe i'm too late:

Code: Select all
Get-VBRTapeJob | Where-Object {$_.LastState -like "WaitingTape"} | Stop-VBRJob
smarechal
Enthusiast
 
Posts: 56
Liked: 11 times
Joined: Mon Dec 21, 2015 1:23 pm
Full Name: Siegfried

Re: V8 Get-VBRTapeJob changed

Veeam Logoby tdewin » Wed Jan 06, 2016 9:53 am

Seems like the pipeline is not returning anything (meaning no job is waiting). A safer way is to handle this whit foreach. Btw in v9 there seems to be no such function but there seems to be a field called "LastState"
Code: Select all
Get-VBRTapeJob | ? {$_.LastState -like "WaitingTape"} | % { $_ | Stop-VBRJob }
tdewin
Veeam Software
 
Posts: 1046
Liked: 361 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: V8 Get-VBRTapeJob changed

Veeam Logoby v.Eremin » Fri Jan 08, 2016 9:45 am

Maybe i'm too late

It's never too late to write a script. :)

And the one proposed by you should work fine, indeed, since starting from version 8 LastState is a static property, not a dynamic method, as it used to be previously.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 969 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 9 guests