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.
---- 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
Reference : Pinal Dave (http://blog.SQLAuthority.com)




[...] 27th, 2007 by pinaldave In last month I received few emails emails regarding SQL SERVER – Enable xp_cmdshell using sp_configure. The questions are i) What is the usage of xp_cmdshell and 2) How to execute BAT file using [...]
Hi,
Well i tried the EXEC sp_configure ’show advanced options’, 1 command and it took a lot of time went over 15 mins so i am stopped it, am not sure that is it normal for it to take that long or i did something wrong, PLz let me know an average time taken by EXEC sp_configure command to execute on a 2005 SP1 test server which has almost no load at all.
thanks
Hello pinal
i m working on sql server 2005 …….can u tell me how to recover data when database is been crashed ………….tell me the steps to follow ….i m not able to restore a last transaction backup because databse is in emergency state…………………………..should i need to change anything in master……….please do let me know
thanx in adv…….
vaibhav Mathur
D.B.A
Thanks Sir,
It helped me a lot.
Hi i want to enable the xp_cmdshell on sql server 2000.
Please give me information if you can.
thanks a lot just for reading this!
Hi,
I am trying to run a batch file and using the following syntax:
EXECUTE master..xp_cmdshell ‘C:\AAT_PDF_Thumbnail_Generator\test.bat’
It does not show any error message and the query goes running. Please help me to figure out that where i am wrong.
And will u please tell me the steps regarding the Access rights to execute it with the user of the database. Although i have given the execute rights to the user and the same process is running fine in SQL 2000.
Thanks n Reagrds,
Vivek Rathore.
it is very helpfull to delete files from server through sql server.
thanks guys!.
Thanks and Regards
praveen
Thanks!
For security reasons, we do not want to enable xp_cmdshell. However, for other practical reasons, we want to use it for some jobs. My thought was to enable xp_cmdshell at the start of the job, and then disable it when the job completes. How much overhead does the reconfigure take? Also, do you know what would happen if one job does the disable while a second job is in the middle of using the xp_cmdshell? Would the second job err out or would the disabling/reconfiguring err out? I tried to test it, but I can’t seem to come up with a long-running job to test this out.
Hi, We need to disbale other extended sp. like
xp_regread, xp_regwrite, xp_regaddmultistring, xp_regdeletekey
Please help me how will do