Skip to content

IAdmTop5

The IAdmTop5 interface extends the IAdmTop interface with the ability to run Scheduled Tasks on an object.

Inheritance: The IAdmTop5 interface inherits from the IUnknown interface.

Methods

Details

ExecuteScheduledTask()

Runs the given Scheduled Task on the object.

void ExecuteScheduledTask(String scheduledTaskId)

Parameters

The scheduledTaskId parameter specifies the unique identifier of the Scheduled Task to run. To get the identifier, use the IAdmScheduledTask::TaskID property.

Examples

The following code sample runs a Scheduled Task on all users in an Organization Unit.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the Scheduled Task
$taskDN = "CN=My Task,CN=Scheduled Tasks,CN=Configuration Objects,"+
    "CN=Adaxes Configuration,CN=Adaxes"
$task = $admService.OpenObject("Adaxes://$taskDN", $NULL, $NULL, 0)

# Bind to the Organizational Unit
$containerDN = "OU=My OU,DC=domain,DC=com"
$container = $admService.OpenObject("Adaxes://$containerDN", $NULL, $NULL, 0)

# Run the Scheduled Task for all users in the Organizational Unit
$container.Filter = @("user")

foreach ($user in $container)
{
    $user.ExecuteScheduledTask($task.TaskID)
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Interop.Adsi.ScheduledTasks;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the Scheduled Task
        const string taskPath = "Adaxes://CN=My Task,CN=Scheduled Tasks," +
                                "CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes";
        IAdmScheduledTask task = (IAdmScheduledTask)admService.OpenObject(
            taskPath, null, null, 0);

        // Bind to the Organizational Unit
        const String containerPath = "Adaxes://OU=My OU,DC=domain,DC=com";
        IADsContainer container = (IADsContainer)admService.OpenObject(
            containerPath, null, null, 0);

        // Run the Scheduled Task for all users in the Organizational Unit
        container.Filter = new object[] { "user" };

        foreach (IAdmTop5 user in container)
        {
            user.ExecuteScheduledTask(task.TaskID);
        }
    }
}

Requirements

Minimum required version: 2018.2

See also