PowerShell script exchange
FrankFoghMadsen
Novice
Posts: 5 Liked: never
Joined: Oct 08, 2015 6:25 am
Full Name: Frank Fogh Madsen
Location: Denmark
Contact:
Post
by FrankFoghMadsen » Jun 25, 2020 4:48 am
this post
Hi
When running this "simple" code i get an Error see below.
Code: Select all
$group = Get-VBRProtectionGroup -Name "TestGroupName"
$repository = Get-VBRBackupRepository -Name "Default Backup Repository"
$destination = New-VBRComputerDestinationOptions -OSPlatform Windows -BackupRepository $repository
Add-VBRComputerBackupJob -OSPlatform Windows -Type Workstation -Mode ManagedByAgent -Name "TestJob" -BackupObject $group -BackupType EntireComputer -BackupRepository $repository -DestinationOptions $destination
Error ->
Add-VBRComputerBackupJob : The specified computer backup job is invalid.
Failed to validate computer backup job. Specify daily retention policy
At line:5 char:1
+ Add-VBRComputerBackupJob -OSPlatform Windows -Type Workstation -Mode ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-VBRComputerBackupJob], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Veeam.Backup.PowerShell.Cmdlets.AddVBRComputerBackupJob
I've tryed everything , but i hopefully just are missing a simple thing , it is not a problem to create a windows server backup job with same parameters
/Frank
HannesK
Product Manager
Posts: 14843 Liked: 3086 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:
Post
by HannesK » Jun 25, 2020 5:55 am
this post
Hello,
and welcome to the forums.
the error message says, that the retention policy is missing
did you try Example 2:
https://helpcenter.veeam.com/docs/backu ... ml?ver=100 ?
Best regards,
Hannes
FrankFoghMadsen
Novice
Posts: 5 Liked: never
Joined: Oct 08, 2015 6:25 am
Full Name: Frank Fogh Madsen
Location: Denmark
Contact:
Post
by FrankFoghMadsen » Jun 25, 2020 6:10 am
this post
HI Hannes
yes it works fine when using Linux Options , but when changing OSPlatform to Windows i have the fail.
I've just uploaded a more simple example , so that it was easy to trouble shoot.
/Frank
FrankFoghMadsen
Novice
Posts: 5 Liked: never
Joined: Oct 08, 2015 6:25 am
Full Name: Frank Fogh Madsen
Location: Denmark
Contact:
Post
by FrankFoghMadsen » Jun 25, 2020 6:15 am
this post
Here is the Code for the Job Part Same as in Example 2 but for Windows
Code: Select all
$group = Get-VBRProtectionGroup -Name "#DK01_PCC"
$repository = Get-VBRBackupRepository -Name "Default Backup Repository"
$destination = New-VBRComputerDestinationOptions -OSPlatform Windows -BackupRepository $repository
$daily = New-VBRDailyOptions -DayOfWeek Friday -Period 19:00
$schedule = New-VBRWindowsWorkstationScheduleOptions -DailyOptions $daily -PowerOffAction BackupAtPowerOn -BackupAtTargetConnection -PostBackupAction KeepRunning
Add-VBRComputerBackupJob -OSPlatform windows -Type Workstation -Mode ManagedByAgent -Name "windows" -BackupObject $group -BackupType EntireComputer -DestinationOptions $destination -ScheduleOptions $schedule -EnableSchedule
oleg.feoktistov
Veeam Software
Posts: 2010 Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:
Post
by oleg.feoktistov » Jul 02, 2020 2:53 pm
this post
Hi @FrankFoghMadsen ,
I was able to reproduce the same issue in my lab with v10 P2 and going to discuss it with QA. So, it would be helpful to know your VBR version also.
Thanks,
Oleg
FrankFoghMadsen
Novice
Posts: 5 Liked: never
Joined: Oct 08, 2015 6:25 am
Full Name: Frank Fogh Madsen
Location: Denmark
Contact:
Post
by FrankFoghMadsen » Jul 03, 2020 6:31 am
this post
Hi Oleg
I'm running V10 (10.0.0.4461) , Let me know if you need more info or need me to test more.
Thanks
Frank
oleg.feoktistov
Veeam Software
Posts: 2010 Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:
Post
by oleg.feoktistov » Jul 03, 2020 2:47 pm
this post
Hi Frank,
Decided to go for it once again with a clearer head and found the twist. Add-VBRComputerBackupJob cmdlet takes RestorePoints retention type by default. However, for windows workstations only RestoreDays retention type is allowed as described
here . And for servers it is either of them. That's why it was working with other types. By the way, you also need to specify that daily schedule is enabled.
Lines amended:
Code: Select all
$schedule = New-VBRWindowsWorkstationScheduleOptions -PowerOffAction BackupAtPowerOn -DailyOptions $daily `
-BackupAtTargetConnection -PostBackupAction KeepRunning -EnableDailySchedule
Add-VBRComputerBackupJob -OSPlatform Windows -Type Workstation -Mode ManagedByAgent -Name "windows" `
-BackupObject $group -BackupType EntireComputer -DestinationOptions $destination `
-RetentionType RestoreDays -ScheduleOptions $schedule -EnableSchedule
Cheers,
Oleg
FrankFoghMadsen
Novice
Posts: 5 Liked: never
Joined: Oct 08, 2015 6:25 am
Full Name: Frank Fogh Madsen
Location: Denmark
Contact:
Post
by FrankFoghMadsen » Jul 06, 2020 5:56 am
this post
Hi Oleg
Perfect , that works.
Did't find that one myself , even had a second pair of eyes on it before posting.
Thanks for the help.
/Frank
Users browsing this forum: No registered users and 1 guest