Hi there,
I've been working on a PowerShell script which includes setting an Azure Recovery Vault backup policy. Microsoft has provided an example of how to configure a schedule for such a policy here https://docs.microsoft.com/en-us/powershell/module/az.recoveryservices/new-azrecoveryservicesbackupprotectionpolicy?view=azps-5.9.0.
This includes getting an AzRecoveryServicesBackupSchedulePolicyObject, clearing its ScheduleRunTimes, and adding the current time with the help of Get-Date; that's great, if you want the backups to start at the current time. But, what if you want the backups to be scheduled for a different time?
This is the part of the script that I am struggling with:
$rsvSchedulePolicy = Get-AzRecoveryServicesBackupSchedulePolicyObject -WorkloadType "AzureVM"
$rsvSchedulePolicy.ScheduleRunTimes.Clear()
$rsvSchedulePolicy.ScheduleRunTimes.Add({16-5-2021 02:00:00})
I can't find anything about how you would enter a different time, and as you can see, I tried just entering a System.String in the same format as the SchedulePolicyObject.ScheduleRunTimes, but the parameter only accepts "Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.SchedulePolicyBase" objects.
Perhaps setting a schedule time different from the current time simply isn't possible with PowerShell. But I highly doubt that.
Any help with this will be greatly appreciated.
Thanks in advance.
Frank