Microsoft KB Archive/314879

= How to Set the NUM LOCK State at Logon in Windows XP =

Article ID: 314879

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional

-



This article was previously published under Q314879



For a Microsoft Windows 2000 version of this article, see 262625.



SUMMARY
This article describes how to set the NUM LOCK state to be on by default at logon. You can accomplish this by using a script file that runs either at startup or, in Windows XP Professional, through a Group Policy.



MORE INFORMATION
Because profiles in Windows XP preserve the NUM LOCK state when the user logs off, you can use the runonce command to run this script once to set the initial state; however, do not use that as a logon script.

The status of the NUM LOCK key is specific for each user. By default, NUM LOCK is turned off.

This article relies on the use of Microsoft Windows Script Host. Windows XP includes Microsoft Windows Script Host version 5.6. Microsoft strongly recommends that you download the latest version of Windows Script Host to make sure that the script works properly. You can find the latest information about Windows scripting at the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms950396.aspx

Configuring the Script
To configure a script to change the NUM LOCK state, use the following steps:  Start Notepad.  Copy the following code, and then paste the code into the text file: set WshShell = CreateObject(&quot;WScript.Shell&quot;) WshShell.SendKeys &quot;{NUMLOCK}&quot;  Save the file as &quot;numlock.vbs&quot; (including the quotes). This properly creates the file with the .vbs extension. The icon changes from a Notepad icon to a script icon.

Running the Script from the Startup Folder
To configure the script to run locally, copy the Numlock.vbs file to the user's Startup folder, which is normally found in the user's profile path.

To configure the script to run for all users, copy the Numlock.vbs file to the Startup folder in the All Users profile. The default path for this folder is Documents and Settings\All Users\Start Menu\Programs\Startup.

Running the Script Through Group Policy
Note that to run the script through Group Policy, you must be using Windows XP Professional, not Windows XP Home Edition.

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

The default path for a local logon script is %SystemRoot%\System32\GroupPolicy\ \Scripts\Logon.

The path for a domain logon script is %SysVolFolder%\Sysvol\Sysvol\ \Scripts.

After you copy the script to the appropriate location, follow these steps:
 * 1) Click Start, click Run, type mmc, and then click OK to start Microsoft Management Console (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, but you can click Browse and 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 User Configuration\Windows Settings\Scripts (Logon/Logoff) folder. (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) Click Open, and then click OK.
 * 9) Click OK, and then close the Group Policy Management console.

If you want to enable the NUM LOCK key to be turned on for use before the user presses CTRL+ALT+DEL to log on, use Registry Editor to change the default behavior. For information about how to do this, refer to the following article in the Microsoft Knowledge Base:

154529 How to Enable the NUM LOCK Key for the Logon Screen

Additional query words: numlock wsh gpo

Keywords: kbhowto kbenv kbinfo KB314879

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.