In this sql server tutorial, we will discuss how to fix the error message “Msg 15123: The configuration option ‘xp_cmdshell’ does not exist, or it may be an advanced option.“
sql the configuration option ‘xp_cmdshell’ does not exist or it may be an advanced option
Recently, when I was working with SQL Server 2019, I faced this error. I was trying to create a folder in the local file system with the help of SQL Server. I was trying to use the xp_cmdshell system-defined stored procedure.
I found that as a security configuration, the xp_cmdshell is turned off by default and we have to turn it on to use it. When I tried to turn it ON, I faced the following error:
USE master
GO
sp_configure 'xp_cmdshell', '1'
RECONFIGURE
GO

Solution
The problem was that the xp_cmdshell is an advanced option. If we want to use this option, we need to enable the Show Advanced Options. After understanding the problem I wrote the following SQL code to turn on the Show Advanced Options and the xp_cmdshell option.
USE master
GO
sp_configure 'show advanced options', '1'
RECONFIGURE
GO
sp_configure 'xp_cmdshell', '1'
RECONFIGURE
GO
After executing the above query I did not face this error. Also, I was able to create the folder in the local file system using this xp_cmdshell.
You may also like the following SQL server tutorials:
- SQL Server stored procedure return value
- SQL Server drop table if exists
- SQL Server convert integer to string
- Exception Handling in SQL Server
- Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements
- Error: 40 – could not open a connection to sql server
- SQL Server blocked access to procedure ‘sys.xp_cmdshell’ of component ‘xp_cmdshell’
In this tutorial, we learned how to fix the error, sql the configuration option ‘xp_cmdshell’ does not exist or it may be an advanced option.
After working for more than 15 years in the Software field, especially in Microsoft technologies, I have decided to share my expert knowledge of SQL Server. Check out all the SQL Server and related database tutorials I have shared here. Most of the readers are from countries like the United States of America, the United Kingdom, New Zealand, Australia, Canada, etc. I am also a Microsoft MVP. Check out more here.