0

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?

Community
  • 1
  • 1
Parike
  • 17
  • 4
  • So how do you start it now? Have you heard of the Startup folder? – CodeCaster Apr 19 '16 at 12:32
  • "This is to make sure that all developers are working according to a predefined policy" - you must have some serious trust issues. – Mahol25 Apr 19 '16 at 12:44
  • The scenario you describe is just not possible, a console mode app *requires* a user to be logged-in before it can start. Maybe you have a dependency on a service that takes longer to get going but that is just a guess as long as you don't post any diagnostic you get. – Hans Passant Apr 19 '16 at 13:04

1 Answers1

1
  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

Community
  • 1
  • 1
Timur Lemeshko
  • 2,747
  • 5
  • 27
  • 39