简体   繁体   中英

How to ensure C# application starts after windows is booted compltely

I want to create a simple checker console application that should run at startup on developer's machines and check some items. This is to make sure that all developers are working according to a predefined policy that gets updated on regular basis.

Everything works just fine, except that this console application runs before Windows is truly booted (user is not logged in yet), and our application encounters access denied exceptions in some places.

In this answer , it's suggested that we either change the console to Windows service, or make it a Windows scheduled task, none of which is desirable in our situation.

Is there any way to check that Windows is fully booted, and user is logged in (for example in a while loop) and after that continue the code in .NET?

  1. If you can configure windows service with user's credentials (you know user's password or can ask user to configure service), u can install windows service with users's credentials. Select Automatic Delayed Start (explain here ). This service will start even if user is not logon yet, but with his credentials.
  2. You can use Startup folder
  3. You can use registry run\\regedit

open

[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run]

For each program you want to start automatically create a new string value using a descriptive name, and set the value of the string to the program executable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM