Deployment and Imaging Group

 View Only
  • 1.  Vbscript - Get info about running jobs / tasks

    Posted Sep 04, 2017 11:14 AM
    Hi, I have found the following extra which makes the agent checking for new tasks: set agent = CreateObject("Altiris.AeXNSClient") set clientTaskAgent = agent.Agent("Altiris.ClientTaskAgent") clientTaskAgent.CheckForTasks() I was wondering what other methods and properties are available for this object. Especially I would like to know if the current running jobs and tasks can be collected. Thanks Stefan


  • 2.  RE: Vbscript - Get info about running jobs / tasks

    Trusted Advisor
    Posted Sep 04, 2017 11:31 AM

    Hi Stefan,

    There is a CHM file that can be found in Program Files > Altiris > Altiris ASDK > Help > ASDK8.1.chm

    There are a few more examples under Programming Guides > COM Programming Guide.

    Let us know if you need anything else.

    Thanks

     



  • 3.  RE: Vbscript - Get info about running jobs / tasks

    Posted Sep 04, 2017 12:39 PM
    I have not found anything there related to the Task Agent part.


  • 4.  RE: Vbscript - Get info about running jobs / tasks

    Trusted Advisor
    Posted Sep 04, 2017 12:43 PM

    Could you use the TaskStatusDetails Members? 

    There are fields for Status and Type. 

    Status
    Status of the task.
    Type
    Indicates if this task is a "Server Job", "Server Task", "Client Job" or "Client Task".


  • 5.  RE: Vbscript - Get info about running jobs / tasks

    Posted Sep 05, 2017 06:50 AM

    Hi Sam,

    Thanks for your help, however this functions I cannot use for this purpose. I want to get the information on the client side. I probably have found what I need. Some information can be queried using WMI:

    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM AltirisAgent_ClientTaskStatus",,48) 
    For Each objItem in colItems 
        Wscript.Echo "-----------------------------------"
        Wscript.Echo "AltirisAgent_ClientTaskStatus instance"
        Wscript.Echo "-----------------------------------"
        Wscript.Echo "Description: " & objItem.Description
        Wscript.Echo "EndTime: " & objItem.EndTime
        Wscript.Echo "Guid: " & objItem.Guid
        Wscript.Echo "Name: " & objItem.Name
        Wscript.Echo "ReturnCode: " & objItem.ReturnCode
        Wscript.Echo "StartTime: " & objItem.StartTime
        Wscript.Echo "Status: " & objItem.Status
    Next

    and

    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM AltirisAgent_ClientTaskAgentStatus",,48) 
    For Each objItem in colItems 
        Wscript.Echo "-----------------------------------"
        Wscript.Echo "AltirisAgent_ClientTaskAgentStatus instance"
        Wscript.Echo "-----------------------------------"
        Wscript.Echo "CurrStatusCode: " & objItem.CurrStatusCode
        Wscript.Echo "LastCheckedForTasks: " & objItem.LastCheckedForTasks
        Wscript.Echo "LastRegistered: " & objItem.LastRegistered
        Wscript.Echo "MachineGUID: " & objItem.MachineGUID
        Wscript.Echo "TaskName: " & objItem.TaskName
        Wscript.Echo "TaskReturnCode: " & objItem.TaskReturnCode
        Wscript.Echo "TaskServer: " & objItem.TaskServer
        Wscript.Echo "TaskStatusCode: " & objItem.TaskStatusCode
    Next

    Stefan



  • 6.  RE: Vbscript - Get info about running jobs / tasks

    Trusted Advisor
    Posted Sep 05, 2017 10:15 AM

    Hi Stefan,

    Yeah, I would agree that WMI is the easier option. 

    There is another class called "AltirisAgent_Task" that may help.

    The Properties for that class include things like:

    IsActive
    IsScheduled
    Status

    If you've found what you need from "AltirisAgent_ClientTaskAgentStatus" then feel free to mark yourself as the solution!

    Thanks



  • 7.  RE: Vbscript - Get info about running jobs / tasks

    Broadcom Employee
    Posted Sep 05, 2017 10:58 AM

    Can you use the tasks reports to accomplish that? Reports-->Task Server-->Status-->Job/Task Status Detail



  • 8.  RE: Vbscript - Get info about running jobs / tasks
    Best Answer

    Posted Sep 11, 2017 07:43 AM

    The WMI seems to be the best way to achieve what I wanted to do. I am going to use the following command in powerwhell to get the tasks which are currently running on the client machine. The script is running locally on the client.

    $list = Get-WmiObject AltirisAgent_ClientTaskStatus -Filter "Status = '0' "
    
    foreach ( $item in $list ) { 
    
    "Name = " + $item.Name
    
    
    }

    Stefan