PowerShell script exchange
Post Reply
CHOWEG
Novice
Posts: 5
Liked: never
Joined: Jul 08, 2022 6:21 pm
Contact:

Dump job settings to file

Post by CHOWEG »

Good afternoon,

I made a case (Case 05524073) with Veeam to see if this was possible, and apparently it is there's no built-it option in Veeam to export job settings, but they recommended me to do this via PowerShell asking for peer support.

Basically I am looking to create a dump of Job name, VM's protected, frequency of backup, "Restore Points" kept (and if possible, I would like to understand a correlation between "Restore Points" to days. e.g., 300 restore points equate to 1 day?).

Thank you in advance for your assistance!
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Dump job settings to file

Post by david.domask »

Hey @CHOWEG,

You can do this with some customization of the result of Get-VBRJob. Support is correct, general "How-To's" on Powershell aren't provided by Support. Support only validates that the supported cmdlets behave as expected, so questions beyond that should come here :) So if your question is "Is this Cmdlet not returning correct information" or "Is this flag working correctly", those are the right questions to give to Support. If it's more about "how do I do X in Powershell", come to the forums :)

You'll want something like:

Code: Select all

$job = Get-VBRJob -Name '[name of the job without brackets]"
$jOptions = Get-VBRJobOptions -Job $job
Check the Properties of the $job and $jOptions object by piping them to Get-Member (shorthand is gm)

Code: Select all

$job | gm
$jOptions | gm
A few shortcuts for you:

Job Name is a property of CJob Objects (in this case, $job.Name)
Retention Settings should be under BackupTargetOptions for $jOptions (doing this from phone so double-check this ofc) and you will want to check RetentionCycles or RetentionDays depending on if you use Point-based Retention or Day-Based retention. RetentionType will indicate this (0 for points, 1 for days).

Frequency of Backup should be tied to the Schedule, and that will be a property of $jOptions.

The correlation of Restore Points to Days is kind of a misnomer; Restore Points are created every single time a backup is run, and don't necessarily have a relationship to days. You can get a list of Restore Points and the day they were created by fetching the Restore Points with Get-VBRRestorePoint. RestorePoints source from a CBackup Object, so first do:

Code: Select all

$backups = Get-VBRBackup -name $job.name
$rps = Get-VBRRestorePoint -Backup $backups
$rps will have a CreationTime property that you can use to associate Restore Points with a specific day.

For Machines protected, there are two approaches, but I recommend check the Name property of $backups and compare it to the way you added the VMs to the job from Production. The reason for this is that if you add via a container object (e.g., Tags, Datastore, Host), only that object is returned via Powershell. There is the Get-VBRJobObject cmdlet to return objects added to a job, but the same logic applies to containers there, so in my opinion it's best to just write code that compares the results of $backup to an array sourced from Production (e.g., for HyperV, you can use $vms = Get-VM, then just do a comparison like:

$vms | Where-Object {$_.Name -notin $Backups.Name}

And let Powershell array comparisons do the hard work for you :)

I think play around with it a bit and see what you come up with and what questions you find.

If you're looking for a pre-made report, check this topic for an example of a pretty complete report: powershell-f26/my-veeam-report-v9-5-1-t47058-30.html

Hope it helps!
David Domask | Product Management: Principal Analyst
CHOWEG
Novice
Posts: 5
Liked: never
Joined: Jul 08, 2022 6:21 pm
Contact:

Re: Dump job settings to file

Post by CHOWEG »

Thank you David, I never requested PowerShell script help, just a way to dump my backup settings, vms, retentions etc. to present to management.

I tried the whole script you linked powershell-f26/my-veeam-report-v9-5-1-t47058-30.html but all I got was errors.

I will keep looking or do them manually, but this feature should be build into the product in my opinion.
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Dump job settings to file

Post by Mildur »

We have a job configuration report built-in to Veeam One.
https://helpcenter.veeam.com/docs/one/r ... ml?ver=110
Product Management Analyst @ Veeam Software
CHOWEG
Novice
Posts: 5
Liked: never
Joined: Jul 08, 2022 6:21 pm
Contact:

Re: Dump job settings to file

Post by CHOWEG »

I don't think we are licensed for that, when I launch the PowerShell, I think something is wrong, because I know I have a job called "General VM Job" and it doesn't see it, and when I run Get-VBRJob it shows one job only. Image
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Dump job settings to file

Post by Mildur »

Is this a Nutanix Backup Job?
Get-VBRJob doesn‘t list Nutanix Backup Jobs.
Veeam One reports would also not help you in that case.

Oleg posted a unsupported command in this post. But I don‘t think you can get the job options for Nutanix Backup Jobs.

Thanks
Fabian
Product Management Analyst @ Veeam Software
CHOWEG
Novice
Posts: 5
Liked: never
Joined: Jul 08, 2022 6:21 pm
Contact:

Re: Dump job settings to file

Post by CHOWEG »

Yes, these appear to be all Nutanix jobs. I went through each and every job to record all settings in Excel, so that is fixed.....

Now, let me try to understand "Restore Points". Based on David' comment "The correlation of Restore Points to Days is kind of a misnomer; Restore Points are created every single time a backup is run, and don't necessarily have a relationship to days."

For example, if I have a VM backed up every 1 hour, and I set "restore points to keep" = 24. The VM successfully backs up every hour; so my retention is effectively 1 day (24 hours), if it didn't run or fail, it will still keep 24 restore points (this is the part that may make it seem like a longer retention?)

Yeah, I am still not 100% clear on restore points to keep, sorry...
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Dump job settings to file

Post by david.domask »

Nothing to apologize for, it can be an abstract concept.

Your understanding is correct -- you would have hourly Restore Points and could restore up to 24 hours ago. I would suggest that such a target should be primarily used for servers with an extremely high rate of change for which you need to capture the data fairly continuously, and Replication via CDP might be a better way to protect the machine and then adjust the restore SLA for backups. There's nothing wrong with doing backups that frequently, but it will mean many snapshots on production which may impact the applications in use.
David Domask | Product Management: Principal Analyst
CHOWEG
Novice
Posts: 5
Liked: never
Joined: Jul 08, 2022 6:21 pm
Contact:

Re: Dump job settings to file

Post by CHOWEG »

Thank you David!
Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests