IAdmTop5
The IAdmTop5 interface extends the IAdmTop interface with the ability to run scheduled tasks on an object.
Inheritance: IUnknown
Methods
-
Method
-
Description
-
ExecuteScheduledTask()
-
Runs the given scheduled task on the object.
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.
- PowerShell
-
[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) }
- C#
-
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