PowerShell script exchange
Post Reply
Ayhan-Co
Service Provider
Posts: 36
Liked: 5 times
Joined: Jul 13, 2020 7:10 am
Full Name: Ayhan Dönmez
Contact:

Retention Script

Post by Ayhan-Co »

Hello All,

I need a script which show me retention informations like that.

Job Name| Retention |Retention Type
ABC | 7 | Days
KLM | 3 | Restore Points
XYZ |10 | Days
QWE| 14 | Restore Points

I found some scripts but they did not show me 'Days'. Have you got any idea?

Regards
Egor Yakovlev
Veeam Software
Posts: 2537
Liked: 683 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Location: Prague, Czech Republic
Contact:

Re: Retention Script

Post by Egor Yakovlev »

Hi Ayhan,

guess you are looking for:

Code: Select all

$JobOptions = Get-VBRJob -Name "JobName" | Get-VBRJobOptions
$JobOptions.BackupStorageOptions.RetentionType
/Cheers!
Ayhan-Co
Service Provider
Posts: 36
Liked: 5 times
Joined: Jul 13, 2020 7:10 am
Full Name: Ayhan Dönmez
Contact:

Re: Retention Script

Post by Ayhan-Co »

Hello Egor,

Thank you for useful informations. I used following script but it gives wrong information about Retention information. It shows me retention 7 but real value is 30.

Script:
Get-VBRJob | ? {$_.jobtype -eq "Backup"} |
Select-Object -Property @{N="Job Name"; E={$_.name}}, @{N = "Storage Retention"; E={$_.GetOptions().BackupStorageOptions.RetainCycles}}, @{N = "Retention Type"; E={$_.GetOptions().BackupStorageOptions.RetentionType}} | Format-Table -AutoSize
SS:
Image

Regards
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retention Script

Post by oleg.feoktistov » 1 person likes this post

Hi Ayhan,

RetainCycles property reflects retention for RestorePoints type, for Days type RetainDaysToKeep property is what you should be retrieving:

Code: Select all

@{N = "Storage Retention"; E={$_.GetOptions().BackupStorageOptions.RetainDaysToKeep}}
Thanks,
Oleg
Ayhan-Co
Service Provider
Posts: 36
Liked: 5 times
Joined: Jul 13, 2020 7:10 am
Full Name: Ayhan Dönmez
Contact:

Re: Retention Script

Post by Ayhan-Co »

Hi Oleg,

Thank you for your interest. Finally I can use powershell for retentions ;-)

Regards,
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests