PowerShell script exchange
vraengmose
Influencer
Posts: 16 Liked: 2 times
Joined: Jun 18, 2019 9:46 am
Full Name: Thomas Trolle Vrøngmose
Contact:
Post
by vraengmose » Jun 20, 2019 10:55 am
this post
Hi
I been trying to set "Remove deleted data after" in Storage/Maintenance through Powershell ("retainday") in backup jobs and backup copy jobs. And got it to work with
backup jobs:
Code: Select all
Asnp VeeamPSSnapin
$Jobs = Get-VBRJob | where {$_.Jobtype -eq "Backup"}
foreach ($Job in $Jobs)
{
$Options = $Job.GetOptions()
$Options.backupstorageoptions.retaindays = "30"
$Options.BackupStorageOptions.EnableDeletedVmDataRetention = $True
Set-VBRJobOptions -Job $Job -Options $Options
}
But when i try on backup copy jobs it dos not work
Code: Select all
Asnp VeeamPSSnapin
$Jobs = Get-VBRJob | where {$_.Jobtype -eq "BackupSync"}
foreach ($Job in $Jobs)
{
$Options = $Job.GetOptions()
$Options.backupstorageoptions.retaindays = "60"
$Options.BackupStorageOptions.EnableDeletedVmDataRetention = $True
Set-VBRJobOptions -Job $Job -Options $Options
}
Any ideas?
veremin
Product Manager
Posts: 20406 Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Jun 20, 2019 2:29 pm
1 person likes this post
Check this example:
Code: Select all
Asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your backup copy Job"
$Options = $Job.GetOptions()
$Options.generationpolicy.EnableDeletedVmDataRetention = $True
$Options.generationpolicy.DeletedVmsDataRetentionPeriodDays = ''Desired number of days"
Set-VBRJobOptions -Job $Job -Options $Options
Thanks!
vraengmose
Influencer
Posts: 16 Liked: 2 times
Joined: Jun 18, 2019 9:46 am
Full Name: Thomas Trolle Vrøngmose
Contact:
Post
by vraengmose » Jun 21, 2019 7:01 am
this post
It did not work on my backup copy jobs as wised.
I discovered that the function is not under storage but under target, in a backup copy job. Target>advanced>Maintenance.
Any other ideas?
vraengmose
Influencer
Posts: 16 Liked: 2 times
Joined: Jun 18, 2019 9:46 am
Full Name: Thomas Trolle Vrøngmose
Contact:
Post
by vraengmose » Jun 21, 2019 7:24 am
this post
NO it did work! i forgot to change the {$_.Jobtype -eq "
BackupSync "}
Did all copy jobs with this:
Code: Select all
Asnp VeeamPSSnapin
$Jobs = Get-VBRJob | where {$_.Jobtype -eq "BackupSync"}
foreach ($Job in $Jobs)
{
$Options = $Job.GetOptions()
$Options.generationpolicy.EnableDeletedVmDataRetention = $True
$Options.generationpolicy.DeletedVmsDataRetentionPeriodDays = "22"
Set-VBRJobOptions -Job $Job -Options $Options
}
Thanks for your help v.eremin!
veremin
Product Manager
Posts: 20406 Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Jun 21, 2019 1:02 pm
1 person likes this post
You're welcome. Deleted VM retention settings should be modified differently for backup and backup copy jobs - backupstorageoptions and generationpolicy, respectively. Thanks!
Users browsing this forum: No registered users and 5 guests