Get a CSS project schedules

C# Code:

CReplicationServer cssSvr = new CReplicationServerClass();

// project name
CReplicationProject csPrj = (CReplicationProject)cssSvr.OpenProject(“Test”, CSS_PROJECT_CREATION.OPEN_EXISTING_PROJECT);

object dummy = new object();
dummy = 0;

while ((int)dummy != -1)
    CReplicationSchedule csSchd = (CReplicationSchedule)csPrj.EnumSchedules(ref dummy);

VBScript Code:

Option Explicit
On Error Resume Next

dim ReplServer
set ReplServer = CreateObject(“CssApi.ReplicationServer”)

dim Project
dim Iterator
dim ReplProject
dim sched
dim dummy
dim ReplError

Iterator = 0

‘Clear any error text

‘Get the project
set ReplProject = ReplServer.OpenProject(“Test”, 2)

do while true
  ‘Clear any error text

  if(Iterator <>-1) then
    set sched = ReplProject.EnumSchedules(Iterator)
    ‘Display error message and
    ‘Quit if empty object returned (no more instances)
    if IsEmpty(sched) then
      Wscript.Echo “Empty project object returned.”
      exit do
    end if

    ReplError = Err.Number
    if Err.Number <> 0 then
      ‘Display error message and quit
      Wscript.Echo “Error Description: ” & Err.Description & “Error Number: ” & Err.Number
      exit do
    end if

    Wscript.Echo “Schedule Name: ” & sched.Description
  end if