SQL Server Agent Service check | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

SQL Server Agent Service check

Hi – Can someone let me know if I can check if the SQL Server agent service is running, via a TSQL script or scheduled Windows job? If so, how? I can’t use Server monitoring software like BMC Patrol of HP Openview. Thanks
exec master.dbo.xp_servicecontrol ‘QueryState’, ‘SQLServerAgent’ MohammedU.
Thanks Mohammed That was really helpful, good to know a new thing Satya
Here is another way….
CREATE TABLE #temp(Srvc varchar(100)) INSERT #temp
EXEC master..xp-cmdshell ‘net start’ IF EXISTS(SELECT 1 FROM #temp WHERE Srvc like ‘%SQLAgent%’)
PRINT ‘SQLAgent Running…’
PRINT ‘SQLAgent NOT Running…’ MohammedU.