将Windows用户登录到远程计算机

时间:2021-08-10 13:54:11

Here is what I am doing: I have several servers that are used to run a piece of software. The software is started using a scheduled task. I can have up to three instances of the software running using three scheduled tasks, and three logged in users. Currently I am using a separate program running on two additional servers to make sure these two additional users are logged in, the scheduled task will not run if the user is not logged in. This separate program uses a saved Remote Desktop Session to make sure the users are logged in.

以下是我正在做的事情:我有几台服务器用于运行一个软件。使用计划任务启动软件。我最多可以使用三个计划任务运行三个软件实例,三个登录用户。目前我正在使用另外两个服务器上运行的单独程序来确保这两个额外用户已登录,如果用户未登录,则计划任务将不会运行。此单独程序使用保存的远程桌面会话来确保用户已登录。

Here is what I would like to do: The RDP session needs a username/password to log the user in, this is stored separate from the RDP file. This is all getting very large and tedious to maintain. What I am looking for is a way to check if all the users are logged in, and if not log them in, without the separate RDP session files and separate username/password stored in the Credential Manager.

以下是我想要做的事情:RDP会话需要用户名/密码来记录用户,这与RDP文件分开存储。维持这一点变得非常庞大和繁琐。我正在寻找的方法是检查所有用户是否都已登录,如果没有登录,则不会在Credential Manager中存储单独的RDP会话文件和单独的用户名/密码。

I have looked at a couple of ways that can get the user information from the server, but I have not found a good way to accomplish the logging in. It just seems like there should be a simple way to accomplish this. I am using VB.Net 2.0 with Windows 2003 servers.

我已经看了几种可以从服务器获取用户信息的方法,但我还没有找到一种很好的方法来完成登录。看起来应该有一种简单的方法来实现这一点。我在Windows 2003服务器上使用VB.Net 2.0。

Let me know if I am not clear on something.

如果我对某些事情不清楚,请告诉我。

Any help or suggestions are greatly appreciated.

非常感谢任何帮助或建议。

Maybe a little more clarification: The second and third users need to simulate a user logging in from another machine and stay logged in so the main scheduled tasks can run.

可能需要更多说明:第二个和第三个用户需要模拟从另一台计算机登录的用户并保持登录状态,以便主计划任务可以运行。

1 个解决方案

#1


1  

Take a look at the LogonUser function.

看一下LogonUser函数。

You would write a program using this function that would run before your current scheduled tasks.

您可以使用此函数编写程序,该程序将在当前计划任务之前运行。

#1


1  

Take a look at the LogonUser function.

看一下LogonUser函数。

You would write a program using this function that would run before your current scheduled tasks.

您可以使用此函数编写程序,该程序将在当前计划任务之前运行。