Video Screencast Help
Give us your opinion and win with Symantec! Please help us by taking this survey and tell us about your satisfaction level using Symantec Connect. One lucky winner will receive 500 Connect points!* Take the survey.

ASDK 7.5 - Executing a Task using Powershell

Created: 29 Jul 2014 • Updated: 29 Jul 2014
LCode's picture
+4 4 Votes
Login to vote

I recently received a question if it is possible to schedule a job/task using PowerShell.
Executing a task is one of the possibilities of the Altiris ASDK TaskManagement library, something that I already used in the past when I wrote a Workflow webeservice to schedule a QuickDelivery.
The attached PowerShell is an example based upon parts of that Workflow.

This example uses ExecuteTask to schedule a task to run immediately. You could use ScheduleTaskCustom or ScheduleTaskShared to execute a task on a specific schedule.
The most important caveat in using the ExecuteTask or ScheduleTaskCustom methods is that they require a parameter called inputParameters which is actually a XML-syntaxed value. The following is an example of a valid value for inputParameters. The only thing that always needs to change is the GUID or GUIDs of computers which need to execute the task, in the example marked as cursive. When you want to schedule it on multiple computers you have to separate the values with a comma.

<minWaitTime>2 minutes</minWaitTime>
<maxWaitTime>60 minutes</maxWaitTime>
<minCompletion>100 %</minCompletion>

Furthermore the ExecuteTask needs the guid of the task to execute and a name for the instance of the task. The instance name (executionName) will be visible in the console.
Syntax: string ExecuteTask(string taskGuid, string executionName, string inputParameters)


The following requirements need to be met when running the tool on a client workstation

  • Rename the .txt at the end of the filename so the extension is .ps1
  • ASDK libraries locally installed.
    You require symantec_asdk_ns_com_x64.msi or symantec_asdk_ns_com_x86.msi.
    You can find them in a subfolder of Symantec Installation Manager, below ...\Symantec Installation Manager\Installs\Altiris\
  • Local administrator rights to access/activate the ASDK libraries
  • Powershell executionpolicy must allow local script execution, eg. set executionpolicy to remotesigned


There are a couple of variables that you need to modify in the script before it is ready to use.

  1. Change the name of the Altiris server in the line $global:altirisserver = "vm-alt-ns01"
  2. If HTTPS is required modify the line $global:https = 1 and set it to value 1
    When using HTTP set it to value 0
  3. Change the authentication parameters
  • For single sign-on, using your already logged-on credentials.
    Only modify the line $global:altirissso = 1 and set it to value 1
  • For sign-on with credentials provided in the script
    Modify the line $global:altirissso = 1 and set it to value 0
    Modify the line $global:altirisdomain = "ALTIRIS" and set it to your Active Directory Domain
    Modify the line $global:altirisuser = "Administrator" and set it to the AD account which has access to the Altiris Console
    Modify the line $global:altirispass = "Altiris01" and set the password of the AD Account.
  • Modify the line $computername = "COMPUTER01" and set it to the name of your test computer
  • Modify the line $taskname = "Run Script - Hello World" and set it to the name of a job/task you want to execute.