Hello,
There is no need to perform a search. Use the below updated script. In the script, the $taskPath variable specifies the ADS Path of the Scheduled Task to be executed. To get the path:
- Launch Adaxes Administration Console.
- In the Console Tree, expand your service node.
- Navigate to Configuration\Scheduled Tasks.
- Right-click the Scheduled Task you need.
- In the context menu, open the submenu of the Copy item.
- Click Copy ADS Path. The Path of the selected Scheduled Task will be copied to the clipboard.
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$adaxesService = "adaxesserver.company.com" # TODO: modify me
$taskPath = "Adaxes://adaxesserver.company.com:28102/CN=My Task,CN=My Container,CN=Scheduled Tasks,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly($adaxesService)
# Bind to the Scheduled Task
$myScheduledTask = $admService.OpenObject($taskPath, $NULL, $NULL, 0)
# Run the Scheduled Task
$myScheduledTask.RunNow()