You are currently offline, waiting for your internet to reconnect

How To Run a Logon Script One Time When a New User Logs On in Windows Server 2003

Support for Windows Server 2003 ended on July 14, 2015

Microsoft ended support for Windows Server 2003 on July 14, 2015. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

This article was previously published under Q325347
For a Microsoft Windows 2000 version of this article, see 284193.

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry

IN THIS TASK

SUMMARY
This article describes how to configure a logon script or program to run one time when a user logs on to a computer for the first time. These steps apply only to new users who have never logged on to the computer. If a user already has a local user profile or a roaming profile, the script or program does not run.

back to the top

Configure a Script to Run One Time When a New User Logs On

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

When a Windows Server 2003-based product is installed, the Default User profile is created. The first time that a user logs on, the Default User profile is copied to the user's profile.

To configure a script or program to run when a new user logs on, follow these steps:
  1. Click Start, and then click Run.
  2. In the Open box, type regedit.exe, and then click OK.
  3. Locate the following subkey in the registry:

    HKEY_USERS
  4. On the File menu, click Load Hive.
  5. In the Load Hive dialog box, locate the Profilepath\Default User\Ntuser.dat file, where Profilepath is the file system location of the Default User profile. Click Open.
  6. In the Load Hive dialog box type a name for the hive, and then click OK.

    NOTE: The Ntuser.dat file is hidden. If you cannot locate or load the Ntuser.dat file, you must change your view settings in Windows Explorer. To do this, follow these steps:
    1. Click Start, and then click Windows Explorer.
    2. Click Tools, and then click Folder Options.
    3. Click the View tab.
    4. Click to clear the Hide extensions for known file types check box.
    5. Select Show hidden files and folders, and then click OK.
  7. Locate the following subkey in the registry:
    HKEY_USERS\Test\Software\Microsoft\Windows\CurrentVersion\Runonce

    NOTE: Where Test is the name that you gave to the Ntuser.dat hive in step 6.
  8. On the Edit menu, point to New, and then click String Value.
  9. In the right pane, double-click the new value.
  10. In the Edit String dialog box, type the full path and file name for the program or logon script, and then click OK.
  11. In the left pane, click the Test hive.
  12. On the File menu, click Unload Hive.
  13. Click Yes when prompted to confirm you want to unload the hive.
  14. Quit Registry Editor.
This program or logon script runs for a user who does not have a user profile. To view the user profiles on the local computer, follow these steps:
  1. Click Start, point to Control Panel, and then click System.
  2. Click the Advanced tab.
  3. In the User Profiles area, click Settings.

    The user profiles are listed in the User Profiles dialog box.

back to the top back to the top
kbmgmtsvc
Properties

Article ID: 325347 - Last Review: 10/30/2006 21:33:06 - Revision: 5.4

  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003, Web Edition
  • Microsoft Windows Server 2003, 64-Bit Datacenter Edition
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • kbmgmtservices kbgpo kbhowto kbhowtomaster kbprofiles kbsetup KB325347
Feedback