如何建立RUNAS / NETONLY功能集成到一个(C#/。NET /的WinForms)计划?功能、计划、NETONLY、RUNAS

由网友(傲娇是我的范)分享简介:我们的工作站不是域我们的SQL Server上的成员。 (他们实际上不是一个域的话 - 不问)Our workstations are not members of the domain our SQL Server is on. (They're not actually on a domain at all -...

我们的工作站不是域我们的SQL Server上的成员。 (他们实际上不是一个域的话 - 不问)

Our workstations are not members of the domain our SQL Server is on. (They're not actually on a domain at all - don't ask).

当我们使用SSMS或任何连接到SQL Server时,我们使用RUNAS / NETONLY使用域用户。然后,我们键入密码并启动该程序。 (RUNAS / NETONLY不允许您包括在批处理文件中的密码)。

When we use SSMS or anything to connect to the SQL Server, we use RUNAS /NETONLY with DOMAINuser. Then we type in the password and it launches the program. (RUNAS /NETONLY does not allow you to include the password in the batch file).

所以,我已经有了一个.NET WinForms应用程序,需要一个SQL连接,并且用户可以通过运行它有RUNAS / NETONLY命令行,然后启动EXE一个批处理文件来启动它。

So I've got a .NET WinForms app which needs a SQL connection, and the users have to launch it by running a batch file which has the RUNAS /NETONLY command-line and then it launches the EXE.

如果用户不小心直接启动EXE,它无法连接到SQL Server。

If the user accidentally launches the EXE directly, it cannot connect to SQL Server.

上的应用程序,并使用鼠标右键单击运行方式...选项无法正常工作(presumably因为工作站并不真正了解域)。

Right-clicking on the app and using the "Run As..." option doesn't work (presumably because the workstation doesn't really know about the domain).

我在寻找一种方式,使应用程序在启动任何显著之前内部做RUNAS / NETONLY功能。

I'm looking for a way for the application to do the RUNAS /NETONLY functionality internally before it starts anything significant.

请参阅此链接的RUNAS / NETONLY如何工作的描述:http://www.eggheadcafe.com/conversation.aspx?messageid=32443204&threadid=32442982

Please see this link for a description of how RUNAS /NETONLY works: http://www.eggheadcafe.com/conversation.aspx?messageid=32443204&threadid=32442982

我想我将不得不使用 LOGON_NETCREDENTIALS_ONLY CreateProcessWithLogonW

I'm thinking I'm going to have to use LOGON_NETCREDENTIALS_ONLY with CreateProcessWithLogonW

推荐答案

我收集这些有用的链接:

I gathered these useful links:

的http://www.developmentnow.com/g/36_2006_3_0_0_725350/Need-help-with-impersonation-please-.htm

http://blrchen.spaces.live.com/blog/ CNS!572204F8C4F8A77A!251.entry

http://geekswithblogs.net/khanna/archive/2005/ 03/09 / 22430.aspx

http://msmvps.com/blogs/martinzugec/archive/2008/06/03/use-runas-from-non-domain-computer.aspx

事实证明,我将不得不使用 LOGON_NETCREDENTIALS_ONLY CreateProcessWithLogonW 。我要看看我能不能让程序检测它是否已经启动这种方式,如果没有,收集域凭据,并启动自身。这样,只会有一个自管理的EXE文件。

It turns out I'm going to have to use LOGON_NETCREDENTIALS_ONLY with CreateProcessWithLogonW. I'm going to see if I can have the program detect if it has been launched that way and if not, gather the domain credentials and launch itself. That way there will only be one self-managing EXE.

阅读全文

相关推荐

最新文章