I am from the Netherlands so apologies for my English in advance! I am doing everything that is mentioned in this post:click this link. The Powershell script works because when I go to the file and I right click it and then choose 'run with Powershell' the NUMLOCK is turned on. So far so good! However, I have tried for hours, but I can not get it to work with the task scheduler. I have tried literally everything. I have searched the web and tried all kind of things, but nothing works. When I go, in the task scheduler, to 'task status' it says that the task is being performed and under 'results' it says 'succeeded'. When I go, in the task itself, to 'history' it says 'task accomplished' with an OpCode (whatever this means?) of 2 and ID of 102. I hope I am translating all the terms correctly because I am using the Dutch version of Windows 10. In the task itself I have tried the info that i refer to but that didn't work. I now have put under 'Program / script' : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Under 'Add parameters'(optional)'I have added : C:\Users\rmansel\Documents\powershellnumlock.ps1 Under 'start in (optional)'I have added : C:\Users\rmansel\Documents Like I said, I have tried everything! From leaving 'start in' blank to putting different things in 'add parameters'. Nothing works. Like I wrote, it does start the task according to the task scheduler so I have set the triggers for the task correctly. Who can help? I would be so thankful! Best regards, Roy
1 Answers
The localization of your OS is not the issue, well, I don't know / use Dutch, so....
Anyway, as long as your task schedule is set this way:
General Tab Run only when user is loggerd on
Trigger Tab Begin the Task One an event Basic Log: System Source: Kernel-Power Event ID: 42 Enabled true
Action tab Program or script = powershell Add additional arguments = -noprofile -file d:\scripts\SetNumlock.ps1
The script only needs to contain one line
# Set Numlock
(New-Object -ComObject WScript.Shell).SendKeys('{NUMLOCK}')
You could have made this a .vbs file as well, with this content
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"
With this change to the
Action tab Program or script = d:\scripts\SetNumlock.vbs Add additional arguments =
I fully tested both of these on my LP70 laptop. So, I know they work. Yet, as I stated in my comment, you laptop hardware can be specific and cause issues with success depending on which you use and what that hardware vendor has in place.
- 5,136