We help IT Professionals succeed at work.
Get Started

xp_cmdshell - Access is Denied

T Hoecherl
T Hoecherl asked
on
2,864 Views
Last Modified: 2016-02-09
A stored procedure includes the following code:

declare @cmdstring varchar(1000)
set @cmdstring = 'move C:\software\test.xlsx C:\Software\MovedTest.xlsx'
exec master..xp_cmdshell @cmdstring

This has worked for a few years, but everything was recently moved to a new SQL Server.  Now when I try to run this code I get this result:

output
Access is denied.
        0 file(s) moved.
NULL

I have done the following:

1.  Make sure I am logged in to SSMS as an administrator.
2.  Enable xp_cmdshell on the server
3.  Create a proxy account and credential
4.  Grant security to xp_cmdshell for my user and for the proxy user
5.  Ensure that my user and the proxy user both have write permissions to the folders involved in the move process

What else must I do to be able to use xp_cmdshell?

T
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE