Retrieve and email Windows process list

A process is an application in execution. Each application on a Windows based computer has its own processes. 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.

For example, network administrator can ensure that a particular process is running on a server. The following example demonstrates how to create a batch file that will email a list of running processes at a given time. It will be scheduled so that it runs every hour.

Solution

Create a new task using the Windows Task Scheduler that runs the batch file every 1 hour.

@echo off

rem Gather a list of applications
tasklist >proclist.txt

rem Sending email with process list attached...
febootimail -SERVER mail.example.com -FROM server@sender.com -TO admin@example.com -SUBJECT List of requested server processes -ATTACH proclist.txt

rem Clean-up...
del proclist.txt >NUL

1: tasklist command retrieves a list of running processes, and stores it in the proclist.txt file.

2: febootimail sends list to Administrator.

3: SERVER sets outgoing mail server.

4: FROM specifies who is sending the email.

5: TO is the recipient of the email.

6: SUBJECT defines the subject of the message.

7: ATTACH adds the list of processes to the email.

This example shows basic concept on how to retrieve any application output and send it via email.

© 2001–2019 Febooti Ltd.