C# Code:

CReplicationServer cssSvr = new CReplicationServerClass();
cssSvr.Initialize(Environment.MachineName);

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

while ((int)dummy != -1)
{
    CReplicationProject obj = (CReplicationProject)cssSvr.EnumProjects(ref dummy);
    Console.WriteLine(obj.get_Name().ToString());

}

VBScript Code:

Option Explicit
On Error Resume Next

const CSS_ERROR_NO_PROJECTS = 15100
const CSS_ERROR_NO_MORE_ITEMS = -2147422485

dim ReplServer
set ReplServer = CreateObject("CssApi.ReplicationServer")
ReplServer.Initialize("")

dim Project
dim Iterator
dim ReplProject

Iterator = 0
Wscript.Echo "The projects are:"

do while True
'Clear any error text
Err.Clear

'Get the next project
set ReplProject = ReplServer.EnumProjects(Iterator)

'Display error message and
'Quit if empty object returned (no more instances)
if IsEmpty(ReplProject) then
Wscript.Echo "Empty project object returned."
exit do
end if

'Display error message and
'Quit if "No projects defined" error
dim ReplError
ReplError = Err.Number
if ReplError = CSS_ERROR_NO_PROJECTS then
Wscript.Echo "No projects defined."
exit do
elseif (ReplError = CSS_ERROR_NO_MORE_ITEMS) then
'Quit if "No more items" error (we've reached the end of the list)
exit do
elseif Err.Number <> 0 then
'Display error message and quit
Wscript.Echo "Error Description: " & Err.Description
exit do
end if

Wscript.Echo ReplProject.Name

Loop