PowerShell script exchange
Post Reply
Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

How to list all JobOption parameter/options?

Post by Andreas Neufert » 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)
foggy
Veeam Software
Posts: 21139
Liked: 2141 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Who to list all JobOption parameter/options?

Post by foggy »

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).
Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Who to list all JobOption parameter/options?

Post by Andreas Neufert »

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?
Sethbartlett
Veteran
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: How to list all JobOption parameter/options?

Post by Sethbartlett »

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.
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: How to list all JobOption parameter/options?

Post by tsightler »

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"
Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: How to list all JobOption parameter/options?

Post by Andreas Neufert »

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
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: How to list all JobOption parameter/options?

Post by Andreas Neufert »

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
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: How to list all JobOption parameter/options?

Post by Andreas Neufert »

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

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

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

Re: How to list all JobOption parameter/options?

Post by veremin »

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.
lorengordon
Influencer
Posts: 23
Liked: 3 times
Joined: Jul 01, 2011 12:50 pm
Full Name: Loren Gordon
Contact:

Re: How to list all JobOption parameter/options?

Post by lorengordon »

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. :)
tdewin
Veeam Software
Posts: 1818
Liked: 655 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: How to list all JobOption parameter/options?

Post by tdewin »

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
lorengordon
Influencer
Posts: 23
Liked: 3 times
Joined: Jul 01, 2011 12:50 pm
Full Name: Loren Gordon
Contact:

Re: How to list all JobOption parameter/options?

Post by lorengordon »

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?
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: How to list all JobOption parameter/options?

Post by tsightler »

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.
Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: How to list all JobOption parameter/options?

Post by Andreas Neufert »

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
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: How to list all JobOption parameter/options?

Post by Andreas Neufert »

You can read out all options with

Code: Select all

| format-custom >> C:\test.txt
for example as well.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests