Numlock Please

I've been using Hyper-V for development work lately and it's been fine, just like any other hypervisor. However, there is one nagging issue, numlock gets disabled when jumping between guests. What the heck? I haven't experienced this behavior with KVM, VirtualBox or VMWare and it's really not worth figuring out the cause when PowerShell can keep your numlock enabled.

 

$objWord = New-Object -ComObject "Word.Application"
$wsh = New-Object -ComObject WScript.Shell

try { while ($true) { if (-not $objWord.NumLock) { $wsh.SendKeys('{NUMLOCK}') } Start-Sleep -Seconds 1 } } catch { # I know this is bad but I don't care. } finally { $objWord.Quit() Remove-Variable "wsh" }