Monday, August 12, 2013

How to enable xp_cmdshell in SQL Server


Xp_cmdshell is an extended stored procedure that provides an environment analogous to a Windows command shell and passes in a string for execution. Any output is returned as rows of text. By using xp_ cmdshell, we can run many Window/DOS commands in SQL Server environment. Some of the common DOS commands that can be run through xp_cmdshell are COPY, MOVE, and RENAME etc. Use the below script to enable xp_cmdshell extended stored procedure:

EXEC MASTER.dbo.SP_CONFIGURE 'show advanced options', 1
RECONFIGURE

EXEC MASTER.dbo.SP_CONFIGURE 'xp_cmdshell', 1
RECONFIGURE

 
 

No comments:

Post a Comment