Using xp_cmdshell

5 pts.
Tags:
DataCenter
Desktops
Development
Hardware
Management
Microsoft Windows
OS
Security
Servers
SQL
SQL Server
Hi, I am using xp_cmdshell in one of my stored procedures(database SQL server) to delete older files from a folder in another server. That server is mapped as a network drive on the sql server computer. But when I used this drive inside xp_cmdshell command and do a dir , the output I get is 'Access is denied'. Then I used the UNC path . The same output I get Access denied. But I can always see the folders both thru the drive or the network from the start menu. Please help. Thanks in advance.

Answer Wiki

Thanks. We'll let you know when a new response is added.

This will be because the Windows Account which the SQL Server runs under doesn’t have access to the network share. You will need to grant access to the network share and then your command should run.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following