Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Oracle/MSSQL/MySQL » How to verify whether the xp_cmdshell feature is enabled or disabled in MSSQL Server

How to verify whether the xp_cmdshell feature is enabled or disabled in MSSQL Server

Posted on 03/11/202303/11/2023 Christian By Christian No Comments on How to verify whether the xp_cmdshell feature is enabled or disabled in MSSQL Server
xp_cmdshell MSSQL

An SQL Server instance is a complete SQL server and you can install many instances on a machine but you can have only 1 default instance. It represents a separate and independent database environment that can store and manage data. In this article, I will teach you how to verify if the xp_cmdshell feature is enabled or disabled in MSSQL Server. Please see how to fix “There has been a runner system failure: failed to start the process exec “pwsh”, and how to fix “Unable to connect to MSSQL Server after changing the Server name“.

Recently, there was a question raised on the Veeam Community Forum “Does Veeam installation process enable xp_cmdshell under MSSQL?”. Having answered this question, I wanted to show you guys the steps to verify this.

Note: Veeam Backup & Replication typically does not enable the xp_cmdshell feature in Microsoft SQL Server during the installation process.

What is xp_cmdshell?

The xp_cmdshell is an SQL server extended stored procedure. It enables you to run command shell commands from within SQL Server. Please be aware that enabling it can introduce security risks.

This option is disabled by default. Also, to limit access to using xp_cmdshell only, members of the sysadmin server role have default rights.

Veeam Backup & Replication primarily interacts with SQL Server databases to manage its configurations and maintain records but does not enable or use xp_cmdshell. See the VBR Database for more information. If you are having concerns related to security reasons. Follow the steps below to verify!

Is xp_cmdshell Enabled?

To verify if “xp_cmdshell” is either enabled or disabled in SQL Server. Please follow the steps below. Please see How to uninstall Microsoft SQL Server on Windows, How to uninstall Microsoft SQL Server on Windows, and how to uninstall Microsoft SQL Server Management Studio.

Using SQL Server Management Studio (SSMS)

Open SQL Server Management Studio. as shown below

Launch-SSMS

Connect to the SQL Server instance where you want to check the xp_cmdshell configuration.

Connect to the MSSQL Instance

In the Object Explorer, expand the server node, right-click on the instance name and select FACETS as shown below.

Select MSSQL FACET

Here you will see a list of facets for various SQL Server features. Select Server Security.

MSSQL-Server-Security-Facet-1

You can find “xp_cmdshell” in the list.

If it’s set to “True,” it means the feature is enabled; if it’s set to “False,” it’s disabled.

Screenshot 2023-11-03 at 14.44.08

If you wish to enable it, please take all necessary precautions before doing so. To enable it, click on the property value and select True. Click on OK and apply.

Note: xp_cmdshell is a powerful feature and is disabled by default. xp_cmdshell can be enabled and disabled by using Policy-Based Management or by executing sp_configure.

Wnat-to-Enable-or-Disable-Xp_cmdshell
There is not a need to enable show advanced options or use reconfigure, the GUI takes care of this automatically.

What is T-SQL?

T-SQL is an extension of SQL. SQL is a programming language. T-SQL contains procedural programming and local variables, while SQL does not. T-SQL is proprietary, while SQL is an open format.

Enable or Disable XP_CMDSHELL via T-SQL

Determine the status of xp_cmdshell using T-SQL queries

You can also check the status of xp_cmdshell using T-SQL queries. Open a new query window in SSMS and run the following command:sqlCopy code

EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell'; 

The first command enables the display of advanced options, and the second command displays the status of xp_cmdshell.

New-Query

Look for the “config_value” column in the result. When it is 1, the feature is enabled. When it is 0, it is disabled.

configure xp_cmdshell

Configure xp_cmdshell

To enable or disable xp_cmdshell, you can use the following T-SQL commands:

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;

Disable xp_cmdshell

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 0;
RECONFIGURE;
After executing these commands, make sure to restart the SQL Server service for the changes to take effect.

It’s important to note that enabling xp_cmdshell can pose security risks as discussed above as it allows for command execution on the operating system from within SQL Server.

FAQs relating to xp_cmdshell Permissions

Why is “xp_cmdshell” disabled by default?

Malicious users oftentimes attempt to elevate their privileges by using xp_cmdshell.

What are some common use cases for xp_cmdshell in SQL Server?

While I advocate the use of xp_cmdshell with caution. There are legitimate use cases for it in SQL Server. Some common scenarios include:
– Running batch scripts for maintenance or data import/export tasks.
– Interacting with the operating system to perform backups or file manipulations.
– Automating administrative tasks.
– Integrating with external tools or processes that require command-line execution.

Conclusion on xp_cmdshell

However, this should not be a concern anymore, Veeam no longer installs SQLExpress during installation, but rather PostgreSQL by default. Therefore, I recommend checking the documentation or reaching out to Veeam support for the most up-to-date information regarding their software’s installation and configuration requirements.

I hope you found this post useful on how to verify if the xp_cmdshell feature is enabled or disabled in MSSQL. If you have any questions, please let me know in the comment session.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Oracle/MSSQL/MySQL Tags:Microsoft SQL, Microsoft Windows, MsSQL, Windows 10, Windows 11, Windows Server 2016

Post navigation

Previous Post: Fix a network-related or instance-specific error occurred while establishing a connection to SQL Server [Part 2]
Next Post: How to remove Norton from Mac using the RemoveNortonMacFiles tool

Related Posts

  • images 5 1
    How to access MySQL Server from command Prompt Oracle/MSSQL/MySQL
  • sql server
    Download and install MSSQL 2019 Express Edition and SSMS Oracle/MSSQL/MySQL
  • sql 1
    Editions of MSSQL Server: What are the differences between various Editions of Microsoft SQL Server Oracle/MSSQL/MySQL
  • no pg hba
    Resolve “no pg_hba.conf entry for host on PostgreSQL Oracle/MSSQL/MySQL
  • Uninstall SQL Server 2025
    Uninstall Microsoft SQL Server 2025 from Windows Oracle/MSSQL/MySQL
  • SQL Server Management Studio 1
    How to manually check and update SQL Server Management Studio Oracle/MSSQL/MySQL

More Related Articles

images 5 1 How to access MySQL Server from command Prompt Oracle/MSSQL/MySQL
sql server Download and install MSSQL 2019 Express Edition and SSMS Oracle/MSSQL/MySQL
sql 1 Editions of MSSQL Server: What are the differences between various Editions of Microsoft SQL Server Oracle/MSSQL/MySQL
no pg hba Resolve “no pg_hba.conf entry for host on PostgreSQL Oracle/MSSQL/MySQL
Uninstall SQL Server 2025 Uninstall Microsoft SQL Server 2025 from Windows Oracle/MSSQL/MySQL
SQL Server Management Studio 1 How to manually check and update SQL Server Management Studio Oracle/MSSQL/MySQL

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • esd convert wim 1280x720 1
    Differences between Capture image, Discover image, Install and Boot images Windows Server
  • OOTBI virtual appliance setup on Proxmox
    How to set up the OOTBI Virtual Appliance on Proxmox VE Backup
  • We cannot fine camera
    Fix we could not find a camera compatible with Windows Hello Face Windows
  • Featured image Chrome notification
    How to Disable Chrome Browser Notifications on Windows Windows
  • Fix Failed To Connect To The Backup Serve
    Fix failed to connect to the backup server: Make sure it is online Backup
  • fddd
    How to check the version of Windows ADK Windows
  • windows 10 creators
    Various methods on how to launch Windows Task Manager Windows
  • encrypt your Data with Trellix Data Encryption
    How to encrypt your system with Trellix Data Encryption Security | Vulnerability Scans and Assessment

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,808 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.