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

  • Screenshot 2021 02 01 at 12.25.27
    How to import a MySQL Database via the command line Oracle/MSSQL/MySQL
  • Enale FIPS compliance mode on Windows
    How to enable FIPS mode on Windows Server Oracle/MSSQL/MySQL
  • sql server installation
    How to Install all Editions of Microsoft SQL Server 2025 Oracle/MSSQL/MySQL
  • Configure SQL Server to listen on a specific TCP port
    Configure SQL Server Instance to listen on a specific TCP Port Oracle/MSSQL/MySQL
  • Encryption
    How to encrypt Microsoft SQL Server Traffic Oracle/MSSQL/MySQL
  • mssql
    Fix MSSQL Connection timeout and timeout period expired Oracle/MSSQL/MySQL

More Related Articles

Screenshot 2021 02 01 at 12.25.27 How to import a MySQL Database via the command line Oracle/MSSQL/MySQL
Enale FIPS compliance mode on Windows How to enable FIPS mode on Windows Server Oracle/MSSQL/MySQL
sql server installation How to Install all Editions of Microsoft SQL Server 2025 Oracle/MSSQL/MySQL
Configure SQL Server to listen on a specific TCP port Configure SQL Server Instance to listen on a specific TCP Port Oracle/MSSQL/MySQL
Encryption How to encrypt Microsoft SQL Server Traffic Oracle/MSSQL/MySQL
mssql Fix MSSQL Connection timeout and timeout period expired 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

  • screenshot 2020 03 13 at 21.22.29
    How to determine Cygwin version Windows Server
  • sandboxx
    Use Windows Sandbox as a security feature Virtualization
  • powershell auto run
    How to pause a PowerShell script Windows
  • ClamAV
    How to install and manage ClamAV and ClamTK on Ubuntu Linux Anti-Virus Solution
  • banner 1
    Deploying Next.Js App Using Heroku Cloud Application Platform Version Control System
  • credentialguard
    Enable or disable Windows Defender Credential Guard Security | Vulnerability Scans and Assessment
  • ReasonsforBitLockerRecovery
    Reasons for BitLocker Recovery Prompt: Query the number of BitLocker recovery request Windows
  • Install and configure wds 1
    Install Windows Deployment Services on Windows Server 2022 Windows Server

Subscribe to Blog via Email

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

Join 1,817 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

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

Copyright © 2025 TechDirectArchive