Wednesday, May 7, 2008

Check If xp_cmdshell is enabled on SQL Server 2005

How do you check from Transact SQL if xp_cmdshell has been enabled on SQL Server 2005?

Run the following code

USE master;

EXEC SP_CONFIGURE 'show advanced option', '1';


You will see a long list but the one you want to check is at the bottom

name minimum maximum config_value run_value
xp_cmdshell 0 1 1 1

here is the complete list

Ad Hoc Distributed Queries
affinity I/O mask
affinity mask
Agent XPs
allow updates
awe enabled
blocked process threshold
c2 audit mode
clr enabled
common criteria compliance enabled
cost threshold for parallelism
cross db ownership chaining
cursor threshold
Database Mail XPs
default full-text language
default language
default trace enabled
disallow results from triggers
fill factor (%)
ft crawl bandwidth (max)
ft crawl bandwidth (min)
ft notify bandwidth (max)
ft notify bandwidth (min)
index create memory (KB)
in-doubt xact resolution
lightweight pooling
max degree of parallelism
max full-text crawl range
max server memory (MB)
max text repl size (B)
max worker threads
media retention
min memory per query (KB)
min server memory (MB)
nested triggers
network packet size (B)
Ole Automation Procedures
open objects
PH timeout (s)
precompute rank
priority boost
query governor cost limit
query wait (s)
recovery interval (min)
remote access
remote admin connections
remote login timeout (s)
remote proc trans
remote query timeout (s)
Replication XPs
scan for startup procs
server trigger recursion
set working set size
show advanced options
SQL Mail XPs
transform noise words
two digit year cutoff
user connections
user options
Web Assistant Procedures

When using sp_configure to change a setting, use the RECONFIGURE WITH OVERRIDE statement for the change to take immediate effect. Otherwise, the change takes effect after SQL Server is restarted.

No comments: