How to list all JobOption parameter/options?

PowerShell script exchange

How to list all JobOption parameter/options?

Veeam Logoby Andreas Neufert » Thu Apr 05, 2012 11:07 am 1 person likes this post

Hi,

just tried to figure out how to display all job options.
Code
Code: Select all
 
$CreateJobName = "1"
$job_a = Get-VBRJob | where {$_.Name -eq $CreateJobName}
$schedule = $job_a |Get-VBRjobscheduleoptions
write-host $schedule


worked fine and produce a readable output.
Code: Select all
Veeam.Backup.Model.CJobOptions
Start time: [05.04.2012 09:07:01], Latest run time: [05.04.2012 09:02:01], Next run time: [], Retry times on failure: [3], Retry timeout: [10 min], Daily options: [Enabled: True, DayNumberInMonth: Everyday, Days: Sun
day, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]Monthly options: [Enabled: False, Time: 05.04.2012 22:00:00, Day Number In Month: Fourth, Day Of Week: Saturday, Months: January, February, March, April, Ma
y, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleString: <scheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Mond
ay>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Tuesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Ena
bled: False]


But if I try to do the same with get-joboptions
Code: Select all
$CreateJobName = "1"
$job_a = Get-VBRJob | where {$_.Name -eq $CreateJobName}
$schedule = $job_a |Get-VBRjoboptions
write-host $schedule


the output only is only
Code: Select all
Veeam.Backup.Model.CJobOptions


I tried also
Code: Select all
$CreateJobName = "1"
$job_a = Get-VBRJob | where {$_.Name -eq $CreateJobName}
$job_a.getoptions |gm


Output here is:
Code: Select all

   TypeName: System.Management.Automation.PSMethod

