views:

43

answers:

1

Hi, 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

+1  A: 

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.

Scott P
Thanks man! I will try this
ben