SQL SERVER – Enable xp_cmdshell using sp_configure

The xp_cmdshell option is a server configuration option that enables system administrators to control whether the xp_cmdshell extended stored procedure can be executed on a system.

SQL SERVER - Enable xp_cmdshell using sp_configure xp_cmdshell

Here is the code which is displayed in the code above. You can run it in your SQL Server Management Studio (SSMS).

---- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
---- To update the currently configured value for advanced options.
RECONFIGURE
GO
---- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
---- To update the currently configured value for this feature.
RECONFIGURE
GO

Honestly, now a days there is not much need of this particular command. I have seen lots of people using powershell to do many different tasks. However, there was a time when Powershell did not exist and we had to do lots of tasks with the help of the command shell.

Though, I have never learned Powershell or command prompt language personally, I have some knowledge of this subject from my database administration experience. I have learned as much as powershell as much as I need in my daily use.

Have you ever enabled this command to accomplish your tasks? If yes, would you please leave a comment here with your experience.

Reference: Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

Powershell, SQL Advanced Option, SQL Scripts, SQL Server, SQL Server Security, SQL Stored Procedure, SQL Utility
Previous Post
SQL SERVER – 2005 – DBCC ROWLOCK – Deprecated
Next Post
SQL SERVER – Difference Between Unique Index vs Unique Constraint

Related Posts

Leave a Reply