A process is an application in execution. Each application on a Windows based computer has its own processes. All applications with a graphical user interface (GUI) will have a running process. However not all processes will necessarily have a corresponding GUI. Some processes are used for background tasks, which do not require user interaction such as virus checking or automatic backups. Using the Windows Task Manager it is possible to view the list of running applications and processes on the local PC.
It may be useful to be able to save a list of running processes in a text format and automatically email them to a specific destination. One possible use of this could be to schedule this task so that processes can be monitored on a PC to check for any rogue processes or possible viruses. Another use could be for a network administrator to ensure that a particular process is running on a server, and if not to rerun that process or reboot the server.
The following example demonstrates how to create a batch file that will make a text file, which contains a list of running processes at a given time period. The batch file will be scheduled so that it runs every 10 minutes.
SOLUTION:
A batch file should be created as per the example below.
A new task should be added using the Windows task scheduler that runs the above batch file every 10 minutes. In Windows XP the task scheduler can be accessed from Start | Programs | Accessories | System Tools and by clicking on the Scheduled Tasks menu item. A new task can be added by selecting New | Scheduled Task from the File menu. Once the task has been created, the batch file and actual schedule can be defined by right-clicking on the task and selecting Properties.
@echo off
rem Gather a list of application(s)
rem and associated task(s) / process(es)
rem currently running on either a local or remote system...
tasklist >proclist.txt
rem Sending email with process list attached...
febootimail -SERVER mail.server.com -FROM process@machine.com -TO process-viewer@admin.com -SUBJECT List of requested remote server processes -ATTACH proclist.txt
rem Cleaning temporary files...
del proclist.txt >NUL 1: The first command retrieves a list of running processes in a table format. The output of the command is piped to the proclist.txt file. It is possible to change the formatting of the tasklist command using command parameters and filters.
2: The second line makes the call to Febooti Command line emailer.
3: -SERVER is the name of the outgoing mail server as an IP address or a standard URL.
4: -FROM specifies who is sending the email.
5: -TO is the recipient of the email. The recipient may also include friendly names which must be enclosed in double quotes.
6: -SUBJECT defines the subject of the outgoing email.
7: -ATTACH tells the auto mailer to attach the list of processes stored in text file by a batch script.
- Previous email integration (send web links with DOS email tool)
- Next email integration (configure automatic email confirmation with command line tool)
- Email integration 9 of 9
Return to origin
Please do not hesitate to contact our support department with any possible further questions or to solve practical issues connected with Command line email integration.