Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2007
    Location
    Weatherford TX (Between Fort Worth and Abilene)
    Posts
    57

    Unanswered: CmdExec Job Step in Sql Server2000

    Thanks for the invitation to post a question, so I will post one.

    I need to create a job step that uses cmdExec.

    This is the command line I entering:
    D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingNo nLogouts.exe

    When I run this job the job fails. When I look at the job history, the only information I get is the date and time, user that ran the job and the fact that it failed. I haven't been able to get any CmdExec job to run at all. Can anyone tell me what I'm doing wrong?

    Facts.
    1. This exact same command is used by my network administrator using windows scheduler on the server. The only reason he wants me to create an sql server job is because it's mostly sql functions.
    2. I know the Sql Server agent is running, because I have other jobs that are run.
    3. I have verified that I have permission to run the file because I can go to the actual directory and run the exe.
    4. Do I need to enclose my command in quotes i.e. “D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingN onLogouts.exe”
    5. the path of the file I need to run is the path on the server and not the path on my local machine.

    If you need any other information, please let me know
    Thanks for you help
    GEM

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    you should post the code.

    cmdexec requires that the security account executing job have sysadmin permissions.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Apr 2007
    Location
    Weatherford TX (Between Fort Worth and Abilene)
    Posts
    57
    I wish I knew what code you mean me to post

    This is a job I created using enterprise manager to create the job.
    1. I entered the Job Name: UpdateEmployeeLogins
    2. Job type: Operation System Command (CmdExec)
    3. Command: D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingNo nLogouts.exe

    I did all this through Enterprise Manager. What code do you want me to post?

    Thanks
    GEM

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    change the command type to t-sql and try this...

    EXEC xp_cmdshell 'D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingN o nLogouts.exe'
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Apr 2007
    Location
    Weatherford TX (Between Fort Worth and Abilene)
    Posts
    57
    I did as you suggested and but the same result. I then ran that command line with query analyzer and got an "Access Denied" Error so that means I must have a problem somewhere with permissions. This doesn't make a whole lot of sense since I can the exe when clicking on it. I will have to get with out network administrator who's not available right now.

    Your help was excellent, I hope you'll be around later to help me with this if I need it.

    Thanks
    GEM

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    see my 1st post.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by gem1204
    This is a job I created using enterprise manager to create the job.
    1. I entered the Job Name: UpdateEmployeeLogins
    2. Job type: Operation System Command (CmdExec)
    3. Command: D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingNo nLogouts.exe
    This method should work. It should not be necessary to use xp_cmdshell in your job.
    As Thrassy stated, this is likely due to a permissions issue regarding the account that the SQL Agent service is running under.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  8. #8
    Join Date
    Aug 2007
    Posts
    1
    As everyone else said, make sure that the account executing the command under the SQL service privileges has the appropriate access to the executable. I bet if you look under NTFS security on the target .exe you'll find the problem.

Posting Permissions

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