\[Editor's Note: Do you have something to share with other readers who visit Windows NT Magazine online? We want to know about it. Write for Reader to Reader online, and you can tell others about your NT discoveries, comments, problems, solutions, and experiences. Email your contributions (300 to 700 words) to email@example.com along with your name and phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100. Reader to Reader submissions are the reader's opinion and do not necessarily represent the views of Windows NT Magazine.\]
Many Windows NT users might be unaware that a great deal of discrepancy exists between when items in the Run and RunOnce sections of the Registry actually run. Entries in the RunOnce section run before the Explorer shell and take control of the system. As a result, the user who has just logged on can't interact with the system until the RunOnce entry finishes its job. However, those entries in the Run section run after the Explorer shell and don't take modal control of the OS.
Although you might want to run and finish several executable programs (e.g., system inventory checks, additional authentication) before you let the user do anything else, there's a catch. Whereas the OS removes RunOnce entries from the Registry immediately after they complete execution, Run entries remain in effect forever.
If you have a program that you want to run before the Explorer shell every time a user logs on, you need to use the System Policy Editor (SPE) to add the program into the RunOnce portion of a system policy (versus directly into the Registry). Because the system reads the system policy every time a user logs on, NT creates a new RunOnce entry to replace the one the OS deleted last time, and you can effectively have your program modally take control of the system on each logon.
You'll find Run possibilities in most system policy templates (.adm text files) that SPE uses, but not RunOnce. Because the templates are simple text files, you can use any editor to find the appropriate location in the file and change Run to RunOnce. Save your changes, and open SPE and make your entries. Be sure to save the system policy in the Netlogon share under the name config.pol for Windows 9x clients or ntconfig.pol for all NT clients.