xp_cmdshell on network.. 
Author Message
 xp_cmdshell on network..

Quote:
> I want to execute a command on a machine connected
> on the network.

> When I execute the command

> master..xp_cmdshell 'dir *.exe'

> on my machine, I get proper results.

> But, when I execute
> master..xp_cmdshell 'dir I:\ *.exe'
> where  ' I ' is the drive letter to which I have mapped
> that machine.

> I get a message 'Access is denied'

> I could execute the same command from DOS prompt.
> I have logged in as 'sa'.

 Mudita,

 This is because when SQL executes a command it runs it under the account of
the NT userid that SQL Server is running under - it doesn't matter who you're
logged in as to either SQL or NT.  SQL Server by default runs under the
localsystem account which doesn't have network access.


 Protech Computing Ltd (MS Solution Provider)
 Using Virtual Access 4.00 build 213a (32-bit) on NT 4.0 SP3



Fri, 05 Nov 1999 03:00:00 GMT
 xp_cmdshell on network..

Mudita,

You have 2 options:

1. Start the service MSSQLServer unser a real account (not LocalSystem).
Have a look in Book Online, what's new for 6.5 for account properties. This
is the solution that I generally prefer.

2. Make the share(s) that you want to browse NullSessionShares. Search KB
for details.

Remember as well that the drivemapping for you (when you perform "DIR
L:*.exe") isn't the same as for the MSSQLServer service. In fact, when
MSSQLServer executes under LocalSystem, it doesn't have any drivemapping at
all. Mapped drives, as I'm sure you know, is per user, not machine. For
that reason, I recommend you to use UNC naming.
--

Instructor (MCT, MCSE, MCSD)
Cornerstone Sweden AB



Quote:

>   > I want to execute a command on a machine connected
>   > on the network.

>   > When I execute the command

>   > master..xp_cmdshell 'dir *.exe'

>   > on my machine, I get proper results.

>   > But, when I execute
>   > master..xp_cmdshell 'dir I:\ *.exe'
>   > where  ' I ' is the drive letter to which I have mapped
>   > that machine.

>   > I get a message 'Access is denied'

>   > I could execute the same command from DOS prompt.
>   > I have logged in as 'sa'.

>    Mudita,

>    This is because when SQL executes a command it runs it under the
>   account of
>   the NT userid that SQL Server is running under - it doesn't matter
>   who you're
>   logged in as to either SQL or NT.  SQL Server by default runs under
>   the
>   localsystem account which doesn't have network access.


>    Protech Computing Ltd (MS Solution Provider)
>    Using Virtual Access 4.00 build 213a (32-bit) on NT 4.0 SP3

> Neil,

> Thanks for your prompt reply. But could you also provide me the way of
> how can I execute a command on a networked machine.

> This is very urgent for me.

> Thanks in advance.

> Mudita
> INFOZECH



Sat, 06 Nov 1999 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Can't get xp_cmdshell command to print to network printer

2. xp_cmdshell not seeing newly created folder on network drive

3. identity problem using xp_cmdshell to copy file over network

4. xp_cmdshell reading a novell network drive

5. xp_cmdshell - Problem running perl script from xp_cmdshell

6. ListAvailableSQLServers, local network segment?, network-visible server?

7. : [DBMSSOCN]General network error. Check your network documentation

8. SQL Server access on Novell network without Client for MS Networks

9. network packet size on Wide area network

10. General network error. Check your network documentation

11. TCPIP network & Dialup networking

12. DBMSSOCN General Network Error check your network documentation????


 
Powered by phpBB® Forum Software