473,785 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error while running xp_cmdshell

I am getting the following error when running a command in Query
Analyzer.

Msg 50001, Level 1, State 50001
xpsql.cpp: Error 5 from CreateProcess on line 675

Here is the command that I am running that generates this error
message:

xp_cmdshell "@ECHO test message > c:\temp\newtemp .txt"

The command inside the xp_cmdshell command runs successfully from a
Windows command prompt. Simpler commands also fail with the same error
message. For example:

xp_cmdshell 'dir'

Can anyone suggest a solution to this problem? I assume this problem is
due to a permissions/security issue. I have given Everyone Full Control
over c:\temp.

Windows 2000
SQL Server 2000

Thanks for any help.

Jul 23 '05 #1
4 7556
Probably a permissions issue.

Best way to troubleshoot this is as follows:

1. Log in as "sa" or as a sysadmin user (you are already doing this
step right?)
2. Try running the xp_cmdshell (does it work?)
3. If no, check the startup account for the MSSQLSERVER service - does
this user have the ability to run this command? Not sure? Log off the
server and log back in as this service startup user.. Try running the
DOS command...

The key is to make sure the account running the SQL Server service has
the p

Jul 23 '05 #2
Chris Allison (ch************ *@gmail.com) writes:
I am getting the following error when running a command in Query
Analyzer.

Msg 50001, Level 1, State 50001
xpsql.cpp: Error 5 from CreateProcess on line 675

Here is the command that I am running that generates this error
message:

xp_cmdshell "@ECHO test message > c:\temp\newtemp .txt"

The command inside the xp_cmdshell command runs successfully from a
Windows command prompt. Simpler commands also fail with the same error
message. For example:

xp_cmdshell 'dir'


And what does "xp_cmdshel l 'set'" yield? That is, a command that
does not perform any disc access at all?

"NET HELPMSG 5" gives "Access is denied", but I'm too bad at Windows
to say what access it is. Since this happens in CreateProcess one
could suspect that access is denied when try to create a subprocess.

Under which user does SQL Server run? And are yourself logged into
SQL Server as sysadmin, or as an unpriviledged user?
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3
sha0
1 New Member
Hi, the xp_cmdshell stored procedure needs grants in cmd.exe

go to %systemroot%\sy stem32\cmd.exe right click, and add grants.

It is not recommended by security reasons.
regards

Sha0
www.badchecksum.com
Jun 14 '06 #4
Boozon
1 New Member
One simple answer:

Antivirus software!

It could be any of the solutions suggested on the internet when searching for "Error 5 from CreateProcess" on Google, but I tried them all and none of them helped.

I uninstalled the antivirus software (Panda) and it worked like a charm!

Try uninstalling (or configuring) your antivirus software.

Kind regards, good luck and may the source be with you

/Boozon
Jun 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7673
by: Yvonne | last post by:
Would like to implement Blat on SQL Server 2000. I'm looking for example syntax for setting up BLAT with xp_cmdshell. TIA
1
4615
by: Jagannathan Santhanam | last post by:
Hello I am trying to execute ‘xp_cmdshell' from within a DTS package that was created by another person. When I try to execute that ‘SQL Task' selectively from within the package, I get the following error message: Error Title: Package Error Error Details: Error Source: Microsoft OLE DB Provider for SQL Server
3
10864
by: Terri | last post by:
I'm using xp_cmdshell to output a text file from a trigger like this CREATE TRIGGER ON tblApplications FOR INSERT AS DECLARE @FirstName varchar(75) DECLARE @LastName varchar(75) Declare @strcmdshell varchar(150)
4
8095
by: Joel Thornton | last post by:
Whenever something is inserted to a given table, I want to run some shell commands using xp_cmdshell. Would it be a bad idea to put this xp_cmdshell in the INSERT trigger of this table? I understand that when using xp_cmdshell, the sql thread in question waits until xp_cmdshell finishes what it's doing. Does this mean if my xp_cmdshell call takes 30 seconds, that nobody else can insert to this table until my xp_cmdshell and rest of the...
1
7489
by: Matt | last post by:
HI I am using the following code in an SP, it seems like an ugly hack I have done to check if the BCP was working or not, I check the table it shold have filled instead of checking the error from BCP itself. Does anyone know how I can check the BCP errors directly? this is the code I am using.
0
1092
by: simon | last post by:
I have dataGrid on my page with edit button. When user click edit button and change some value and after that click update button, the following code is executed: oCmd = New SqlCommand("c_MediaType", funkcije.createConnection) oCmd.CommandType = CommandType.StoredProcedure oCmd.Parameters.Add("@mediaId", SqlDbType.VarChar, 10).Value = dgdMediaType.DataKeys.Item(e.Item.ItemIndex) oCmd.Parameters.Add("@aktiven", SqlDbType.Bit).Value =...
5
3370
by: mike | last post by:
I created a VB.NET app that uses Outlook's COM object. I get an error when I run master..xp_cmdshell 'myprogram.exe' in SQL query analyzer. The error occurs on this line "oOutlook = New Outlook.Application"
2
3774
by: ssshhh | last post by:
hi! I'm usng SQL server and i want to rename a file using the xp_cmdshell. here's my code: declare @path varchar (20) declare @filename varchar (20) declare @new varchar (20) declare @cmd varchar (20)
1
1730
by: Tina888 | last post by:
I am running osql command that goes and grabs files from my folder and runs one script at a time and loops though all the files in that folder. Most of the files and simple inserts or creation of stored procedures. Problem is that I want to exit out from osql if there is any error encountered while runing the script.. I am using following command Cursor--
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.