Showing posts with label xp_cmdshell. Show all posts
Showing posts with label xp_cmdshell. Show all posts

Saturday, February 25, 2012

accing to shered volumes

Roy Goldhammer wrote:
> Hello there
> I have local hard drive, which i can easy run xp_cmdshell 'dir c:'
> On the same computer i have shered Z: volume which is hard drive on anothe
r
> server
> How can i get list of all files on z by using xp_cmdshell 'dir z:' ?
>
xp_cmdshell '\\servername\sharename'
The mapping to drive Z: only exists under your login, not under the
login that the SQL Server service runs under. You also need to make
sure that the SQL Server service account has access to the share.Hello there
I have local hard drive, which i can easy run xp_cmdshell 'dir c:\'
On the same computer i have shered Z: volume which is hard drive on another
server
How can i get list of all files on z by using xp_cmdshell 'dir z:' ?|||Roy Goldhammer wrote:
> Hello there
> I have local hard drive, which i can easy run xp_cmdshell 'dir c:'
> On the same computer i have shered Z: volume which is hard drive on anothe
r
> server
> How can i get list of all files on z by using xp_cmdshell 'dir z:' ?
>
xp_cmdshell '\\servername\sharename'
The mapping to drive Z: only exists under your login, not under the
login that the SQL Server service runs under. You also need to make
sure that the SQL Server service account has access to the share.

accing to shered volumes

Hello there
I have local hard drive, which i can easy run xp_cmdshell 'dir c:\'
On the same computer i have shered Z: volume which is hard drive on another
server
How can i get list of all files on z by using xp_cmdshell 'dir z:' ?Roy Goldhammer wrote:
> Hello there
> I have local hard drive, which i can easy run xp_cmdshell 'dir c:\'
> On the same computer i have shered Z: volume which is hard drive on another
> server
> How can i get list of all files on z by using xp_cmdshell 'dir z:' ?
>
xp_cmdshell '\\servername\sharename'
The mapping to drive Z: only exists under your login, not under the
login that the SQL Server service runs under. You also need to make
sure that the SQL Server service account has access to the share.

accing shered volume

Hello there
I have local hard drive, which i can easy run xp_cmdshell 'dir c:\'
On the same computer i have shered Z: volume which is hard drive on another
server
How can i get list of all files on z by using xp_cmdshell 'dir z:' ?What account is SQL Server running as? It must have permissions to the Z:\
(typically this means you must set up SQLServer to run as a Domain\User as
opposed to a local user or built-in account).
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:eXbwFn7kGHA.3816@.TK2MSFTNGP02.phx.gbl...
> Hello there
> I have local hard drive, which i can easy run xp_cmdshell 'dir c:'
> On the same computer i have shered Z: volume which is hard drive on
> another
> server
> How can i get list of all files on z by using xp_cmdshell 'dir z:' ?
>
>

Thursday, February 9, 2012

accessing mapped drive via xp_cmdshell

