How to Set the NUM LOCK State at Logon Using a Logon Script (262625)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows 98

This article was previously published under Q262625

SUMMARY

Windows preserves the keyboard state when a user logs off. When a user logs off and then logs on again, the NUM LOCK state is set to "off."

There may be times when you want to set the NUM LOCK state to "on" when a user logs on. You can accomplish this using a script file that you can distribute at startup or through Group Policy. NOTE: This article relies on the use of Microsoft Windows Script Host. Windows 2000 and Windows 98 clients properly run .vbs scripts. To run .vbs scripts on Microsoft Windows NT 4.0 and Microsoft Windows 95 clients, you can install Windows Script Host on those clients.

If Windows Script Host is already installed, Microsoft strongly recommends that you download the latest version of this tool to ensure that it works properly. You can find the latest information about Windows scripting at the following Microsoft Web site: For additional information, visit the following Microsoft Group Policy White Paper Web site:

MORE INFORMATION

To configure a script to change the NUM LOCK state, use the following steps:
  1. Start Notepad.
  2. Copy and paste the following data into the text file:
    set WshShell = CreateObject("WScript.Shell")
    WshShell.SendKeys "{NUMLOCK}"
    					
  3. Save the file as Numlock.vbs. This properly creates the file with the .vbs extension.

    NOTE: The icon changes from a Notepad icon to a script icon. If the icon doesn't change, the file was probably saved as a text file. To change the icon, rename the file using the .vbs extension.
After you create the script, you can run the script at startup or by using Group Policy.

Running the Script at Startup

To configure the script to run locally using the Startup folder, copy the Numlock.vbs file to the user's startup folder that is normally found in the user's profile path. To configure the script to run for all users, put the script in the Startup folder in the All Users profile.

The following example shows the default path for this folder:

Documents and Settings\All Users\Start Menu\Programs\Startup

Running the Script Using Group Policy

To configure the newly created script to run using Group Policy, you must first copy the Numlock.vbs script file into the Group Policy logon script folder.

The following example shows the default path for a local logon script:

%SystemRoot%\System32\GroupPolicy\[User|Machine]\Scripts\Logon

The following example shows the path for a domain logon script:

%SysVolFolder%\Sysvol\Sysvol\Domainname\Scripts

After you copy the script to the appropriate location, use the following steps:
  1. Start Microsoft Management Console (MMC) by clicking Start, clicking Run, and then typing mmc.
  2. On the Console menu, click Add/Remove Snap-in.
  3. Click Add, click Group Policy, and then click Add.
  4. Click the appropriate Group Policy Object (the default selection is the local computer).

    NOTE: Click Browse to select a different Group Policy Object.
  5. Click Finish, click Close, and then click OK.
  6. In the Group Policy Management snap-in, locate the following folder:

    User Configuration\Windows Settings\Scripts (Logon/Logoff)

    NOTE: You can substitute the Computer Configuration folder for the User Configuration folder.
  7. Double-click the Logon script object. Click Add, click Browse, and then click the Numlock.vbs script.
  8. After you select the script, click Open, and then click OK.
  9. Click OK, and then close the Group Policy Management console.

Modification Type:MajorLast Reviewed:2/16/2006
Keywords:kbenv kbhowto KB262625