How can I check if a remote server is started

  • Hi,

    Within a stored proc I need to check if the MSSQLServer service is started on a remote server before trying to connect and thus receiving an error message. Any ideas?

    Cheers.

  • Within T-SQL, I would get a sev 16 error and that would be all she wrote. I ended up putting ADO code in a DTS package. That's one option.

    Another option is if you have access to xp_cmdshell (be aware of the security consequences). You can use a tool like pslist to check to see if a particular process is present and parse the output coming back from xp_cmdshell.

    K. Brian Kelley

    http://www.truthsolutions.com/

    Author: Start to Finish Guide to SQL Server Performance Monitoring

    http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1

    K. Brian Kelley
    @kbriankelley

  • quote:


    Another option is if you have access to xp_cmdshell (be aware of the security consequences). You can use a tool like pslist to check to see if a particular process is present and parse the output coming back from xp_cmdshell.


    Another option that goes into the same direction (www.sysinternals.com) as Brian mentioned is psservice.

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Yup, that's true. Go with Frank's suggestion if you're going down the xp_cmdshell route. Since both SQL Server and SQL Server Agent are services, psservice is the better option over pslist.

    K. Brian Kelley

    http://www.truthsolutions.com/

    Author: Start to Finish Guide to SQL Server Performance Monitoring

    http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1

    K. Brian Kelley
    @kbriankelley

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply