PowerShell script exchange
Post Reply
odruard
Enthusiast
Posts: 40
Liked: 5 times
Joined: Jan 25, 2011 2:12 pm
Full Name: Olivier Druard
Contact:

Health check in Backup Copy job

Post by odruard »

Hello,

In graphical interface, there in an option to configure Health checks in a Backup Copy job.
On Target tab, Advanced button, Backup tab, you'll find Backup files Health check options, with the availability to schedule it monthly or weekly.

I don't find how to configure this option through powershell. I found all other options I need, but not this one.

Any idea ?

Thanks for your help.
Olivier
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Health check in Backup Copy job

Post by veremin »

Hi Olivier,

I don't have a console at hand, so, can't tell what method you should use. But it stands to reason to assign all job options to a variable, and try to find which particular setting corresponds to the health check. Get-Member commandlet might be helpful in this case.

Thanks.
edfops
Enthusiast
Posts: 37
Liked: 6 times
Joined: Feb 13, 2014 8:17 pm

Re: Health check in Backup Copy job

Post by edfops »

I've been looking for this as well, at the moment not sure it exists. The "EnableIntegrityChecks" option does not include the "Health Check" for Backup Copy Jobs.
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Health check in Backup Copy job

Post by veremin »

Hmmm, ok. I will try to look into that, once I have an access to a backup console. Thanks.
odruard
Enthusiast
Posts: 40
Liked: 5 times
Joined: Jan 25, 2011 2:12 pm
Full Name: Olivier Druard
Contact:

Re: Health check in Backup Copy job

Post by odruard »

v.Eremin wrote:But it stands to reason to assign all job options to a variable, and try to find which particular setting corresponds to the health check. Get-Member commandlet might be helpful in this case.
Hello Eremin

That's what I did before opening this topic, but I didn't find the correct information.
I found all other options using get-member on options. I even checked options which have themselves several members, without success.
Maybe it is not in Options. For Backup jobs, some elements are managed through AdvancedOptions, but I didn't find equivalent for Copy jobs.

Olivier.
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Health check in Backup Copy job

Post by veremin »

Can't recall the particular name, but have you checked something like options.root? Some of the peculiar options are located there. Thanks.
odruard
Enthusiast
Posts: 40
Liked: 5 times
Joined: Jan 25, 2011 2:12 pm
Full Name: Olivier Druard
Contact:

Re: Health check in Backup Copy job

Post by odruard »

v.Eremin wrote:have you checked something like options.root?
I don't know such property name. .options.root return nothing.
I performed a get-member on objet, its member and its sub-member, whithout finding the right information.

Olivier
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Health check in Backup Copy job

Post by veremin »

If you assign job options to a variable, say, $options, it will have a number of different options inside like $options.backuptargetoptions and so on. As far as I remember, there should be something like $options.options.root or similar. Some interesting properties might be found there sometimes. I will say for sure, when I'm back from the TechED, though. Thanks.
edfops
Enthusiast
Posts: 37
Liked: 6 times
Joined: Feb 13, 2014 8:17 pm

Re: Health check in Backup Copy job

Post by edfops »

v.Eremin wrote:If you assign job options to a variable, say, $options, it will have a number of different options inside like $options.backuptargetoptions and so on. As far as I remember, there should be something like $options.options.root or similar. Some interesting properties might be found there sometimes. I will say for sure, when I'm back from the TechED, though. Thanks.
This should do the trick.

Code: Select all

$options = New-VBRJobOptions
$options.GenerationPolicy.EnableRechek   = $false
$job = Get-VBRJob -name "job name"
Set-VBRJobOptions -Job $job -Options $options
edfops
Enthusiast
Posts: 37
Liked: 6 times
Joined: Feb 13, 2014 8:17 pm

Re: Health check in Backup Copy job

Post by edfops »

odruard wrote: I don't know such property name. .options.root return nothing.
I performed a get-member on objet, its member and its sub-member, whithout finding the right information.

Olivier
Let me know if this works for you.

Code: Select all

$options = New-VBRJobOptions
$options.GenerationPolicy.EnableRechek   = $false
$job = Get-VBRJob -name "job name"
Set-VBRJobOptions -Job $job -Options $options
edfops
Enthusiast
Posts: 37
Liked: 6 times
Joined: Feb 13, 2014 8:17 pm

Re: Health check in Backup Copy job

Post by edfops »

edfops wrote: Let me know if this works for you.

Code: Select all

$options = New-VBRJobOptions
$options.GenerationPolicy.EnableRechek   = $false
$job = Get-VBRJob -name "job name"
Set-VBRJobOptions -Job $job -Options $options
And this is why we always thoroughly test our scripts. This will work a bit better, as the above will end up setting a job back to default settings, except for the one it changes.

The below sets $options as all of the current settings in the job, and then sets the one option we want. Makes it a bit safer to run against a bunch of jobs!

Code: Select all

$job = Get-VBRJob -name "job" 
$options = Get-VBRJobOptions -Job $job
$options.GenerationPolicy.EnableRechek   = $false
Set-VBRJobOptions -Job $job -Options $options
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Health check in Backup Copy job

Post by veremin »

edfops wrote:And this is why we always thoroughly test our scripts. This will work a bit better, as the above will end up setting a job back to default settings, except for the one it changes.
Yes, New-VBRJobOptions creates a template for job options. Thus, the scrips sets all parameters (except the one that is changed within the script) to their default values. The right approach is to get options, assign to a variable, change required parameter(s) and set the changed options.

Anyway, glad to hear that you've nailed it.

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests