cancel
Showing results for 
Search instead for 
Did you mean: 

Client Task

Jump to solution

I see to use the API to run a client task I use: clienttask.run names productId taskId

I need a script to run on multiple servers. And it's my understanding productid and taskid will be unique per server?

How do I query the productid and taskid to be able to use a single script across many servers? Always same product and client task name.

Thanks

1 Solution

Accepted Solutions

Re: Client Task

Jump to solution
6 Replies
jking
Level 10
Report Inappropriate Content
Message 2 of 7

Re: Client Task

Jump to solution

Mitch I think you'll have to use clienttask.find first.  Ie something like this:

https://epodemo:8443/remote/clienttask.find?searchText=<Task Name>&Smiley Surprisedutput=terse

The output should have a object ID column; in your script find the id first, and then use it in the subsequent call to run the task. On my demo server I did:

https://epodemo:8443/remote/clienttask.find?searchText=Collect&Smiley Surprisedutput=terse

and got:

OK:

objectId objectName               productId    productName   typeId typeName                            

-------- ------------------------ ------------ ------------- ------ -------------------------------------

6        Collect All              EPOAGENTMETA McAfee Agent  4      McAfee Agent: McAfee Agent Statistics

7        Collect only RelayServer EPOAGENTMETA McAfee Agent  4      McAfee Agent: McAfee Agent Statistics

Presumably you'd have a search string that returned only the single task you expected to find.  Hope that's useful.

Jon

Re: Client Task

Jump to solution

Thanks Jon.  The clienttask.run command also seems to require productId and taskIk.  What would the commands be to get those?

Thanks

jking
Level 10
Report Inappropriate Content
Message 4 of 7

Re: Client Task

Jump to solution

The 'task ID' is the 'object Id' in the table returned above for clienttask.find.  The productId is the third column, EPOAGENTMETA in my example.  I should also note that the product ID won't ever change; if you're using this script to kick off a particular task, you can probably just find out what it is and hard code it.

However, I know you haven't asked but I wanted to make a comment ... attempting to run a client task from the server on demand tends to not be the most reliable way to ensure something happens -- it only works on windows agents at the moment, and it only works if we can send a wakeup to the agents -- which means it has to be enabled in policy, the computer has to be turned on, and it can't be behind a NAT and reachable from the server.

That web API command is the equivalent of doing 'run client task now' from the system tree page.

I would expect you'd have better sustained luck having a tag-based client task assigment, with periodic queries to determine applicability for whatever it is you're automating, and applying or removing the tags that will result in client tasks being assigned to machines the next time they check in.

Anyway thought I'd throw two cents in the ring. 

Jon

Re: Client Task

Jump to solution

Thanks Jon. I have thought about both of those options and may use both.  Final question. My command I tried is:

https://eposerver/remote/clienttask.run?TESTPC&EPOAGENTMETA&255

Where the host name is TESTPC, the product ID is EPOAGENTMETA and the object ID is 255.

And I get:

Error 0 :

Error setting parameters for command: clienttask.run

Syntax error ?

jking
Level 10
Report Inappropriate Content
Message 6 of 7

Re: Client Task

Jump to solution

Mitch,

I can't test directly at the moment but you need to add the parameter name in front of the values:

clienttask.run?names=testpc&amp;productId=EPOAGENTMETA&amp;taskId=255

Give that a shot.  I might have the parameter names slightly wrong.

Jon

Re: Client Task

Jump to solution