SQLServer 2017 exec xp_cmdshell 'dir Y:\*.*/s' command fails


Joined
Feb 21, 2018
Messages
196
Reaction score
79
Humble Greetings to All,

I executed the following command successfully
exec xp_cmdshell 'dir D:\*.*/s'

But this command failed when I made the following amendment
exec xp_cmdshell 'dir Y:\*.*/s'

Y: Drive is a network drive (Mapped) to which I am connected.
The error Message says:
The system cannot find the path specified.

Please Help!
 
Ad

Advertisements

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,153
Reaction score
1,084
If you're in the command prompt, can you interact with the mapped drive as you would expect? Does something as simple as "y:" let you access the mapped drive there?

I've occasionally seen it where I can access a mapped drive in explorer, but not from the command prompt. I'd be interested to see if that's possible as a regular user and in an elevated admin command prompt. It might gives some clues as to where the problem is.
 
Joined
Feb 21, 2018
Messages
196
Reaction score
79
Thank you Ian, I checked and as you can see the dos prompt Y:> is successful but SQL Server System cannot find the specified path.
I think I must be missing some (granting) commands which allows exec xp_cmdshell reach a mapped network drive.

1571890823779.png
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top