How to identify terminated Windows process if I still have its PID?
Are there some Windows logs containing association of PID to running process
By default there are no such logs. However you can enable Process Tracking Events in the Windows Security Event Log.
Notes:
The solution requires making changes to the Group Policy using
gpedit
.Unfortunately the Group Policy Editor (gpedit) is not included with the Starter Edition, Home and Home Premium editions of Windows.
See my Q&A Windows Starter Edition, Home and Home Premium do not include gpedit, how do I install it? for instructions on how to install it.
How to Use Process Tracking Events in the Windows Security Log
In Windows 2003/XP you get these events by simply enabling the Process Tracking audit policy.
In Windows 7/2008+ you need to enable the Audit Process Creation and, optionally, the Audit Process Termination subcategories which you’ll find under Advanced Audit Policy Configuration in group policy objects.
These events are incredibly valuable because they give a comprehensive audit trail of every time any executable on the system is started as a process. You can even determine how long the process ran by linking the process creation event to the process termination event using the Process ID found in both events. Examples of both events are shown below.
Source How to Use Process Tracking Events in the Windows Security Log
How to enable Audit Process Creation
Run gpedit.msc
Select "Windows Settings" > "Security Settings" > "Local Policies" > "Audit Policy"
Right click "Audit process tracking" and select "Properties"
Check "Success" and click "OK"
What is Audit Process Tracking
This security setting determines whether the OS audits process-related events such as process creation, process termination, handle duplication, and indirect object access.
If this policy setting is defined, the administrator can specify whether to audit only successes, only failures, both successes and failures, or to not audit these events at all (i.e. neither successes nor failures).
If Success auditing is enabled, an audit entry is generated each time the OS performs one of these process-related activities.
If Failure auditing is enabled, an audit entry is generated each time the OS fails to perform one of these activities.
Default: No auditing
Important: For more control over auditing policies, use the settings in the Advanced Audit Policy Configuration node. For more information about Advanced Audit Policy Configuration, see http://go.microsoft.com/fwlink/?LinkId=140969.
The only way to see is you must have the audit enabled to track the creation of processes.
From the "Local Security Policy" program (Type secpol.msc
from the run screen if you are having trouble finding it) go to "Security Settings -> Local Polices -> Audit Policy" then enable the "Audit process tracking" for "Success".
Once you do that go to the event viewer and check the "Secruity" event log, in there you will see "Audit Success" entries for every time a process is started or ended.
A process has exited. Subject: Security ID: SYSTEM Account Name: SCOTT-PC$ Account Domain: WORKGROUP Logon ID: 0x3E7 Process Information: Process ID: 0x1338 Process Name: C:\Windows\System32\consent.exe Exit Status: 0x0
You will need to convert the Process ID you are looking for from decimal into hex (3336 becomes 0xD08). The easiest way to convert is open windows calculator, go to "Programmer" mode, enter the number in "dec" mode, then click on "hex" mode. The number displayed will be converted to hex for you.