Deleting scheduled tasks
The following code sample deletes a scheduled task.
[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
$scheduledTasksPath = $admService.Backend.GetConfigurationContainerPath(
"ScheduledTasks")
$scheduledTasksPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" `
$scheduledTasksPath
$myScheduledTaskAdsPath = $scheduledTasksPathObj.CreateChildPath( `
"CN=My Task")
$myScheduledTask = $admService.OpenObject($myScheduledTaskAdsPath, $NULL, $NULL, 0)
# Delete the task
$myScheduledTask.DeleteObject("ADM_DELETEOBJECTFLAGS_AUTO")
See also
- Managing scheduled tasks
- Binding to Adaxes-specific objects
- Managing Adaxes-specific objects
- IADsDeleteOps
- Online script repository