如何通过命令行或c#知道计算机何时重新启动并登录?

发布于 2024-09-06 22:10:56 字数 366 浏览 3 评论 0原文

我想知道如何重新启动计算机,以便重新启动后它将通过命令行命令使用给定的凭据登录,或者可能使用 C# 代码中的其他方法。

为了提供上下文,我需要在 Windows XP、Vista 和 Windows 7 上远程运行此命令,并且我尝试形成一个大的命令列表,以连续的顺序在命令行中向 psexec 提供命令。在给定点,可能需要重新启动并登录并恢复执行命令,我想知道如何完成此操作。我知道 PsShutdown 存在并且它可以处理重新启动,但是登录怎么样?我如何知道机器 haqs 何时完全重新启动,以便我可以发出登录命令? C# 代码也可以工作,但不是优选的。

所以主要问题: 如何重新启动机器(我已经非常了解) 如何知道机器何时重新启动 如何尽快登录 如何知道何时完全登录并准备好执行命令

I'd like to know how to restart a computer in such a way that once restarted it will log in using given credentials via a command-line command or perhaps using some other method perhaps in C# code.

To give context, I'm going to need to run this remotely on Windows XP, Vista, And Windows 7 and I am attempting to form a large list of commands to be given to psexec in the command line in a consecutive order. At given points, it may be necessary to restart and log in and resume executing the commands, and I am wondering how I can accomplish this. I know PsShutdown exists and it handles restarting, but how about logging in? How will I know when the machine haqs fully restarted so I can give the login command? C# code will work as well but it's not preferrable.

So main issues:
how to restart a machine (I already pretty much know)
how to know when a machine has restarted
how to log in as soon as it is capable
how to know when it is fully logged in and ready to execute commands

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幸福还没到 2024-09-13 22:10:56

如果您有权访问目标 PC 上的注册表,则可以设置 DefaultPassword、DefaultUserName 和(可选)DefaultDomain。

http://support.microsoft.com/kb/315231

这绝对适用于 XP。我认为与 Vista/Windows 7 相同。

设置完成后,您可以使用 PsShutdown 重新启动电脑。

If you have access to the registry on the target PCs, you can set the DefaultPassword, DefaultUserName and (optionally) DefaultDomain.

http://support.microsoft.com/kb/315231

This definitely works with XP. I think it is the same withe Vista/Windows 7.

Once this is set, you can reboot the PC using PsShutdown.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文