Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows XP / Customization / April 2008

Tip: Looking for answers? Try searching our database.

NUM Lock Quandry

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mwebb - 22 Apr 2008 03:36 GMT
At the request of my boss I have trying to run a script that will keep the
Num Lock on in XP. The idea is to set the registry key so that no matter what
the Num Lock is when the user logs off it will always be on at logon.

The script (below) is run as a logoff script that sets the value for Num
Lock on when the user logs off. The script runs fine and places the number in
the correct place in the registry but when the logon happens the Num Lock key
is off if the user had the key off when logging off before the script runs.

What is really frusturating is that the Num Lock key value is "on" after
logon but the actual key is off.

I am running the script to run synchronisly.

Apparently XP is reading the Num Lock key after the logoff script is run.
Running the script as  logon script does not work either.

How can I get this script to work so the Num Lock is always on no matter
what the Num Lock setting is on logoff.

--------------------------------
'This logoff script uses WMI to determine the OS. If the OS is other than
WinXP the script quits.
'If the OS is WinXP the shell object is used to place a 2 in the registry so
at the next logon the
'Num Lock key is on.

Dim strComputer
Dim objWMIService
Dim colItems
Dim objItem
Dim strOS
Dim intOSType
Dim strOSSearch
Dim intRegVal

strComputer = "."

'Determine OS
Set objWMIService =  GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_OperatingSystem"
, , 48)
For Each objItem in colItems
    strOS = objItem.Name
Next
'WScript.Echo strOS

strOSSearch = "XP"
intOSType = InStr(strOS,strOSSearch)

'If OS is not XP quit. If not check registry key
If intOSType = 0 Then
    WScript.Quit

'If keyboard indicator is 2 quit. If not place "2" in the key
Else
    Set WshShell = CreateObject("Wscript.Shell")
    intRegVal = WshShell.RegRead("HKEY_USERS\.DEFAULT\Control
Panel\Keyboard\InitialKeyBoardIndicators")
    WScript.Echo "Initial RegVal:  " & intRegVal
    If intRegVal <> 2 Then
        WshShell.RegWrite"HKEY_USERS\.DEFAULT\Control
Panel\Keyboard\InitialKeyBoardIndicators" , 2, "REG_SZ"
   
    End If
End If

intRegVal = WshShell.RegRead("HKEY_USERS\.DEFAULT\Control
Panel\Keyboard\InitialKeyBoardIndicators")
WScript.Echo "Final RegVal:  " & intRegVal

WScript.Quit
Leonard Grey - 22 Apr 2008 05:01 GMT
NumLock can also be set in the BIOS, which may be overriding your script.

---
Leonard Grey
Errare humanum est

> At the request of my boss I have trying to run a script that will keep the
> Num Lock on in XP. The idea is to set the registry key so that no matter what
[quoted text clipped - 68 lines]
>
> WScript.Quit
smlunatick - 22 Apr 2008 21:54 GMT
MiumLock options in BIOS are ignored for every Windows version based on NT
(NT, 2000, XP, 2003, 2008 and Vista.)

>NumLock can also be set in the BIOS, which may be overriding your script.
>
[quoted text clipped - 43 lines]
>> Set objWMIService GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
>> Set colItems bjWMIService.ExecQuery("Select * From
Win32_OperatingSystem"
>> , , 48)
>> For Each objItem in colItems
[quoted text clipped - 27 lines]
>>
>> WScript.Quit
Trevor Bloomer - 22 Apr 2008 09:40 GMT
Instead of running your script, try changing the registry value for NumLock
at "HKU\Default\ControlPanel\Keyboard" from 0 to 2.
It's one of the first tweaks I do every time I have to re-install Windows
XP.
Signature

Kind regards,

Trevor Bloomer

> At the request of my boss I have trying to run a script that will keep the
> Num Lock on in XP. The idea is to set the registry key so that no matter
[quoted text clipped - 75 lines]
>
> WScript.Quit
Klaus Jorgensen - 23 Apr 2008 18:36 GMT
mwebb wrote :

> The script (below) is run as a logoff script that sets the value for Num
> Lock on when the user logs off. The script runs fine and places the number in
> the correct place in the registry but when the logon happens the Num Lock key
> is off if the user had the key off when logging off before the script runs.

Why are you modifying the registry for the Default User. IIRC that part
of the registry is used only as a template when a user logs on for the
first time. Use the HKCU branch instead.

Signature

/klaus

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.