Auto logon windows at a specific time. How can i do this in c# ?
Any ideas please…
Purpose : I need to perform some tasks at a specific time in midnight. which needs the windows to be logged on.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take a look at the Scheduled Task. On the task panel you un-check the option “only after the current user logs on”. That’s it.
Update
So to make this with a little more explanation:
This was your question:
So to get this to work, you have to split your task a little bit up. At first write your task that should be performed (a batch-script, a self-written application, a third-party application with a configuration file or some command line parameters, etc.).
If you got your task up and you can run it on a single finger tip (e.g. click on a lnk file on your desktop, enter a single command on the command-line, etc.), it’s time to automate your task for a specific time schedule. For this purpose Microsoft already provided a powerful tool, called
Scheduled Tasks. It is located in the Control Panel. Here you can define Tasks which should be started with dozens of options and time plans. Just step through the wizard and after that make a double click or right click – Properties on the created task. Now step through all the TabPages and take a close look on all the available options. Everything you need can be solved here.Update 2
So after reading your comment (and a few other):
My first question would be: What do you mean with locked?
There are two states in which a system can be locked:
The difference between those two states is, in the first you need to provide a username and a password, in the second one you only need to provide the password only.
What both have in common is you have to press CtrlAltDel to get the needed Dialog and this is not possible from an application.
If you really need to log-on or unlock the screen at a specific time you should start a search about
gina.dlland how to replace or enhance it so that you can send a message to it, to do whatever you like. But this dll replacement can’t be done in C#. It has do be done in C/C++. And i forgot, that the gina.dll approach only works on XP. For Vista/Win7 they changed the log-on process and the procedure to intercept it, but a search for the provided keywords should reveal the needed informations.