Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Process doesn't run with xp_cmdshell

Posted on 2008-09-30
10
293 Views
Last Modified: 2008-09-30
Dear Experts,

When I run an executable using with the following line, it fails, returning an error message 'Error, could not open output file intermediate\poi.9999':

exec master..xp_cmdshell 'C:\AppData\GrowLive\TomTom\makeov2.exe

When I run this on the command line in windows, it executes fine and produces the desired result.

Can anybody think of a reason it won't execute using xp_cmdshell - I even tried running it as sa and this didn't help.

Thanks

NIck
0
Comment
Question by:nkewney
  • 5
  • 5
10 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22606858
Where is it attemptint to put poi.9999?  Is it possible that the account SQL Server is executing as does not have the privileges to that directory?


run this to find the account

exec master..xp_cmdshell 'set username'

and verify that the returned username has access to that directory.

It it's Network Service or Local System, and the folder it is attempting to write to is on a different share, then you have to enable a proxy account for xp_cmdshell.
0
 
LVL 1

Author Comment

by:nkewney
ID: 22606951
Hi,

Thanks for the reply.

It's sqlservice - which does have full access to the directory.

Nick
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22607922
so from xp_cmdshell you can do a dir of that directory?

exec mster..xp_cmdshell 'dir "\\ABCD\Intermediate\poi.9999"'

Where \\ABCD is the parent path of of that folder.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 1

Author Comment

by:nkewney
ID: 22608176
Hi Brandon,

The directory ' intermediate ' is created then deleted once the process has finished.

Maybe this is causing the problem?

Downloaded FileMon to see what was happening but it wasn't much use.

Nick
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22608234
So intermediate is created, but not poi.9999?
0
 
LVL 1

Author Comment

by:nkewney
ID: 22608261
Looks like poi.9999 is the first directory created after intermediate

7:55:44 PM      makeov2.exe:724      CREATE      C:\AppData\TomTom\intermediate\poi.9999      SUCCESS      Options: OverwriteIf  Access: 00120196      
0
 
LVL 1

Author Comment

by:nkewney
ID: 22608267
(this happens when it the process is started from the command prompt)
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 22608300
from the command prompt on the SQL Server, running in the same directory?  xp_cmdshell opens in %systemroot%\system32.  If you application is attempting to write to a relative path, or to a directory that doesn't exist (such as c:\documents and settings\SQLService\ApplicationData\TomTom), it may just not be handling the parent directory not existing.
0
 
LVL 1

Author Comment

by:nkewney
ID: 22608567
Brandon,

That's exactly the issue. It was trying to create directories in c:\Windows\System32

Thank you so much!

Nick
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22608572
;)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to just get time from a date 6 33
Download ms sql express. 2 28
tools to scan a SQL server's problem 14 27
partitioning database after decade growth 8 28
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question