 |
AgentTask - Possible to control Successful Unsuccessful?
| |
AgentTask - Possible to control Successful Unsuccessful?
Posted: Mon, Feb 08, 2010 5:26 AM :: Rank: 2 |
Author
|
|
|
Points: 15261
Level: System Center Expert |
Thank you for your rating!
|
Hi,
I'm currently working on an Agent Task and we already had the experience that people think that the Task was successful because it stands it in the console which is only partially true as: Yes, the script ran, but not the way we wanted it to run.
So, I was wondering how we could control that.
I will try it now with throwing an exit code but I wanted to get some input in case anyone else worked out something already.
EDIT:
Tried it now with throw and exit 34. Both don't do the job.
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: AgentTask - Possible to control Successful Unsuccessful?
Posted: Mon, Feb 08, 2010 5:33 AM :: Rank: 3 |
Author
|
|
|
Points: 30429
Level: System Center Expert |
Thank you for your rating!
|
What I find helpful is to run the script on a test box outside off OpsMgr (or SCCM) to see if it runs correctly and I get the result I need. Then run it via the Management program in the case OpsMgr. If they is a failure we understand better the root cause. If that helps
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: AgentTask - Possible to control Successful Unsuccessful?
Posted: Mon, Feb 08, 2010 5:40 AM :: Rank: 4 |
Author
|
|
|
Points: 15261
Level: System Center Expert |
Thank you for your rating!
|
Hi,
the script works just fine, that's not the problem.
Thing is: We configure and discover our checks from the registry, and therefore we want to provide a task in the console that deploys registry keys and values. Works just fine.
However, in case some check already exists I want to return an error, so people don't think the check has been deployed successfully.
Of course it stands it in the output that the check already exists but people see a green icon and think it worked just fine.
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
RE: AgentTask - Possible to control Successful Unsuccessful?
Posted: Mon, Feb 08, 2010 6:04 AM :: Rank: 4 |
Author
|
|
|
Points: 41211
Level: System Center Expert |
Thank you for your rating!
|
if memory serves, the success of a task is determined by the numeric response code returned, which I believe can be 0, -1 or 2 for success, fail and timeout. I believe I have these in a document and will look them up for you. Also in this situation in the past, we've actually logged an event right from the script to and raised an alert from that to tip the user off. Truth be told, if they can't see the notice you present in task output, raising an alert is probably the most notable way to say "Hey buddy, your task failed!".
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: AgentTask - Possible to control Successful Unsuccessful?
Posted: Mon, Feb 08, 2010 6:58 AM :: Rank: 4 |
Author
|
|
|
Points: 15261
Level: System Center Expert |
Thank you for your rating!
|
Hmm that's weird. I run a Powershell Write Action there and when I exit with some exit code it shows it as successful.
When I throw an error it exits with code 1 which should be considered as an error as well.
Will try exiting with -1 now.
EDIT: Doesn't work either ;)
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
|
|
|
Quick Links
System Center Web sites
3rd Party / Partner Resources
Other System Center Resources
|
|
|
|
|
Top Contributors
|
|
Points: 41211
Level: System Center Expert
|
|
|
Points: 30429
Level: System Center Expert
|
|
|
Points: 29964
Level: System Center Expert
|
|
|
Points: 20109
Level: System Center Expert
|
|
|
Points: 15261
Level: System Center Expert
|
|
|
|
|
|
|
|
|
|
|
|
|
 |