The configuration option ‘xp_cmdshell’ does not exist or it may be an advanced option

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
sql the configuration option 'xp_cmdshell' does not exist or it may be an advanced option
The configuration option ‘xp_cmdshell’ does not exist or it may be an advanced option

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:

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.