enable xp_cmdshell...SQL Server 2005

In order to determine if xp_cmdshell is enabled there are a few ways to go about it. The quickest way for me is to run the following in a query window:

xp_cmdshell 'echo hello world'

If you see Hello World in the output then xp_cmdshell is enabled and you are good to go.



However, if received the following error:

"Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online. "


that means xp_cmdshell is not enabled! So let's enable it! There are a few ways to do it...

A. Run a sql statement

  1. EXEC sp_configure 'show advanced options', 1
  2. RECONFIGURE
  3. EXEC sp_configure 'xp_cmdshell', 1
  4. RECONFIGURE


B. Use the GUI

  1. Open SQL Server Surface Area Configuration
  2. Click on Surface Area Configuration for Features



  3. Click on xp_cmdshell


  4. Check Enable xp_cmdshell

  5. Click OK

0 comments: