In this post you will find:

1. How to schedule/Automate a batch file in Windows

2. How to use Tasklist.exe to get applications and services with their Process ID for all tasks running on either a local or a remote computer. [More Details]

3. How to redirect the output to file with different names.

If you want to find the processes running on local or remote computer along with memory consumption of each process then use tasklist command. You can find more details at

http://technet.microsoft.com/en-us/library/bb491010.aspx

You can find the processes and memory usage on remote computer using below command-

tasklist.exe /S <ip of remote computer> /U <username> /P <password>

Now if you want to check the processes and memory usage daily basis then you have to save the output to some file so that you can compare the memory usage daily basis. Use the below command to save the output to file with different names-

tasklist.exe /S <ip of remote computer> /U <username> /P <password>        >C:\xyz\a%date:~-10,2%%date:~-7,2%%date:~-4,4%.txt

This will create a file by name a19022013.txt in C:\xyz

You may find it tedious to execute this command daily and chances are that you may forget to run it. In that case you can create a batch file and schedule the task in Windows Scheduler to run it on specific time daily.

-Create a batch file and save the above command in it.

Now follow the screen below to schedule the job-

Invoke the Task Scheduler

image

Create New Task

image

Enter Job Name and set the other options

image

Click on Trigger tab to schedule the job

image

Click on Action tab and select the BAT file using browse button

image

You can set condition and settings if required or leave it default.

Press OK button. It may prompt for username and password to schedule the job.

Once the job is scheduled the job will be run as per schedule and output will be created in files of different names.