• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1331
  • Last Modified:

EXEC master..xp_cmdshell

I have a .exe on a web server eg.  (\\111.11.11.11\webserver\folder1\my.exe)

I have a mapped drive to that web server.

What I am trying to do is run a SQL Server Agent job to run my .exe on my web server.

I used the following :

Operating System Command (CmdExec)

EXEC master..xp_cmdshell '\\111.11.11.11\webserver\folder1\my.exe'


This doesn't work.  
I have full read/write access to the server

What am i doing wrong?
0
joan2006
Asked:
joan2006
  • 4
  • 3
2 Solutions
 
joan2006Author Commented:
Here is the error i get

Executed as user: na\svc-sqlinst25-clst11. The process could not be created for step 1 of job 0xCA1E88B11062954B8C0E801C72F923E1 (reason: The system cannot find the file specified).  The step failed.
0
 
mastooCommented:
Your access doesn't matter.  The command will run under the context of whatever account sql server is running.  Generally that account won't have network permissions.
0
 
LowfatspreadCommented:
try

EXEC master..xp_cmdshell 'X:\my.exe'

where X: is the drive you've mapped to '\\111.11.11.11\webserver\folder1'

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
joan2006Author Commented:
So, are you saying that i can only run a .exe from my machine and not on the web server???


0
 
mastooCommented:
Probably just from whatever box is hosting sql server.  A quick test would be try this:

exec master..xp_cmdshell 'dir'

and it probably works, showing you the results.  Then try this:

exec master..xp_cmdshell 'dir \\SomePuter\SomeShare'

and if they have default security in place you'll get "Access is denied", meaning you can't get to the network under the sql server account.
0
 
joan2006Author Commented:

Lowfatspread!!

I tried:

EXEC master..xp_cmdshell 'R:\KJG\my.exe'

no luck ...i still get this error when i look at the history file

Executed as user: na\sv......... The process could not be created for step 1 of job 0xCF127805D24B9D4B8328B4AC8C9D1A5E (reason: The system cannot find the file specified).  The step failed.
0
 
joan2006Author Commented:
mastoo,

i tried your suggestion and got this error:

Executed as user: na\svc-........... The process could not be created for step 1 of job 0xCF127805D24B9D4B8328B4AC8C9D1A5E (reason: The system cannot find the file specified).  The step failed.

What should i have selected in the Category dropdown in the General tab for creating a job?  currently i have uncatergorized(Local) selected.
Is this correct?
0
 
mastooCommented:
Sorry, I meant try my example from query analyzer first as that will tell you if you're going to be able to get to the network share.  If that pans out, then the next thing would be, why can't you run your sql agent job.  But ok, let's also see if you can create and run a simple sql agent job that runs as you and just does a select * in your database?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now