Tooltip of the month Part 2 Enable cmdshell

This is a small tutorial how to enable CMDShell in SQL Server.

In version SQL 2005 xp-cmdshell is turned off by default.

To enable xp-cmdshell there are 2 ways of doing so: sp_configure command or the Surface Area Configuration tool, to use sp_configure run the following script in Mgmt Studio:
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure 'xp-cmdshell', 1
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure 'show advanced options', 0 *

or use the Surface Area Configuration tool

Start -> Programs --> select the Microsoft SQL Server 2005 program group and fire up the Surface Area Configuration tool (SQL Server 2005 Configuration Tools)

Now, click on xp-cmdshell in the tree menu at the left and then click on "Enable xp-cmdshell" and click "Apply." Xp-cmdshell is now enabled.

To determine the Windows account use xp_cmdshell 'whoami.exe'

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.