<%
set conn = CreateObject("ADODB.Connection")
conn.open "
sql = “EXEC master.dbo.xp_ServiceControl ‘QUERYSTATE’,’SQLServerAgent'”
set rs = conn.execute(sql)
if trim(rs(0)) <> “Running.” then
response.write “Starting SQL Server Agent…”
sql = “EXEC master.dbo.xp_ServiceControl ‘START’, ‘SQLServerAgent'”
conn.execute(sql)
else
response.write “SQL Server Agent already started…”
end if
conn.close
set conn = nothing
%>