0

I would like to use Task Scheduler (I'm using Windows 8.1) to automatically turn on num lock when I plug a keyboard into my laptop.

For some reason my laptop will default to num lock being off every time I lock the screen or close/open the laptop. It's extremely annoying as I use the right-hand number keys a lot and I usually do have my keyboard plugged in.

5
  • When you close and open the laptop, is it stopping at the login screen (and that's where you notice Num Lock is off)? If so, and you log in, does it turn back on (or return to the state it was in before you locked the computer/closed the lid? Also, the Task Scheduler doesn't have a trigger for "Keyboard plugged in", as I'm sure you noted when you did your research before asking this, so what methods have you tried already for having the Task Scheduler detect the keyboard being plugged in? Commented Dec 30, 2014 at 17:53
  • I tried Googling and didn't find any definitive answer saying there was no event for that... But I did notice there are Hardware events and was hoping someone here might know better. I've tried the solution that Nazar554 posted below, but it doesn't seem to be working
    – xyhhx
    Commented Dec 30, 2014 at 19:34
  • How about these questions: When you close and open the laptop, is it stopping at the login screen (and that's where you notice Num Lock is off)? If so, and you log in, does it turn back on (or return to the state it was in before you locked the computer/closed the lid? Commented Dec 30, 2014 at 19:48
  • When I close the laptop, I have to log back in. The num lock key does not turn on automatically ever, whether logging back in or anything else. I always have to turn it on manually
    – xyhhx
    Commented Jan 5, 2015 at 22:22
  • Windows 7 event for plugging in USB keyboard
    – phuclv
    Commented Nov 30, 2016 at 13:40

2 Answers 2

1

i had a slightly different angle on this, had a asus laptop where numlock would get turned on at every reboot(it is a 14" laptop, so doesnt have a separate number pad, which means that half the keyboard types numbers by default, which is very annoying) . I tried all the reg fixes, the turning off fast start, holding a rabbits foot whilst hopping, sacrificing a goat whilst holding down fn and C, nothing worked. ended up writing a script kicked off by a scheduled task that runs at startup and at log on for this, to turn num lock off if it is detected as being on.

script is below. it only seems to work after log on though, but i cant be bothered to work out why as i have spent hours on this and it works enough for me.

if([console]::NumberLock) { 
    $w = New-Object -ComObject WScript.Shell; 
    $w.SendKeys('{NUMLOCK}'); 
}


if you want to do the reverse, use

if(-not [console]::NumberLock){ 
    $w = New-Object -ComObject WScript.Shell; 
    $w.SendKeys('{NUMLOCK}'); 
}

i also kick off a registry file from the same task to set the values in the registry as they get overwritten every time. i dont think this actually achieves very much but as i had it i thought i would run it anyway. your S- number may well be different to mine, so make sure you change it.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Keyboard]

"InitialKeyboardIndicators"="2147483648"

[HKEY_USERS\.DEFAULT\Control Panel\Keyboard]

"InitialKeyboardIndicators"="2147483648"

[HKEY_USERS\S-1-5-18\Control Panel\Keyboard]

"InitialKeyboardIndicators"="2147483648"

[HKEY_USERS\S-1-5-21-1658153221-431003928-1463442403-1002\Control Panel\Keyboard]
"InitialKeyboardIndicators"="2147483648"

i got the code for the powershell script from here:

https://stackoverflow.com/questions/41234687/how-to-check-if-numlock-is-enabled

0

You can try to modify this registry key: InitialKeyboardIndicators

Some BIOSes also provide option to change default NumLock state at startup, so you can try checking yours. Usually BIOS restores previous NumLock state after wake up from sleep, but maybe yours restores the default (NumLock off).

1
  • Yeah, I've tried this but it didn't work
    – xyhhx
    Commented Dec 30, 2014 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .