Script to see if SQLAgent is running

  • If you want to address only one element of the collection - it is like this:

    Set OneService = oWMIObjSet("\\ServerName\root\cimv2:Win32_Service.Name='SQLSERVERAGENT'")

    As you can see it is more simple to go with For Each ... Next even when you have only one element.

    Stanislav Petkov


    Stanislav Petkov

  • what is the correct command that can be  used to see if any SQLServer Service is running?

Viewing 2 posts - 16 through 16 (of 16 total)

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