Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Posts
    22

    Unanswered: How do I see if remote SQL servers are running?

    I need to know if remote sql servers are running/ or be alerted when the stop.
    Any chance of doing so without additional software?

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    sc.exe can be used to monitor and control the state of any windows service.

    type sc /? at a command prompt for help.

  3. #3
    Join Date
    Sep 2009
    Posts
    2
    uses Tlhelp32;

    procedure TForm1.Button1Click(Sender: TObject);
    var
    ProcessList : Thandle;
    pe : TPROCESSENTRY32;
    ProcList : TStringList;
    i : integer;
    begin
    ProcList := TStringList.Create;
    try
    ProcessList := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    pe.dwSize := sizeof(TPROCESSENTRY32);
    if process32first(ProcessList,pe) then
    begin
    ProcList.Add(pe.szexefile);
    while process32next(ProcessList,pe) do
    ProcList.Add(pe.szexefile);
    end;
    for i := 0 to ProcList.Count -1 do
    if ProcList[i] = 'sqlservr.exe' then
    ShowMessage('SQL Server already Run!');
    finally
    ProcList.Free;
    end;
    end;



    Start command:

    scm -action 1 -slient 1 -service mssqlserver


    Stop command:
    scm -action 6 -slient 1 -service mssqlserver
    ________________

    Sabrina Gage
    www.Comm100.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •