授予对xp_cmdshell

时间:2018-12-12 18:02:47

标签: permissions xp-cmdshell

首先,对我的英语不好感到抱歉。

现在,要点了。我有一个使用installshield创建的安装启动器。因此,可以按以下说明在静默模式下执行该setup.exe:http://www.silentinstall.org/InstallShield

我正在尝试通过SQL Server在静默模式下运行setup.exe,但是它不起作用。这是代码:

EXEC sp_configure 'show advanced options', 1
RECONFIGURE
EXEC sp_configure 'xp_cmdshell', 1 
RECONFIGURE

declare @result table (line nvarchar(1000))

insert into @result

Exec master..xp_cmdshell [ "C:\abc\setup.exe" /s ]

select * from @result

我已经在两台不同的PC上尝试了相同的代码。其中之一有效,因此说明正确无误。 如我所说,执行setup.exe无效,但是众所周知的示例

Exec master..xp_cmdshell [ "dir c:\*.*"  ]

是的。 我还检查了Surface Area Configuration Facet中的XPCmdShellEnabled是否为true。因此,我认为这是权限问题,但我无法弄清楚。

我不知道我还能做什么/检查一下。

谢谢。

p.s。 :通过命令提示符以静默模式执行该setup.exe可以正常工作。

稍后编辑:如果有意地指定了一些不存在的文件,例如

Exec master..xp_cmdshell [ "C:\abc\set3up.exe" /s ]

我得到了正确的结果:%s不被识别为内部或外部命令,可操作程序或批处理文件。

编辑2:当我运行xp_cmdshell“ whoami.exe”时,得到以下结果:

1)在有效的PC上:nt Authority \ system

2)另一个:nt服务\ mssql $ sqlexpress

0 个答案:

没有答案