473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 7485
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_cmdshell '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****@sommarskog.se

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

go to %systemroot%\system32\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
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
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
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...
3
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...
4
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...
1
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...
0
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...
5
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...
2
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.