PowerShell script exchange
Post Reply
shaun2011
Influencer
Posts: 19
Liked: 1 time
Joined: Nov 12, 2011 11:43 am
Contact:

Get Backup/Replica Job Options

Post by shaun2011 »

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
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin » 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.
shaun2011
Influencer
Posts: 19
Liked: 1 time
Joined: Nov 12, 2011 11:43 am
Contact:

Re: Get Backup/Replica Job Options

Post by shaun2011 »

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,
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin »

Can I ask you to specify what particular objects you’re willing to output? Thanks.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin » 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.
shaun2011
Influencer
Posts: 19
Liked: 1 time
Joined: Nov 12, 2011 11:43 am
Contact:

Re: Get Backup/Replica Job Options

Post by shaun2011 »

yes, that's what i meant. could not find restore points and replica metadata repository?
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin » 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.
shaun2011
Influencer
Posts: 19
Liked: 1 time
Joined: Nov 12, 2011 11:43 am
Contact:

Re: Get Backup/Replica Job Options

Post by shaun2011 »

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,
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin » 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.
shaun2011
Influencer
Posts: 19
Liked: 1 time
Joined: Nov 12, 2011 11:43 am
Contact:

Re: Get Backup/Replica Job Options

Post by shaun2011 »

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.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin » 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.
shaun2011
Influencer
Posts: 19
Liked: 1 time
Joined: Nov 12, 2011 11:43 am
Contact:

Re: Get Backup/Replica Job Options

Post by shaun2011 »

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.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin » 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.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Backup/Replica Job Options

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests