Blog Post

How to Enable / Disable Xp_cmdShell in SQL SERVER? TIP #82

,

Friends,

Sometimes it might be possible that you have to run dos command from SQL SERVER. In such situation you have to enable the xp_cmdShell option of  sql configuration.

To enable this we can write following statement

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

Just wanted to share that it can be a security thread as well.  So enabling the xp_cmdshell option might be sometime dangerous if we did not handle the SQL injections.

Now to disable this we can write following commands

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

We can enable / disable this by following steps as well (Below steps will work with SQL SERVER 2008 or higher version )

Step 1: Select facets  option by right clicking SQL database as shown below

Facet

Step 2:-  When you go with option one you will get a new screen. In that new screen select facet “Surface Area Configuration”

Surfacearea

Step 3:- Now all the advance option will be available of Surface area Configuration as shown in below figure you can enable disable Xp_CmdShell.

xp_cmd_shell

 

Thanks

RJ

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating