I would like to write a small application that unlocks the workstation. To put the specs of what I need very simple: Have an exe that runs and at a defined time (let's say midnight) unlocks the workstation. Of course the application knows the user and password of the logged on account.
I know of the LogonUser API and have tried using it but failed. Does anyone have a solution, code excerpt that actually works for this issue?
I am targeting NT5 OSes.
Well, since people started asking what is the reason: I am working on a desktop sharing application and I want to add the feature of unlocking the workstation. Having the very small and simple app to unlock the station at a defined time is in order to separate the problem and to avoid the integration details.
Press CTRL+ALT+DELETE to unlock the computer. Type the logon information for the last logged on user, and then click OK. When the Unlock Computer dialog box disappears, press CTRL+ALT+DELETE and log on normally.
Unlocking Your ComputerFrom the Windows 10 login screen, press Ctrl + Alt + Delete (press and hold down the Ctrl key, then press and hold down the Alt key, press and release the Delete key, and then finally release the keys).
Just so you have an answer for this instead of people leaving answers which might be better off as comments.
This is certainly possible, though as many people have already said it's not really wise, what happens if someone is walking by the computer as it unlocks, how long do they have to play around, etc?
Anway, apart from suggesting you have a service to do any work that you want on hte computer, or even remotely connecting to the computer to do work you might be able to make user of the following information. (as for 'code excerts' you can make it yourself)
http://www.paralint.com/projects/aucun/ is a GINA implementation which will be able to give you rights to log on even if someone else has already logged on. Look into it it might be what you're looking for and is a lot safer than unlocking the workstation at a certain time.
As an alternative, look into writing your own GINA implementation that will do an unlock at a scheduled time.
Information on GINA
http://msdn.microsoft.com/en-gb/magazine/cc163803.aspx
http://msdn.microsoft.com/en-us/magazine/cc163786.aspx
After you've unlocked the desktop I'm pretty sure you're going to want to lock it again.
http://www.codeproject.com/win32/AntonioWinLock.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With