Complete a Server Assessment – Currently Running Jobs

Below you will find the code to find the currently running jobs.  Simply select the text and copy to the Clipboard.

–Code of Source:

, j.enabled
, ja.run_Requested_Date
, ja.session_id
, ja.start_execution_date
, j.description
, js.command

FROM msdb.dbo.sysjobactivity ja
LEFT JOIN msdb.dbo.sysjobhistory jh
ON ja.job_history_id = jh.instance_id
JOIN msdb.dbo.sysjobs j
ON ja.job_id = j.job_id
JOIN msdb.dbo.sysjobsteps js
ON ja.job_id = js.job_id
AND ISNULL(ja.last_executed_step_id,0)+1 = js.step_id
WHERE ja.session_id = (SELECT TOP 1 session_id
FROM msdb.dbo.syssessions
ORDER BY agent_start_date DESC)
AND start_execution_date is not null
AND stop_execution_date is null;