PSExec的权限从SQL作业运行

问题描述:

我在CMDExec类型的SQL Job步骤中具有以下内容(详细信息已更改):

I have the following in a CMDExec type SQL Job step (details changed):

D:\path\PSExec.exe \\servername -accepteula -u "domain\username" -p password D:\path\executable.exe

这很好. 但是,我在SQL Server中为该用户正在使用的同一用户帐户设置了一个代理,因此您会认为我不需要-u和-p参数. 但是,如果我不提供它们,则会出现错误:

This works fine. However, I have set up a proxy in SQL Server for the same user account - which the job is using, so you'd think I wouldn't need the -u and -p arguments. But if I don't supply them I get the error:

Unhandled Exception: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

来自SQL Server,因为远程可执行文件以相同的用户上下文连接到SQL.

which is from SQL Server, because the remote executable connects to SQL as the same user context.

为什么这不起作用,我可以在不将凭证包含在工作详细信息中的情况下使其起作用吗? (或批处理文件或类似文件)

Why doesn't this work, and can I make it work without including the credentials in the job detail? (or a batch file, or similar)

谢谢

P.S.如果有帮助,通过远程可执行文件连接的SQL Server与运行该作业的SQL Server相同!

P.S. The SQL Server connected to by the remote executable is the same one as the job is run in, if it helps!

原因是因为Kerberos未运行!

The reason is because Kerberos is not running!

感谢LinkedIn SQLDBA小组的Marc Jellinek:)

Thanks to Marc Jellinek on LinkedIn SQLDBA group :)