Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / March 2008

Tip: Looking for answers? Try searching our database.

xp_cmdshell runs randomly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
romain.larmet@gmail.com - 11 Mar 2008 09:08 GMT
Hi all,

I have a problem with the xp_cmdshell stored procedure on SQL Server
2005.

I've allowed its execution on the databases which require it, using
the sp_configure 'show advanced options' and sp_configure
'xp_cmdshell' commands.

It works fine most of the time, but sometimes, it simply stops
running, whatever command I am trying to run (notepad, dir c:, ...).
In the Management Studio, the execution returns NULL, and nothing
happens. There is no error message, and I've also checked that both
the 'show advanced options' and 'xp_cmdshell' configuration variables
are still set to '1'.

I've experienced this problem twice, it seems to last a few hours, and
then disappears.

Does anyone have an idea about why SQL Server is unable to run an
external program using xp_cmdshell?

Thank you!

--
Romain
Aaron Bertrand [SQL Server MVP] - 11 Mar 2008 11:24 GMT
> It works fine most of the time, but sometimes, it simply stops
> running, whatever command I am trying to run (notepad, dir c:, ...).

You cannot run notepad from xp_cmdshell... it will never return.  You should
not run *any* program that *might* raise any sort of graphical GUI or
prompt... this includes error message dialogs.  xp_cmdshell is meant for
command-line interfaces only.

A
romain.larmet@gmail.com - 11 Mar 2008 11:40 GMT
On 11 mar, 11:24, "Aaron Bertrand [SQL Server MVP]"
<ten....@dnartreb.noraa> wrote:
> > It works fine most of the time, but sometimes, it simply stops
> > running, whatever command I am trying to run (notepad, dir c:, ...).
[quoted text clipped - 5 lines]
>
> A

Ok, thanks for the tip :-)
So I need to add that the application I am trying to run using
xp_cmdshell is not a GUI application.
But anyway, the basic test "dir c:" should always work and sometimes
it doesn't.

Regards
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.