Hi,
I would like to be able to export all jobs from a Veeam server with configs such as retention policy and RPO/schedule to a CSV.
I tried this: powershell-f26/export-to-csv-job-t62689.html
But it only exports the first job, and included none of the information I could use to document RPO policy and Retention policy. There has to be a better way than just screenshotting the job settings?
THX,
-JB
-
- Service Provider
- Posts: 234
- Liked: 40 times
- Joined: Mar 08, 2010 4:05 pm
- Full Name: John Borhek
- Contact:
Looking to export all jobs with configs to CSV
John Borhek, Solutions Architect
https://vmsources.com
https://vmsources.com
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Looking to export all jobs with configs to CSV
Hi John,
Sure, it involves diving a bit deeper into job options. Here is a small example with daily and monthly schedules:
I needed to show retention, retention type, schedule settings and reflect specific properties based on schedule type.
Hope you get the idea. If you have any questions, I'm here and glad to help.
Best regards,
Oleg
Sure, it involves diving a bit deeper into job options. Here is a small example with daily and monthly schedules:
Code: Select all
$jobs = Get-VBRJob
$summary = @()
foreach ($job in $jobs) {
$scheduleKind = ''
if ($job.ScheduleOptions.OptionsDaily.Enabled -eq $true) {
$scheduleKind = 'Daily'
$dailyKind = $job.ScheduleOptions.OptionsDaily.Kind
$days = $job.ScheduleOptions.OptionsDaily.DaysSrv
}
elseif ($job.ScheduleOptions.OptionsMonthly.Enabled -eq $true) {
$scheduleKind = 'Monthly'
$monthIndex = $job.ScheduleOptions.OptionsMonthly.DayNumberInMonth
$dayOfWeek = $job.ScheduleOptions.OptionsMonthly.DayOfWeek
$months = $job.ScheduleOptions.OptionsMonthly.Months
}
if ($job.BackupStorageOptions.RetentionType -eq 'Cycles' -and $scheduleKind -eq 'Daily') {
$summary += $job | select Name, @{n='RetentionType';e={$_.BackupStorageOptions.RetentionType}}, `
@{n='RetainCycles';e={$_.BackupStorageOptions.RetainCycles}}, `
@{n='ScheduleKind';e={$scheduleKind}}, @{n='DailyKind';e={$dailyKind}}, @{n='Days';e={$days}}
}
elseif ($Job.BackupStorageOptions.RetentionType -eq 'Days') {
$summary += $job | select Name, @{n='RetentionType';e={$_.BackupStorageOptions.RetentionType}}, `
@{n='RetainDays';e={$_.BackupStorageOptions.RetainDays}}, `
@{n='ScheduleKind';e={$scheduleKind}}, @{n='MonthIndex';e={$monthIndex}}, @{n='DayOfWeek';e={$dayOfWeek}}, @{n='Months';e={$Months}}
}
}
$summary | Export-Csv -Path 'C:\Summary.csv'
Hope you get the idea. If you have any questions, I'm here and glad to help.
Best regards,
Oleg
-
- Service Provider
- Posts: 234
- Liked: 40 times
- Joined: Mar 08, 2010 4:05 pm
- Full Name: John Borhek
- Contact:
Re: Looking to export all jobs with configs to CSV
So how do you add the VMs to the output?
THX,
-JB
THX,
-JB
John Borhek, Solutions Architect
https://vmsources.com
https://vmsources.com
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Looking to export all jobs with configs to CSV
Easy.
Just insert this to foreach loop:
And add object names to the summary:
Just insert this to foreach loop:
Code: Select all
$objects = Get-VBRJobObject -Job $job
Code: Select all
$summary += $job | select Name, @{n='VMs';e={$objects.Name} ...
Who is online
Users browsing this forum: No registered users and 14 guests