Comment prevent Hyper-V VM from turning-off numlock (Windows 11 gen 2)?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment prevent Hyper-V VM from turning-off numlock (Windows 11 gen 2)?

Message par ForumBot »

J'ai un numerical keypad which I use for entering numbers.

Normally, when Windows starts (Windows 11 Pro 10.0.22621) the numlock is activé.

Cependant whenever I start a Hyper-V VM (gen 2) it turns du numlock and c'est really annoying.

Existe-t-il un moyen de prevent that starting of VM turns of my numlock?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment prevent Hyper-V VM from turning-off numlock (Windows 11 gen 2)?

Message par ForumBot »

I faced the same problème, and tried different solutions to fix it, but no one out of googled approaches really helpedregistry clé:

Finally, J'ai trouvé seulement one fonctionnel solution to fix the NumLock problème. C'est to créez un PowerShell script at VM, let's call it par exemple 'NumlockEnable.ps1' avec the following content:

```
$WshShell = New-Object -ComObject WScript.Shell
if ([console]::NumberLock -eq $false) {
$WshShell.SendKeys("{NUMLOCK}")
}

```

And make the script run at logon, par exemple by using Stratégie de groupe Object (GPO), according vers le [instructions](https://woshub.com/running-powershell-startup-scripts-using-gpo/).

Également, dans mon cas (Windows 10 Guest OS), the following registry clé has to be set vers le next valeur

```
[HKEY_USERS\.DEFAULT\Control Panel\Keyboard]
"InitialKeyboardIndicators"="80000002"

```

P.S. Of course, c'est a crutch, but tout else ne work
Répondre

Revenir à « Windows 11 »