I have write a procedure who cleans a computer. Can I send a mail with the result of the procedure ? With the list of the computers and the result for each computer.
It sounds like what you need to do is write a report of some kind to gather all of the data you want. You can then schedule a report to run and email to you at a specified time each day.
There is a 'sendemail' command within the agent procedure template to accomplish your task.
Ok thanks for the answer.
But i want to put the id's of the machines and the result for each machine in the body of the message. But i don't know how to do that.
You would use a variable in the subject or body of the email, wherever you want to show the name of the agent. A common pre-defined system variable we use in procedures for this is #vAgentConfiguration.machName#.
For the results, you would most likely want to dump those into a txt file on the local machine, and then use a variable you define to grab the contents of that text file, and then put the variable in the body of the email you want to send.
So the subject line of your email would be PC Cleaning Results for #vAgentConfiguration.machName#. Then all you would need to put in the body of the email is the variable you define within the procedure which grabbed the contents of that txt file, so something like #cleaningresults#.
And can you explain please how to save the result of the procedure into a txt file ? Because i didn't find. Thanks.
I do something like this:
- I always create a Script Working Directory. It keeps things neat, and you can delete it when you're done.
- Create a variable referring to a results file in the Script Working Directory.
- Write stuff to it. You can even write lines of text between your programatical results. Remember not to overwrite the file during your procedure.
- At the end of your procedure, create a new variable containing the content of the results file. Let's call the variable #detailLog#.
- Use the Send Email step to send the e-mail. Somewhere in the body of the e-mail, include #detailLog#.