Schedule / Execute a task using the ASDK with powershell
search cancel

Schedule / Execute a task using the ASDK with powershell

book

Article ID: 178207

calendar_today

Updated On:

Products

Task Server

Issue/Introduction

 How to schedule / Execute a task using the ASDK with powershell?

Environment

ITMS 8.x

Resolution

At times you may want to use your own code to schedule a task through Powershell, and this can be done by using the following Powershell script task as seen below:

$compname = "%COMPNAME%"
$URI = "http://localhost/Altiris/ASDK.Task/TaskManagementService.asmx"

$proxy = New-WebServiceProxy -Uri $URI -Class Task -Namespace webservice -UseDefaultCredential

$inputXml = @"
<inputParameters>
    <parameter>
        <name>@AssignedResources</name>
        <value>%COMPID%</value>
    </parameter>
    <parameter>
        <name>@CompRequirements</name>
        <value>
                <minWaitTime>1 minutes</minWaitTime>
                <maxWaitTime>10 minutes</maxWaitTime>
                <minCompletion>95 %</minCompletion>
        </value>
    </parameter>
    <parameter>
        <name>@OverrideMaintenanceWindows</name>
        <value>
            <boolean>true</boolean>
        </value>
    </parameter>
</inputParameters>
"@

$proxy.ExecuteTask("15f4a911-63f6-4132-bf28-d7c0081f7625" ,"PowerShell Execute on $compname", $inputXML)

Additional Information

193432 Symantec ASDK API documentation

151240 Current supported values for the ASDK TaskManagementService ChangeAdvancedOptions optionsxml parameter

Altiris Software Dev Kit (ASDK)