SQL Agent CmdExec foreground vs. background

  • Does anybody know how to change the way CmdExec runs a program. I have seen SQL Agent do it both ways so strongly believe there is a setting somewhere to do it. What I mean by both ways is as follows:

    1. Create a job & step from sql agent to simply launch notepad.exe.

    In one instance of sql I have seen it actually launch the program in foreground and the job will continue until you simply close notepad.

    In another instance of sql I have seen it only launch notepad.exe in background and you can only see or terminate the thread by opening task manager.

    Any help on this would be greatly appreciated.

  • I found my answer if anybody else is interested. In the Sql-Agent service within control panel, there is a setting for allowing the service to interact with the desktop. If you chose to use it however the Sql-Agent has to run under the local account.

  • thanks for the followup.

    You can also do a "start notepad.exe" to spawn the process.

    Steve Jones

    steve@dkranch.net

  • Hi...

    I have same Issue....

    Scenario is:

    I have an SSIS package which runs macro. Macro opens ie, pull data and create files. And those files again read by SSIS. This all works fine in BIDS or Visual Studio.

    Now I deployed that package in initial catalog. And create a SQL Agent job. Now excel and ie opens in background due to that Macro is unable to fetch URL. Hence my job does not finish and keep running .

    will you please suggest on this?

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

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