PowerShell script exchange
Post Reply
jed-hyper
Enthusiast
Posts: 39
Liked: 4 times
Joined: Feb 26, 2014 4:42 am
Full Name: Jed Parkes
Contact:

SetOptions broken in Update3

Post by jed-hyper »

I've just updated to Update3 (9.5.0.1536)
Since installing the update SetOptions no longer works.

When i run this code

Code: Select all

$Job = Get-VBRJob -Name 'BackupJob'
$Options = $Job.GetOptions()
$Options.BackupStorageOptions.RetainCycles = '50'
$Job.SetOptions($Options)
i get this error
Cannot find an overload for "SetOptions" and the argument count: "1".
Any idea how to fix this ?
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: SetOptions broken in Update3

Post by tsightler » 3 people like this post

Probably the best way is to switch from calling the object methods directly to using the cmdlets. Back in the day, there weren't proper cmdlets for this, but they've been available for quite a while now, and using the cmdlets will almost always be more compatible across version than calling the object methods directly, since object methods can potentially change any time, even between updates. The following code should work from at least v7 all the way through 9.5U3 without any changes:

Code: Select all

$Job = Get-VBRJob -Name 'BackupJob'
$Options = Get-VBRJobOptions $Job
$Options.BackupStorageOptions.RetainCycles = '50'
Set-VBRJobOptions $Job $Options
jed-hyper
Enthusiast
Posts: 39
Liked: 4 times
Joined: Feb 26, 2014 4:42 am
Full Name: Jed Parkes
Contact:

Re: SetOptions broken in Update3

Post by jed-hyper »

That fixed it, thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests