Turning xp_cmdshell on in Microsoft SQL Server
Dec 12

No it’s not Linux related, but it’s something I came across in my job today. I needed to be able to use xp_cmdshell to have SQL Server execute a dos command, but that command is turned off by default (for security reasons).

Open up Query Browser or MS SQL Server Management Studio and log in as SA or another privledged user. Open a new query. Run

sp_configure

Then scroll all the way to the bottom, if xp_cmdshell is there, then skip these 2 steps, otherwise run

sp_configure show_advanced_options, 1
reconfigure with override

Now run the following commands

exec sp_configure xp_cmdshell, 1
reconfigure with override

Now you can use xp_cmdshell in all your scripts