Tuesday, December 11, 2012

How do I enable xp_cmdshell?

How do I enable xp_cmdshell?

Xp_cmdshell is extended stored procedure, with help of this one can execute any kind of Dos commands. Usage of this are:   directory listing, creating folders, copy files….
DBA should limit grating this access to users otherwise there is a chance of misutilization and thats why most of the companies disable it for security reasons.
This is a server level option which comes up with Surface Area Configuration, by default xp_cmdshell is disabled on SQLServer. You can enable it by running following query.

USE MASTER
GO
EXEC sp_configure 'show advanced options', 1
GO

RECONFIGURE
GO

EXEC sp_configure 'xp_cmdshell', 1
GO

RECONFIGURE
GO

You can also enable it through SSMS:
  1. Connect to SQLServer through SSMS
  2. Right click on SQLServer and go to Properties
  3. Click on Facets
  4. On view Facets page select Surface Area Configuration from drop down list
  5. Got to XPCmdShellEnabled property and type “True” and click ok.


No comments:

Post a Comment