15281 SQL Origin: Data OSI layer 7 · Application Last updated 18 Nov 2026

SQL Server Msg 15281: SQL Server blocked access to procedure 'sys.xp_cmdshell' (component 'xp_cmdshell' turned off)

xp_cmdshell is disabled by default for security, so the call is refused.

Exact message you may see SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned offxp_cmdshell is turned off as part of the security configurationsp_configure xp_cmdshell
Seen on: SQL Server Windows

Meaning

Enable it only if you must (sp_configure 'show advanced options', then xp_cmdshell), restrict who can run it, or better, avoid it: use SQL Agent job steps, SSIS, PowerShell or an application layer instead. Msg 15281 also applies to Ole Automation and other surface-area options.

Common causes

  • xp_cmdshell disabled (default)
  • Surface area configuration
  • Needed for file/OS operations
  • Proxy account not configured
  • Security hardening policy

⚡ Quick fix

  1. Prefer SQL Agent/PowerShell instead
  2. Enable only if justified with sp_configure
  3. Restrict permissions and audit usage

Detailed fix by platform

SQL

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

How to diagnose

  1. Option — Disabled?
  2. Alternative — Agent job?
  3. Access — Restricted?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

0x800704EC — 0x800704EC: This program is blocked by group policy (Windows Defender) (Windows)0x800704EC18456 — SQL Server: Login failed for user 'x'. (Error 18456) (SQL)18456209 — SQL Server Msg 209: Ambiguous column name (SQL)209229 — SQL Server Msg 229: The SELECT permission was denied on the object (SQL)2294060 — SQL Server Error 4060: Cannot open database requested by the login. The login failed (SQL)40605123 — SQL Server Msg 5123: CREATE FILE encountered operating system error 5 (Access is denied) while attempting to open the physical file (SQL)5123515 — SQL Server Msg 515: Cannot insert the value NULL into column 'X', table 'Y'; column does not allow nulls (SQL)5157399 — SQL Server Msg 7399: OLE DB provider reported an error — linked server query failed (SQL)739915281

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.