How to log a process/application start/exit in event viewer?
Since you are using Windows 7 you could consider using a PowerShell Cmdlet for this: write-eventlog -computername Server01 -logname Application -source MyApp -eventID 3001 -message "MyApp added a user-requested feature to the display." For more information have a look here: http://technet.microsoft.com/en-us/library/dd347687.aspx You could execute the PowerShell command from batch by calling PowerShell.exe to execute the Cmdlet.
April 19th, 2012 7:26am

I was wondering how to log a process/application start/exit in event viewer? I know services are logged but applications are not. I need to run a program (or a batch file) after another program/process has been closed. I have so far concluded that you should log the process in event viewer/application log and then it would be easy to create a task for the batch file to run based on log id. An alternative I already use is a batch file / task that runs every say, 10 minutes and checks if a process is running; if it is it runs something, if it isn't it runs something else: tasklist /FI "IMAGENAME eq xbmc.exe" | find /i "xbmc.exe" rem echo %errorlevel% if not errorlevel 1 goto progon : progoff run command : progon run different command But this doesn't work in my case because I want to run the batch file only *once* after the process has stopped - the above solution runs it multiple times, ie every 10 minutes. I was wondering if someone from the forum has found any answer to this. I haven't posted in the answers forum (too general) but I'm not a programmer either, apart from being able to work with batch files...
Free Windows Admin Tool Kit Click here and download it now
April 19th, 2012 10:09pm

Since you are using Windows 7 you could consider using a PowerShell Cmdlet for this: write-eventlog -computername Server01 -logname Application -source MyApp -eventID 3001 -message "MyApp added a user-requested feature to the display." For more information have a look here: http://technet.microsoft.com/en-us/library/dd347687.aspx You could execute the PowerShell command from batch by calling PowerShell.exe to execute the Cmdlet.
April 20th, 2012 12:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics