Welcome to SqlAdvice Sign in | Join | Help

Enable XP_CMDSHELL in SQL Server 2005

I needed to use xp_cmdshell recently and discovered that it isn't on by default on SQL Server 2005.  I had to dig a bit to find out how to enable it.  The code is very simple.  Figured I would blog it here so I can easily find it next time.

 

EXECUTE sp_configure 'show advanced options', 1 RECONFIGURE WITH OVERRIDE GO EXECUTE sp_configure 'xp_cmdshell', '1' RECONFIGURE WITH OVERRIDE GO EXECUTE sp_configure 'show advanced options', 0 RECONFIGURE WITH OVERRIDE GO
Sponsor
Published Thursday, September 27, 2007 7:54 AM by gstark

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Thursday, September 27, 2007 8:11 AM by Gregg Stark on SQL Server

# Archive and Compress Data from SQL Server

I recently blogged about deleting off data from a table by looping through one day at a time. Strangely

Tuesday, October 14, 2008 3:17 AM by Yordan Georgiev

# re: Enable XP_CMDSHELL in SQL Server 2005

-- THANKS HERE SMALL improvement for verbosity ...

-- configure verbose mode temporarily

EXECUTE sp_configure 'show advanced options', 1

RECONFIGURE WITH OVERRIDE

GO

--ENABLE xp_cmdshell

EXECUTE sp_configure 'xp_cmdshell', '1'

RECONFIGURE WITH OVERRIDE

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

-- SHOW THE CONFIGURATION

EXEC SP_CONFIGURE;

--turn show advance options off

GO

EXECUTE sp_configure 'show advanced options', 0

RECONFIGURE WITH OVERRIDE

GO

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below