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.
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 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
- Prefer SQL Agent/PowerShell instead
- Enable only if justified with
sp_configure - Restrict permissions and audit usage
Detailed fix by platform
SQL
- sql
EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
How to diagnose
- Option — Disabled?
- Alternative — Agent job?
- 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:
Similar errors
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 18 Nov 2026