Name                MemberType Definition                                                                                                                                                         
----                ---------- ----------                                                                                                                                                         
Copy                Method     System.Management.Automation.PSMemberInfo Copy()                                                                                                                   
Equals              Method     bool Equals(System.Object obj)                                                                                                                                     
GetHashCode         Method     int GetHashCode()                                                                                                                                                   
GetType             Method     type GetType()                                                                                                                                                     
Invoke              Method     System.Object Invoke(Params System.Object[] arguments)                                                                                                             
ToString            Method     string ToString()                                                                                                                                                   
IsInstance          Property   System.Boolean IsInstance {get;}                                                                                                                                   
MemberType          Property   System.Management.Automation.PSMemberTypes MemberType {get;}                                                                                                       
Name                Property   System.String Name {get;}                                                                                                                                           
OverloadDefinitions Property   System.Collections.ObjectModel.Collection`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] OverloadDefinitions {get;}
TypeNameOfValue     Property   System.String TypeNameOfValue {get;}                                                                                                                               
Value               Property   System.Object Value {get;set;}



I also tried also:
Code: Select all
Get-VBRJob|%{Export-VBRJob -Jobs $_ -FileName "e:\scripts\$($_.name).xml" -IncludeObjects}


but there is still a bug at Export-VBRJob


Any idea how I can display such parameters and options?
Example: backup mode (Reverse Incremental/Incremental)
Andreas Neufert
Veeam Software
 
Posts: 2200
Liked: 358 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: Who to list all JobOption parameter/options?

Veeam Logoby foggy » Thu Apr 05, 2012 12:10 pm

Though I'm a complete dummy in Powershell, but I've got some feedback from devs. Hope this helps.

Andreas Neufert wrote:Any idea how I can display such parameters and options?

Objects formatting (and display) is described in *.format.ps1 xml files (and you can redefine it).
foggy
Veeam Software
 
Posts: 14728
Liked: 1077 times
Joined: Mon Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson

Re: Who to list all JobOption parameter/options?

Veeam Logoby Andreas Neufert » Thu Apr 05, 2012 12:28 pm

Hi foggy,

thanks for the reply.
There are only one such file.
Veeam.Backup.PowerShell.format.ps1xml

The entries aren´t helpful.

Any othe idea?
Andreas Neufert
Veeam Software
 
Posts: 2200
Liked: 358 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: How to list all JobOption parameter/options?

Veeam Logoby Sethbartlett » Thu Apr 05, 2012 12:59 pm

Why not do the following:

Code: Select all
$Job = Get-VBRJob -name "Jobname"
$Options = $Job.GetOptions()


And then you can set other jobs to those options.

Code: Select all
$Job2 = Get-VBRJob -name "Job Name"
$Job2.SetOptions($Options)


This would allow you to make $Options a template for all jobs.

CJobOptions is an object that contains many other objects/classes. If you type just $Options in powershell you will see this:

Code: Select all
Options                 : Veeam.Backup.Common.CDomContainer
HvReplicaTargetOptions  : Veeam.Backup.Model.CDomHvReplicaTargetOptions
ReIPRulesOptions        :
BackupStorageOptions    : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions     : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions         : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions              : Veeam.Backup.Model.CDomJobOptions
ViNetworkMappingOptions : Veeam.Backup.Model.CDomViNetworkMappingOptions
HvNetworkMappingOptions : Veeam.Backup.Model.CDomHvNetworkMappingOptions
NotificationOptions     : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand          : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions  : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions         : Veeam.Backup.Model.CDomViSourceOptions


You can drill into each of these by doing $Options.ViSourceOptions and so forth.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: How to list all JobOption parameter/options?

Veeam Logoby tsightler » Thu Apr 05, 2012 1:20 pm

BTW, watch out for misspellings. All of the options for setting Synthetic job options are misspelled "Syntethic", for example:
Code: Select all
$JobOptions.BackupTargetOptions.TransformFullToSyntethic = $true
$JobOptions.BackupTargetOptions.TransformIncrementsToSyntethic = $false
$JobOptions.BackupTargetOptions.TransformToSyntethicDays = "Friday"
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: How to list all JobOption parameter/options?

Veeam Logoby Andreas Neufert » Thu Apr 05, 2012 2:18 pm

Thank you Tom and Seth I will check this out.

In the meantime we startet to implement example jobs with the confguration we want at other jobs and instead of creating a new job we clone/export/import that example jobs.
Worked so far.
Andreas Neufert
Veeam Software
 
Posts: 2200
Liked: 358 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: How to list all JobOption parameter/options?

Veeam Logoby Andreas Neufert » Thu Apr 05, 2012 3:54 pm

Thank you all. That helped much.
My main problem was that I use write-host to display the options.

What I basically searched for was the following:

Command show all options:
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$JobName = "Rep001-002-auto-Win2008-XX"
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $JobName}
$Options = $JobnameObject.GetOptions()
#write-host $options <= Doesn´t work


$Options
write-host "Options"
$Options.Options
write-host "Options.RootNode"
$Options.Options.RootNode
write-host "Options.RootNode.PostJobCommand"
$Options.Options.RootNode.PostJobCommand
write-host "HvReplicaTargetOptions"
$Options.HvReplicaTargetOptions
write-host "ReIPRulesOptions"
$Options.ReIPRulesOptions
write-host "BackupStorageOptions"
$Options.BackupStorageOptions
write-host "BackupTargetOptions"
$Options.BackupTargetOptions
write-host "BackupTargetOptions.FullBackupMonthlyScheduleOptions"
$Options.BackupTargetOptions.FullBackupMonthlyScheduleOptions
write-host "HvSourceOptions"
$Options.HvSourceOptions
write-host "JobOptions"
$Options.JobOptions
write-host "ViNetworkMappingOptions"
$Options.ViNetworkMappingOptions
write-host "HvNetworkMappingOptions"
$Options.HvNetworkMappingOptions
write-host "NotificationOptions"
$Options.NotificationOptions
write-host "PostJobCommand"
$Options.PostJobCommand
write-host "PostJobCommand.PostCommand"
$Options.PostJobCommand.PostCommand
write-host "ViReplicaTargetOptions"
$Options.ViReplicaTargetOptions
write-host "$Options.ViSourceOptions"
$Options.ViSourceOptions


Output example:
Code: Select all
Options                 : Veeam.Backup.Common.CDomContainer
HvReplicaTargetOptions  : Veeam.Backup.Model.CDomHvReplicaTargetOptions
ReIPRulesOptions        :
BackupStorageOptions    : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions     : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions         : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions              : Veeam.Backup.Model.CDomJobOptions
ViNetworkMappingOptions : Veeam.Backup.Model.CDomViNetworkMappingOptions
HvNetworkMappingOptions : Veeam.Backup.Model.CDomHvNetworkMappingOptions
NotificationOptions     : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand          : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions  : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions         : Veeam.Backup.Model.CDomViSourceOptions

Options
RootNode : JobOptionsRoot

Options.RootNode
RetainCycles                     : 99
SourceProxyAutoDetect            : False
StgBlockSize                     : KbBlockSize1024
EnableDeduplication              : True
CompressionLevel                 : 6
EmailNotification                : False
EmailNotificationAddresses       :
SnmpNotification                 : False
EnableIntegrityChecks            : True
PostJobCommand                   : PostJobCommand
VMToolsQuiesce                   : False
UseChangeTracking                : True
EnableChangeTracking             : True
EnableFullBackup                 : False
FullBackupScheduleKind           : Daily
FullBackupMonthlyScheduleOptions : FullBackupMonthlyScheduleOptions
CheckRetention                   : True
RetainDays                       : 14
BackupIsAttached                 : False
EnableDoubleSnapshot             : False
DoubleSnapshotThresholdMb        : 100
SetResultsToVmNotes              : False
VmAttributeName                  : Notes
ExcludeSwapFile                  : True
RunManually                      : True
Templates                        : False
TemplatesOnce                    : True
Algorithm                        : Increment
TransformFullToSyntethic         : True
TransformIncrementsToSyntethic   : False
FullBackupDays                   : FullBackupDays
TransformToSyntethicDays         : TransformToSyntethicDays
ReIPRules                        :

Options.RootNode.PostJobCommand
Periodicity : Cycles
Enabled     : False
CommandLine :
Frequency   : 1
Days        : Days

HvReplicaTargetOptions
EnableInitialPass : False
InitialPassDir    :
ReplicaNameSuffix :
TargetFolder      : c:\replicas
UseReIP           : False
UseNetworkMapping : False
InitialSeeding    : False
UseVmMapping      : False

ReIPRulesOptions
Rules : {}

BackupStorageOptions
CheckRetention        : True
RetainCycles          : 99
RetainDays            : 14
CompressionLevel      : 6
EnableDeduplication   : True
StgBlockSize          : KbBlockSize1024
EnableIntegrityChecks : True
EnableFullBackup      : False
BackupIsAttached      : False

BackupTargetOptions
Algorithm                        : Increment
FullBackupScheduleKind           : Daily
FullBackupDays                   : {Saturday}
FullBackupMonthlyScheduleOptions : Veeam.Backup.Model.CDomFullBackupMonthlyScheduleOptions
TransformFullToSyntethic         : True
TransformIncrementsToSyntethic   : False
TransformToSyntethicDays         : {Saturday}

BackupTargetOptions.FullBackupMonthlyScheduleOptions
DayOfWeek        : Monday
DayNumberInMonth : First
Months           : {January, February, March, April...}

HvSourceOptions
UseChangeTracking      : True
CanDoCrashConsistent   : True
OffHostBackup          : True
FailoverToOnHostBackup : True
ExcludeSwapFile        : True

JobOptions
SourceProxyAutoDetect : False
TargetProxyAutoDetect : True
RunManually           : True

ViNetworkMappingOptions
NetworkMapping : {}

HvNetworkMappingOptions
NetworkMapping : {}

NotificationOptions
SnmpNotification           : False
EmailNotification          : False
EmailNotificationAddresses :

PostJobCommand
PostCommand : Veeam.Backup.Model.CCustomCommand
Periodicity : Cycles
Enabled     : False
CommandLine :
Frequency   : 1
Days        : {Saturday}

PostJobCommand.PostCommand
Periodicity : Cycles
Enabled     : False
CommandLine :
Frequency   : 1
Days        : {Saturday}

ViReplicaTargetOptions
ClusterReference             :
ClusterName                  :
HostReference                :
EnableInitialPass            : False
EnableDigests                : True
InitialPassDir               :
ReplicaNameSuffix            :
ReplicaNamePrefix            :
ReplicaTargetVmFolderRef     :
ReplicaTargetResourcePoolRef :
DatastoreName                :
DatastoreReference           :
DiskCreationMode             : Source
UseReIP                      : False
UseNetworkMapping            : False
InitialSeeding               : False
UseVmMapping                 : False

Veeam.Backup.Model.CJobOptions.ViSourceOptions
EncryptLanTraffic         : False
FailoverToNetworkMode     : False
VCBMode                   : san
VDDKMode                  : san;nbd
EnableDoubleSnapshot      : False
DoubleSnapshotThresholdMb : 100
UseChangeTracking         : True
EnableChangeTracking      : True
VMToolsQuiesce            : False
VmAttributeName           : Notes
BackupTemplates           : False
ExcludeSwapFile           : True
BackupTemplatesOnce       : True
SetResultsToVmNotes       : False



You can set something with the following code:
Code: Select all
$JobName = "Rep001-002-auto-Win2008-XX"
$RestorePoints = "6"
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $JobName}
$JobnameObjectOptions = $JobnameObject.getoptions()
$JobnameObjectOptions.Options.RootNode.retaincycles = $RestorePoints
$JobnameObject.setoptions($JobnameObjectOptions)



CU Andy
Andreas Neufert
Veeam Software
 
Posts: 2200
Liked: 358 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: How to list all JobOption parameter/options?

Veeam Logoby Andreas Neufert » Sun Apr 08, 2012 9:34 pm

List VSS Options

Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$JobName = "Rep001-002-auto-Win2008-XX"
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $JobName}
$OptionsVSS = $JobnameObject.GetVssOptions()
$OptionsVSS
Andreas Neufert
Veeam Software
 
Posts: 2200
Liked: 358 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

[MERGED] : Veeam v6.5.0.128 - job settings report

Veeam Logoby shaun2011 » Mon Feb 11, 2013 11:20 am 1 person likes this post

hi

what is the best method to get a report of settings of all configured jobs, both backup and replication jobs?

using version 6.5.0.128.

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

Re: How to list all JobOption parameter/options?

Veeam Logoby v.Eremin » Mon Feb 11, 2013 11:46 am

For listing all of job options you can implement commands provided in two previous posts.

Additionally, if you’re willing to get these settings in a specified file, it might be worth utilizing redirection to a file or transcript functionality of PowerShell.

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

Re: How to list all JobOption parameter/options?

Veeam Logoby lorengordon » Tue Feb 19, 2013 2:38 am

Does anyone have a reference table of the acceptable values for each setting? The true/false are easy, and I can figure out the rest by trial and error, but it's rather time-consuming. Was hoping maybe someone else has already done the legwork. :)
lorengordon
Influencer
 
Posts: 23
Liked: 3 times
Joined: Fri Jul 01, 2011 12:50 pm
Full Name: Loren Gordon

Re: How to list all JobOption parameter/options?

Veeam Logoby tdewin » Wed Feb 20, 2013 12:14 pm

lorengordon wrote:Does anyone have a reference table of the acceptable values for each setting? The true/false are easy, and I can figure out the rest by trial and error, but it's rather time-consuming. Was hoping maybe someone else has already done the legwork. :)

in this case u can use the get-member statement like this
Code: Select all
$options.BackupStorageOptions.StgBlockSize | gm -static -type property
tdewin
Veeam Software
 
Posts: 1043
Liked: 360 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: How to list all JobOption parameter/options?

Veeam Logoby lorengordon » Wed Feb 20, 2013 11:08 pm

Ouch. So, no, no reference table, but I can build one that way.

Also interesting, that exposes more values than can be selected from the GUI. What happens if I set a value via powershell that the GUI doesn't support? Does the job break? Can I still edit the job via the GUI, or do I have to make changes only through powershell at that point?
lorengordon
Influencer
 
Posts: 23
Liked: 3 times
Joined: Fri Jul 01, 2011 12:50 pm
Full Name: Loren Gordon

Re: How to list all JobOption parameter/options?

Veeam Logoby tsightler » Thu Feb 21, 2013 12:39 am

I'm not sure what it will show in the GUI, but my guess, based on experience, is that it will show the value just below the one you set via Powerhshell. For example, if you set compression to 6, it will show "Optimal" (which I think is actually 4), rather than "Extreme" (which I think is 7). If you pick a block size like 2048 or 4096, I believe the GUI will show "Local".

These alternate values will also probably "work", but I'd strongly suggest only setting options to values that match those available in the GUI.
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: How to list all JobOption parameter/options?

Veeam Logoby Andreas Neufert » Thu Feb 21, 2013 8:09 am

My experience is that you can set values with powershell that are not allowed in the GUI.
So be carefull and doublecheck with normal GUI.
Only those settings that you can set on the GUI are working without trouble.
Andreas Neufert
Veeam Software
 
Posts: 2200
Liked: 358 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 7 guests