Setting a schedule to vRanger Replication jobs

Tagged: 

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of GreenBaron GreenBaron 6 months, 1 week ago.

  • Author
    Posts
  • #61788
    Profile photo of GreenBaron
    GreenBaron
    Participant

    Hello guys,
    I am looking to create some kind of automation to create vRanger replication jobs for our VMs. I am able to actually create the jobs but only as a 'Run on Demand' type of job. I have dug around the internet looking for some way to set this as a scheduled job but have yet to find anyone doing the same. Based on the help output, I have attempted the following with no success.

    Adding the schedule during the replication job's creation

    Add-ReplicationJobTemplate -JobName "$JobName" -JobDescription "$Description" -JobEntity $VMInfo -TargetHost $HostInfo -ReplicateName $ReplicaVMName -Type Differential -TargetNetworks $ReplicaNetwork.Name -PrimaryDatastore $ReplicaStorage.name -TargetDatastores $ReplicaStorage.name -Flags $RepFlags -JobSchedule $Schedule

    Updating the replication job with an a schedule

    get-jobtemplate -Type Replication | where { $_.inventoryNodeName -eq "$VM" }  | Update-ReplicationJobTemplate -JobSchedule $Schedule

    Error posted:

    Update-ReplicationJobTemplate : {0} type is not supported.  Valid types are VA-HotAdd, VA-Network, COS
    Parameter name: vRanger.API.PowerShell.vAPIService.TransportType
    At line:1 char:70
    + Get-JobTemplate | where { $_.inventoryNodeName -eq "$VM" }  | Update-Repl ...
    +                                                                      ~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (vRanger.API.Pow...ervice.Schedule:Schedule) [Update-ReplicationJobTemp
       late], ArgumentException
        + FullyQualifiedErrorId : 0,vRanger.API.PowerShell.JobShell.UpdateReplicationJobTemplate

    The $schedule variable above is simply taken from an existing replication job with a schedule already in place. Does anyone know of a way to update/add schedules to vRanger using powershell?

  • #61825
    Profile photo of GreenBaron
    GreenBaron
    Participant

    Found a workaround.

    Since the schedule field had specific references to the newly created job template, I had simply left that ID reference blank. On the job creation command, it had auto-populated the schedule.id field for me.

    Final commands:

    $tempSchedule=(Get-JobTemplate | where {$_.inventoryNodeName -like "$TempServer"}).schedule
    $tempSchedule.ID=""
    $tempSchedule.NextRecurrence=$tempSchedule.NextRecurrence.addminutes($RandonMin)
    Add-ReplicationJobTemplate -JobName "$JobName" -JobDescription "$Description" -JobEntity $VMInfo -TargetHost $HostInfo -ReplicateName $ReplicaVMName -Type Differential -TargetNetworks $ReplicaNetwork.Name -PrimaryDatastore $ReplicaStorage.name -TargetDatastores $ReplicaStorage.name -Flags $RepFlags -JobSchedule $Schedule

You must be logged in to reply to this topic.