PowerShell script exchange
Post Reply
albertwt
Veteran
Posts: 880
Liked: 47 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Unable to view the Veeam backup settings using PowerShell?

Post by albertwt »

Hi Folks,

When using Veeam Backup PowerShell command:

Code: Select all

Get-VBRBackup | Select-Object -ExpandProperty Name | Get-VBRJobOptions
This is all I got when using the simple command

Code: Select all

Options                     : Veeam.Backup.Common.CDomContainer
GfsPolicy                   : Veeam.Backup.GFS.Model.DOM.CDomGfsPolicy
HvReplicaTargetOptions      : Veeam.Backup.Model.CDomHvReplicaTargetOptions
ReIPRulesOptions            : 
BackupStorageOptions        : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions         : Veeam.Backup.Model.CDomBackupTargetOptions
VmbSourceOptions            : Veeam.Backup.Model.CDomVmbSourceOptions
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
JobScriptCommand            : Veeam.Backup.Model.CDomJobScriptCommand
VcdReplicaTargetOptions     : Veeam.Backup.Model.CDomVcdReplicaOptions
ViReplicaTargetOptions      : Veeam.Backup.Model.CDomViReplicaTargetOptions
CloudReplicaTargetOptions   : Veeam.Backup.Model.CDomCloudReplicaTargetOptions
ViSourceOptions             : Veeam.Backup.Model.CDomViSourceOptions
GenerationPolicy            : Veeam.Backup.Model.CDomGenerationPolicy
SanIntegrationOptions       : Veeam.Backup.Model.CDomSanIntegrationOptions
ReplicaSourceOptions        : Veeam.Backup.Model.CDomReplicaSourceOptions
SqlLogBackupOptions         : Veeam.Backup.Model.CDomSqlLogBackupOptions
FailoverPlanOptions         : Veeam.Backup.Model.CDomFailoverPlanOptions
ViCloudReplicaTargetOptions : Veeam.Backup.Model.CDomViCloudReplicaTargetOptions
EpPolicyOptions             : Veeam.Backup.Model.CDomEpPolicyOptions
NasBackupRetentionPolicy    : Veeam.Backup.Model.CDomNasBackupRetentionPolicy
NasBackupOptions            : Veeam.Backup.Model.CDomNasBackupOptions
RpoOptions                  : Veeam.Backup.Model.CDomRpoOptions
VmbJobOptions               : 
IsBackupCopyGfsEnabled      : False
Is there a way to query the Backup Job options/properties using the PowerShell cmdlet?

Because on this page: https://helpcenter.veeam.com/docs/backu ... ml?ver=120
I cannot find the corresponding cmdlet to retrieve the email notification values using get-vbrjobadvancednotificationoptions

Thank you in advance.
--
/* Veeam software enthusiast user & supporter ! */
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Unable to view the Veeam backup settings using PowerShell?

Post by Mildur »

Hello Albert

Have you already tried to dive in further in NotificationOptions (select -ExpandProperty NotificationOptions)?

Code: Select all

Get-VBRBackup -name JobName | Select-Object -ExpandProperty Name | Get-VBRJobOptions | select -ExpandProperty NotificationOptions
This gives me the output you have requested:

Code: Select all

SnmpNotification                          : False
SendEmailNotification2AdditionalAddresses : False
EmailNotificationAdditionalAddresses      :
UseCustomEmailNotificationOptions         : False
EmailNotifyOnceADay                       : False
EmailNotifyTime                           : 22.02.2019 22:00:00
EmailNotificationSubject                  : [%JobResult%] %JobName% (%VmCount% machines) %Issues%
EmailNotifyOnSuccess                      : True
EmailNotifyOnWarning                      : True
EmailNotifyOnError                        : True
EmailNotifyOnLastRetryOnly                : True
EmailNotifyOnWaitingTape                  : True
LastReportTime                            :
LastAdditionalReportTime                  :
Best,
Fabian
Product Management Analyst @ Veeam Software
albertwt
Veteran
Posts: 880
Liked: 47 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Unable to view the Veeam backup settings using PowerShell?

Post by albertwt »

Ah yes, thanks @FabianK for the update.
--
/* Veeam software enthusiast user & supporter ! */
albertwt
Veteran
Posts: 880
Liked: 47 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Unable to view the Veeam backup settings using PowerShell?

Post by albertwt »

@Mildur,

I have the code like:

Code: Select all

Get-VBRBackup | ForEach-Object {
	$job = $_
	$job.Name | Get-VBRJobOptions | Select-Object -ExpandProperty NotificationOptions | Select-Object -Property `
		@{n='Job Name'; e={$job.'Name'}},
		@{n='Job Type'; e={$job.'Type'}},
		@{n='Creation Time'; e={$job.'CreationTime'}},
		@{n='VM Count'; e={$job.'VM count'}},
		*
}
However, the Job Type is always showing as empty, am I missing something here?
--
/* Veeam software enthusiast user & supporter ! */
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Unable to view the Veeam backup settings using PowerShell?

Post by Mildur » 1 person likes this post

Hi Albert

The following changes must be done :)
- $job.'Type' = $job.'TypeToString'
- $job.'VM count' = $job.'VMcount'

Try this code:

Code: Select all

Get-VBRBackup | ForEach-Object {
	$job = $_
	$job.Name | Get-VBRJobOptions | Select-Object -ExpandProperty NotificationOptions | Select-Object -Property `
		@{n='Job Name'; e={$job.'Name'}},
		@{n='Job Type'; e={$job.'TypeToString'}},
		@{n='Creation Time'; e={$job.'CreationTime'}},
		@{n='VM Count'; e={$job.'VMcount'}},
		*
}
Best,
Fabian
Product Management Analyst @ Veeam Software
albertwt
Veteran
Posts: 880
Liked: 47 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Unable to view the Veeam backup settings using PowerShell?

Post by albertwt »

I agree, @Mildur.

That makes more sense, actually.
I appreciate the correction and update.
--
/* Veeam software enthusiast user & supporter ! */
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests