Microsoft KB Archive/262625

= How to Set the NUM LOCK State at Logon Using a Logon Script =

Article ID: 262625

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 98 Standard Edition

-



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 &quot;off.&quot;

There may be times when you want to set the NUM LOCK state to &quot;on&quot; 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:

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

For additional information, visit the following Microsoft Group Policy White Paper Web site:

http://technet2.microsoft.com/windowsserver/en/technologies/featured/gp/default.mspx



MORE INFORMATION
To configure a script to change the NUM LOCK state, use the following steps:  Start Notepad.  Copy and paste the following data into the text file: set WshShell = CreateObject(&quot;WScript.Shell&quot;) WshShell.SendKeys &quot;{NUMLOCK}&quot;  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\ \Scripts

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

NOTE: Click Browse to select a different Group Policy Object.</li> Click Finish, click Close, and then click OK.</li> 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.</li> Double-click the Logon script object. Click Add, click Browse, and then click the Numlock.vbs script.</li> After you select the script, click Open, and then click OK.</li> Click OK, and then close the Group Policy Management console.</li></ol>

Additional query words: numlock wsh gpo

Keywords: kbenv kbhowto KB262625

-

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

© Microsoft Corporation. All rights reserved.