xp_cmdshell doesn’t stop running on excuting vbscript

  • When I launch this vbscript (shown below) with xp_cmdshell in Server Management Studio, the script (which is on another machine) is executed fine, however the xp_cmdshell doesn’t stop running

    This is my code:

    EXEC xp_cmdshell '\\xxx.xxx.xxx.xxx\vbscript\myvbscript.vbs "my_first_variable" "my_second_variable"'

    When I do a “sp_who” I get status: runnable and cmd: EXECUTE on this process.

    First what am I doing wrong. The script isn’t returning anything (It’s actually launching a bulk emailing)

    Second, how can I kill this process? Do I have to restart my SQL server?

    Thank you

  • Most likely the script has thrown an exception and it needs action (like clicking on Ok). Try running the script in command prompt under the context of the SQL Server service account and see if you get any errors.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • You can kill the process by using the KILL <SPID> command. And do what Pradeep suggested. Look at the command in a command line utility to make sure what sorts of output you're getting (though I'd recommend testing with a smaller email list).

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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