Error starting or stopping sql agent jobserver using DMO

Discussion in 'Scripting' started by Jimbo, Sep 7, 2005.

  1. Jimbo

    Jimbo Guest

    I am trying to start the SQL Agent in a VB script using SQL-DMO.

    I get an error message when I try to stop the SQL Agent and the agent is not
    ERROR: 22003[Microsoft][ODBC SQL Server Driver][SQL Server]StartService()
    returned error 997, 'Overlapped I/O operation is in progress.'

    The server is running Windows Server 2003 with SQL Server 2000. SQL and the
    agent use a domain account with a non expiring password to start. I have
    administrative rights to the server and I'm running the script on the local
    machine using Remote Desktop Connection to the server.
    The Code I'm running is:
    SET oServer = CreateObject("SQLDMO.SQLServer2")
    oServer.LoginSecure = True 'NT authentication

    oServer.connect "<ComputerName>\<InstanceName>"
    Wscript.echo Err.number & Err.description

    wscript.echo oserver.jobserver.status
    Wscript.echo Err.number & Err.description

    The SQL service is definately running, and the agent is definately NOT
    running when I run this script. I get the same error when I'm trying to stop
    the agent as well. Do you know what might cause this error?


    Jimbo, Sep 7, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.