I have a script to get the currently running jobs:
-- get the running jobs --marcelo miorelli -- 10-dec-2013 SELECT sj.name ,DATEDIFF(SECOND,aj.start_execution_date,GetDate()) AS Seconds FROM msdb..sysjobactivity aj JOIN msdb..sysjobs sj on sj.job_id = aj.job_id WHERE aj.stop_execution_date IS NULL -- job hasn't stopped running AND aj.start_execution_date IS NOT NULL -- job is currently running --AND sj.name = 'JobName' and not exists( -- make sure this is the most recent run select 1 from msdb..sysjobactivity new where new.job_id = aj.job_id and new.start_execution_date > aj.start_execution_date )
when I run that on my server it says that there is no job currently running, however, when I look at the Job Activity Monitor, I see the picture below.
The second step of this job, runs a powershell script using a proxy. you can see the second step here.
any reason why it would show the second step of my job as running? how can I fix it?