Set HyperV VM to have NumLock set on as default
(2026-07-24)
Problem:
By default, Hyper-V VMs have NumLock disabled. If your workstation has NumLock enabled, clicking into a Hyper-V console will set your NumLock to disabled, a state which remains when you click out of it.
If you use your number pad then this becomes annoying really quickly.
Solution:
This setting has to be changed per-VM, only when the VM is powered off. Run the following powershell as a Hyper-V admin:
function Set-VMNumLock {
param(
[Microsoft.HyperV.PowerShell.ComputeResource]$vm,
[bool]$NumLockEnabled
)
# Get underlying settings object with reflection
$ComputerResourceType = [Microsoft.HyperV.PowerShell.ComputeResource]
$SettingField = $ComputerResourceType.GetDeclaredField("_settings")
$settingUpdater = $SettingField.GetValue($vm)
$vmComputerSystemView = $settingUpdater.GetData([Microsoft.HyperV.Powershell.UpdatePolicy]::EnsureUpdated)
$vmComputerSystemView.BiosNumLock = $NumLockEnabled
$vmComputerSystemView.Put()
}
$vm = Get-VM -VMName “IT-LibreNMS”
Set-VMNumLock -vm $vm -NumLockEnabled $true