To identify running jobs in a remote server we can use sphelpjob command in the following way.
--Content of sqlQuery.sql exec msdb.dbo.sp_help_job @execution_status = 0 --Main Code to execute. sqlcmd.exe -S<servername> -U<username> -P<password> -dmsdb -h-1 -b -i sqlQuery.sql
Published under: SQL Server Tips · · · ·