开发者

How to know when a computer has restarted and log in via command line or 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