【问题标题】:xp_cmdshell. A call to 'CreateProcess' failed with error code: '2'xp_cmdshell。对“CreateProcess”的调用失败,错误代码为:“2”
【发布时间】:2020-12-19 04:57:16
【问题描述】:

当我在 SQL Server 2008 中执行以下语句时:

use master
go
exec sp_configure 'show advanced options', 1;
go
reconfigure
go
exec sp_configure 'xp_cmdshell',1;
go
reconfigure
go
EXEC XP_CMDSHELL 'whoami'

它给出了以下错误:

消息 15121,级别 16,状态 21,过程 xp_cmdshell,第 1 行错误 在执行 xp_cmdshell 期间发生。打电话给 “CreateProcess”失败,错误代码:“2”。

请帮我解决这个问题。

非常感谢。

【问题讨论】:

  • 错误代码 2 表示File not found。如果您改用exec xp_cmdshell 'C:\Windows\System32\whoami.exe'exec xp_cmdshell 'C:\Windows\SysWOW64\whoami.exe' 是否有效?
  • 谢谢。但它没有用。
  • 您是否能够登录到托管此 SQL Server 实例的 Windows Server?你能确认它实际上在任何地方都有whoami.exe吗? (即:系统管理员可能已选择删除它。)
  • 我仍然可以在命令行上执行“whoami”。没关系。

标签: sql-server tsql xp-cmdshell


【解决方案1】:

错误代码 5 表示 - 访问被拒绝。

请检查用于 MSSQL 服务的帐户是否有权执行您尝试运行的命令。

详情:http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bbdffb3c-6604-4011-ac5f-5ea8ecb1a32c/xpcmdshell-a-call-to-createprocess-failed-with-error-code-5-under-sql2005-rtm?forum=sqlsecurity

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 2018-02-15
    • 2012-10-27
    • 1970-01-01
    相关资源
    最近更新 更多