SQL SERVER – Enable xp_cmdshell using sp_configure

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

They good old backdoor called xp_cmdshell is – and that’s absolutely ok – disabled by default starting Microsoft SQL Server 2000+. To re-enable that feature, there’s a stored procedure available called sp_configure. Logo_Ms_SQL

if you receive the following message, read on..

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.

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Start a SSMS (Microsoft SQL Server Management Studio), open a New Query Window and do the following:

Paste this and execute it using F5

EXEC sp_configure 'show advanced options', 1
  GO 
 
RECONFIGURE
  GO 
 
EXEC sp_configure 'xp_cmdshell', 0
  GO 
 
RECONFIGURE
  GO

to check if it’s configured properly, use this extended stored procedure:

xp_cmdshell 'dir *.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.