none
Checking if xp_cmdshell is enabled or not

    Question

  • Is it possible to check if xp_cmdshell is enabled on a server or not? (Using T-SQL*)
    How would you perform this check?
    Friday, May 02, 2008 3:42 PM

Answers

  • Is it possible to check if xp_cmdshell is enabled on a server or not? (Using T-SQL*)
    How would you perform this check?

    Lifted from the sys.sp_configure procedure this will tell you:

    SELECT CONVERT(INT, ISNULL(value, value_in_use)) AS config_value
    FROM  sys.configurations
    WHERE  name = 'xp_cmdshell' ;
    

    Make everything as simple as possible, but not simpler. --Albert Einstein
    Sunday, October 31, 2010 1:22 PM
  • Code Snippet

    USE master;
    GO
    EXEC sp_configure 'show advanced option', '1';


    RECONFIGURE WITH OVERRIDE;
    EXEC sp_configure;

     

     

    look at the run value for xp_cmdshell, should be the last row

     

    name minimum maximum config_value run_value
    xp_cmdshell 0 1 1 1

     

     

    Denis The SQL Menace

    http://sqlservercode.blogspot.com

    http://sqlblog.com/blogs/denis_gobo/default.aspx

    Friday, May 02, 2008 4:03 PM
    Moderator

All replies