Sunday, February 19, 2012

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.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|||Chris Allison (chris.f.allison@.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, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||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|||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

No comments:

Post a Comment