enable/disable xp_cmdshell before/after Windows schedule task

  • HI,

    Sql sever 2005 Express edition

    We have a Windows schedule task (.bat file + SQLCMD + stored-proc). We would like to enable xp_cmdshell just before this Windows schedule task and disable xp_cmdshell immediately after this Windows schedule task. How can we do it ?

    Thank you

    Calico (MCP, MCTS)

  • Simple check in Books OnLine does it... 😉 Past the following into the URL box of the help system.

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/c147c9e1-b81d-49c8-b800-3019f4d86a13.htm

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi,

    With SQL Server 2005 Expresse Edition CMDSHELL can be enable / disable with sp_configure or with surface area.

    I ask this question because I dont want to manually enable and disable CMDSHELL every night via surface area. Also I cannot put the sp_configure into our SP because our SP cannot be STARTED via Windows Sceduker task, if CMDSHELL has not been enable BEFORE.

    With SQL Server 2005 Expresse Edition and Windows Sceduker task, for security best practice, how can we enable /disable CMDSHELL just before / after a SP that is started via Windows Sceduker task ?

    Thank you

    calico (MCP MCTS)

  • As Jeff's link pointed out, you can easily script the enabling and disabling of xp_cmdshell;

    if you had checked BOL before posting a question here, you'd have found it yourself, and not had to wait 8 or so hours:

    here's the details from ms's msdn site;http://msdn.microsoft.com/en-us/library/ms190693.aspx

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • calico-604598 (12/20/2009)


    Hi,

    With SQL Server 2005 Expresse Edition CMDSHELL can be enable / disable with sp_configure or with surface area.

    I ask this question because I dont want to manually enable and disable CMDSHELL every night via surface area. Also I cannot put the sp_configure into our SP because our SP cannot be STARTED via Windows Sceduker task, if CMDSHELL has not been enable BEFORE.

    With SQL Server 2005 Expresse Edition and Windows Sceduker task, for security best practice, how can we enable /disable CMDSHELL just before / after a SP that is started via Windows Sceduker task ?

    Thank you

    calico (MCP MCTS)

    Remove the "GO"s from the script in the links both Lowell and I have provided. It'll work just fine.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thank you !

    I tried it and it works.

    Calico (MCP MCTS)

Viewing 6 posts - 1 through 5 (of 5 total)

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