automatically login to windows after startup

随声附和 提交于 2019-12-23 03:39:10

问题


a client of mine uses the task manager to trigger (start) a process to do something. This process contains a UI, and needs to be a single instance at all times (been taken care of).

Everything runs smoothly from the task manager, accept if you need to set the task manager settings to:”run whether user is logged on or not” (see the answer why this is a problem here: http://social.technet.microsoft.com/Forums/en-US/c03d6691-b058-4f8d-961c-e8eba25bbaed/task-scheduler-problem-run-whether-user-is-logged-on-or-not

Ok..no problem. We just let the task run only if the user is logged on. Still works fine (even with computer locked).

But, this night windows had an update and the system automatically rebooted. Logging of the user and therefor the task manager was not able to run the tasks. :-(

Since the program has a UI (is needed), I cannot switch to “run whether user is logged on or not”. What would be best practice to:

  1. logon again as the user that needs to run the application
  2. make sure that the started application, is actually visible to the user, when he logs in? (unlockes the computer)

I know how to run processes with different user credentials in C#, but that’s not the solution for this problem.

Automatically logon a user (and lock the computer) when the computer has started, would be great. Is this in any way possible? Or is there another solution for my problem?

Regards,

Matthijs


回答1:


Create and install a Windows Service to do the actual work. This service will not require a logged on user and by definition only runs with once instance at a time, so this solves all of your problems.

Then let the UI communicate with the service through IPC and let the UI application start upon logon.

You can alternatively of course just let the user autologon, put a shortcut to the program in the startup folder and call the LockWorkStation() function after your application starts, but I would not take nor recommend that approach as it has security issues.




回答2:


you can automatically login to a user account at startup with this :

http://technet.microsoft.com/en-us/magazine/ee872306.aspx

  1. Click Start, type netplwiz, and then press Enter.
  2. In the User Accounts dialog box, click the account you want to automatically log on to.If it is available, clear the Users Must Enter A User Name And Password To Use This Computer check box.
  3. Click OK.
  4. In the Automatically Log On dialog box, enter the user’s password twice and click OK.

The next time you restart the computer, it will automatically log on with the local user account you selected.




回答3:


Automatic Windows logon as a predefined user is a convenient feature for single-user machines or home computers. This removes the hassle of unnecessary repetitive password entering in a secure environment and speeds up Windows startup and user profile warmup.

Howsoever, please do never forget that this is a kind of a security breach and should never be applied on computers, which could fall into hostile hands.

A detailed explanation of the procedure, without messing-up with the Windows registry, is available HERE.



来源:https://stackoverflow.com/questions/19975784/automatically-login-to-windows-after-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!