Hello,
I'm having problems accessing a mapped network drive. Basically, I
need to be able to access the g:\ drive from SQL Server (i.e.
master..xp_cmdshell 'dir g:\')
I created a share on my server (\\MyServer\ShareName) and mapped the
network drive G to this. So, from my machine I can do a "start, run",
and type in g:\, and get what I want to see.
However, when I run:
master..xp_cmdshell 'dir g:\
I get a message "The system cannot find the path specified."
I have the MSSQLSERVER account on this server setup to login as me.
Shouldn't this take care of any issues?
I would like to use a UNC share, but unfortunately I can't do that at
this time.
Much appreciate any ideas!
Sylvia
Try specifying the UNC path instead of a mapped drive:
EXEC master..xp_cmdshell 'DIR \\MyServer\ShareName'
Hope this helps.
Dan Guzman
SQL Server MVP
"Sylvia" <sylvia@.vasilik.com> wrote in message
news:1133830852.921653.231970@.g49g2000cwa.googlegr oups.com...
> Hello,
> I'm having problems accessing a mapped network drive. Basically, I
> need to be able to access the g:\ drive from SQL Server (i.e.
> master..xp_cmdshell 'dir g:\')
> I created a share on my server (\\MyServer\ShareName) and mapped the
> network drive G to this. So, from my machine I can do a "start, run",
> and type in g:\, and get what I want to see.
> However, when I run:
> master..xp_cmdshell 'dir g:\
> I get a message "The system cannot find the path specified."
> I have the MSSQLSERVER account on this server setup to login as me.
> Shouldn't this take care of any issues?
> I would like to use a UNC share, but unfortunately I can't do that at
> this time.
> Much appreciate any ideas!
> Sylvia
>
|||Thanks for the reply. Unfortunately using a UNC path is not an option
at this point, as I mentioned above (some hard-coded stuff already
written, can't change right now).
Any other options? Does a network share mapped to a drive just not
work?
Thanks,
Sylvia
|||> Thanks for the reply. Unfortunately using a UNC path is not an option
> at this point, as I mentioned above (some hard-coded stuff already
> written, can't change right now).
Sorry, I didn't understand that from your original post.

> Any other options? Does a network share mapped to a drive just not
> work?
A mapped drive can work but it is a kludge. One thing you might try is
establishing a persistent mapped drive. I expect you'll only need to do
this once, unless you change the SQL Server service account or unmap the
drive for that user.
EXEC master..xp_cmdshell 'NET USE L: \\MyServer\ShareName /PERSISTENT:YES'
Hope this helps.
Dan Guzman
SQL Server MVP
"Sylvia" <sylvia@.vasilik.com> wrote in message
news:1133845592.917117.66320@.g43g2000cwa.googlegro ups.com...
> Thanks for the reply. Unfortunately using a UNC path is not an option
> at this point, as I mentioned above (some hard-coded stuff already
> written, can't change right now).
> Any other options? Does a network share mapped to a drive just not
> work?
> Thanks,
> Sylvia
>
|||That did it! Thanks much - it's just the kludge I needed to get past
this.

accessing mapped drive via xp_cmdshell

Hello,
I'm having problems accessing a mapped network drive. Basically, I
need to be able to access the g:\ drive from SQL Server (i.e.
master..xp_cmdshell 'dir g:\')
I created a share on my server (\\MyServer\ShareName) and mapped the
network drive G to this. So, from my machine I can do a "start, run",
and type in g:\, and get what I want to see.
However, when I run:
master..xp_cmdshell 'dir g:\
I get a message "The system cannot find the path specified."
I have the MSSQLSERVER account on this server setup to login as me.
Shouldn't this take care of any issues?
I would like to use a UNC share, but unfortunately I can't do that at
this time.
Much appreciate any ideas!
SylviaTry specifying the UNC path instead of a mapped drive:
EXEC master..xp_cmdshell 'DIR \\MyServer\ShareName'
Hope this helps.
Dan Guzman
SQL Server MVP
"Sylvia" <sylvia@.vasilik.com> wrote in message
news:1133830852.921653.231970@.g49g2000cwa.googlegroups.com...
> Hello,
> I'm having problems accessing a mapped network drive. Basically, I
> need to be able to access the g:\ drive from SQL Server (i.e.
> master..xp_cmdshell 'dir g:')
> I created a share on my server (\\MyServer\ShareName) and mapped the
> network drive G to this. So, from my machine I can do a "start, run",
> and type in g:\, and get what I want to see.
> However, when I run:
> master..xp_cmdshell 'dir g:\
> I get a message "The system cannot find the path specified."
> I have the MSSQLSERVER account on this server setup to login as me.
> Shouldn't this take care of any issues?
> I would like to use a UNC share, but unfortunately I can't do that at
> this time.
> Much appreciate any ideas!
> Sylvia
>|||Thanks for the reply. Unfortunately using a UNC path is not an option
at this point, as I mentioned above (some hard-coded stuff already
written, can't change right now).
Any other options? Does a network share mapped to a drive just not
work?
Thanks,
Sylvia|||> Thanks for the reply. Unfortunately using a UNC path is not an option
> at this point, as I mentioned above (some hard-coded stuff already
> written, can't change right now).
Sorry, I didn't understand that from your original post.

> Any other options? Does a network share mapped to a drive just not
> work?
A mapped drive can work but it is a kludge. One thing you might try is
establishing a persistent mapped drive. I expect you'll only need to do
this once, unless you change the SQL Server service account or unmap the
drive for that user.
EXEC master..xp_cmdshell 'NET USE L: \\MyServer\ShareName /PERSISTENT:YES'
Hope this helps.
Dan Guzman
SQL Server MVP
"Sylvia" <sylvia@.vasilik.com> wrote in message
news:1133845592.917117.66320@.g43g2000cwa.googlegroups.com...
> Thanks for the reply. Unfortunately using a UNC path is not an option
> at this point, as I mentioned above (some hard-coded stuff already
> written, can't change right now).
> Any other options? Does a network share mapped to a drive just not
> work?
> Thanks,
> Sylvia
>|||That did it! Thanks much - it's just the kludge I needed to get past
this.