Get Backup/Replica Job Options

PowerShell script exchange

Get Backup/Replica Job Options

Veeam Logoby shaun2011 » Thu Aug 08, 2013 11:31 am

hi

wanted to know if there's a simple way to get a list of options like below? one liner would be handy, when you are working with multiple proxy and repositories to make sure the are evenly used.

i saw scripts to set options, not for reporting ...

thanks.

jobname
included vm's
source / dest proxy
meta data repository
backup repository
shaun2011
Influencer
 
Posts: 19
Liked: 1 time
Joined: Sat Nov 12, 2011 11:43 am

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Thu Aug 08, 2013 12:25 pm 1 person likes this post

In case of replication jobs, the following one-liner should answer your requirements:

Code: Select all
asnp VeeamPSSnapin
Get-VBRJob | ? {$_.jobtype -eq "Replica"} | Select-Object -Property @{N="Job Name";E={$_.name}}, @{N="VMs";E={$_.GetViOijs().name}}, @{N="Source Proxies";E={$_.GetSourceViProxies().name}}, @{N="Target proxies"; E={$_.GetTargetViProxies().name}}, @{N="Target repository"; E={$_.GetTargetRepository().name}} | Format-Table


In case of backup jobs, just delete the part about target proxies:

Code: Select all
asnp VeeamPSSnapin
Get-VBRJob | ? {$_.jobtype -eq "Backup"} | Select-Object -Property @{N="Job Name";E={$_.name}}, @{N="VMs";E={$_.GetViOijs().name}}, @{N="Source Proxies";E={$_.GetSourceViProxies().name}}, @{N="Target repository"; E={$_.GetTargetRepository().name}} | Format-Table


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

Re: Get Backup/Replica Job Options

Veeam Logoby shaun2011 » Thu Aug 08, 2013 1:00 pm

excellent .. thanks Vladimir.
how can i get a list of objects to display? to add more items later on, so i can periodically audit settings.
cheers,
shaun2011
Influencer
 
Posts: 19
Liked: 1 time
Joined: Sat Nov 12, 2011 11:43 am

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Thu Aug 08, 2013 1:02 pm

Can I ask you to specify what particular objects you’re willing to output? Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Thu Aug 08, 2013 1:13 pm 1 person likes this post

Oh, you mean the list of other job options that can be displayed, as well, right?

If so, you use a method called Get-Member that will provide corresponding information regarding required object. The principle is illustrated below:

Code: Select all
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of Backup Job"
$Job | Get-Member


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

Re: Get Backup/Replica Job Options

Veeam Logoby shaun2011 » Thu Aug 08, 2013 2:07 pm

yes, that's what i meant. could not find restore points and replica metadata repository?
shaun2011
Influencer
 
Posts: 19
Liked: 1 time
Joined: Sat Nov 12, 2011 11:43 am

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Thu Aug 08, 2013 3:07 pm 1 person likes this post

could not find restore points

Actually, “target repository” field in the script I’ve already provided has the information regarding repository where replica metadata is stored. However, if you’re willing to get it by its own, then use the following commands:

Code: Select all
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of Replication Job"
$Job.FindTargetRepository()


Meanwhile, information regarding restore points (VMware snapshots, in other words) should be available through the PowerCLI. All you need to do is to check how many snapshots a given VM has. In fact, it's a pretty similar task that has been recently described here; so, kindly take a look.

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

Re: Get Backup/Replica Job Options

Veeam Logoby shaun2011 » Fri Aug 09, 2013 1:43 pm

thanks, powercli worked out ok.
what is the property for destination datastore for replica?
played around with adding more to above code, what's the syntax to display properties like "ScheduleOptions" / "VSSoptions"?
cheers,
shaun2011
Influencer
 
Posts: 19
Liked: 1 time
Joined: Sat Nov 12, 2011 11:43 am

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Fri Aug 09, 2013 2:36 pm 1 person likes this post

If you execute the piece of code mentioned in previous post, you will be able to see what particular options target repository has. Moreover, get-member cmdlet can be used here, as well:

Code: Select all
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of replication Job"
$Job.FindTargetRepository() | Get-Member 


"ScheduleOptions" / "VSSoptions"?

Both can be displayed via the following script:

Code: Select all
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your replication Job"
$Job.ScheduleOptions
$Job.VssOptions


Additionally, if you need to list them among other properties in the table, kindly add a few lines to the original code:

Code: Select all
@{N="Schedule Options";E={$_.ScheduleOptions}}, @{N="VSS Options";E={$_.VssOptions}}


Though, please be aware that either of these options contains many fields, so, you might want to consider outputting only part of it (such as, LatestRun, NextRun, etc.), so that, the corresponding table still preserves readable state.

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

Re: Get Backup/Replica Job Options

Veeam Logoby shaun2011 » Sat Aug 10, 2013 5:52 pm

trying to figure out correct syntax,

$Job = Get-VBRJob -name "Name of Backup Job"
$Job | Get-Member

after getting the objects, then

@{N="xxxx";E={$_.xxxxx}}

is there documentation on how to format the correct syntax, i see it's not the same for all objects?

thanks.
shaun2011
Influencer
 
Posts: 19
Liked: 1 time
Joined: Sat Nov 12, 2011 11:43 am

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Mon Aug 12, 2013 1:22 pm 1 person likes this post

i see it's not the same for all objects?

Yep, you’re right.

However, it’s expected since we’re talking here about calculated properties that are not built-in properties of the object but rather the calculated ones. And different properties are calculated in different ways.

From my perspective, the following articles might be helpful:

Select-Object
Calculated properties

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

Re: Get Backup/Replica Job Options

Veeam Logoby shaun2011 » Mon Aug 12, 2013 5:24 pm

thanks, bit advanced but have to use more often i guess.

btw any other methods to audit job settings - veeamone or ent manager? would be handy if you are dealing with larger number of jobs, more than one admin.
shaun2011
Influencer
 
Posts: 19
Liked: 1 time
Joined: Sat Nov 12, 2011 11:43 am

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Tue Aug 13, 2013 9:20 am 1 person likes this post

Yes, it’s possible to change the settings of backup/replication jobs through EM Web console. Nevertheless, you should think about VeeamOne as a monitoring/alarming solution and not as a management one, since, instead of management functionality, it provides you with a number of alarms and monitoring data through which you can analyze state of your virtual and backup infrastructure.

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

Re: Get Backup/Replica Job Options

Veeam Logoby v.Eremin » Tue Aug 13, 2013 1:50 pm

Could not find restore points and replica metadata repository?

Additionally, please be aware the required information regarding replica restore points can be also gotten, using Get-VBRReplica commandlet.

All restore points:

Code: Select all
asnp VeeamPSSnapin
$Replica = Get-VBRReplica -name "Name of replication Job "
$Replica.GetPoints()


The latest one:

Code: Select all
asnp VeeamPSSnapin
$Replica = Get-VBRReplica -name "Name of replication Job"
$Replica.GetLastPoint()


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


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests