Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Process doesn't run with xp_cmdshell

Posted on 2008-09-30
10
Medium Priority
?
301 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
[X]
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
  • 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
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
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 2000 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
What we learned in Webroot's webinar on multi-vector protection.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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