In this post, I am sharing a script to check, enable and disable XP_CMDSHELL on the SQL Server.
This script is very useful for those professional, Who are interested in using command line utilities with SQL Server.
If you want to use command line tool, you should enable this XP_CMDSHELL configuration.
First, Check XP_CMDSHELL is enabled on the server:
SELECT CONVERT(INT, ISNULL(value, value_in_use)) AS ConfigValue
WHERE name = 'xp_cmdshell' ;
Script to enable and disable XP_CMDSHELL:
-- Enable advanced options to be changed.
EXEC SP_CONFIGURE 'show advanced options', 1
-- Enable xp_cmdshell option.
EXEC SP_CONFIGURE N'xp_cmdshell', 1
-- Disable xp_cmdshell option.
EXEC SP_CONFIGURE 'xp_cmdshell', 0
-- Disable advanced options to be changed.
EXEC SP_CONFIGURE 'show advanced options', 0
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.