PowerShell: Get Keyboard Information
Need to check what keyboard(s) are connected to a machine - for hardware inventory or troubleshooting an input device issue? This one-liner pulls it straight from the system.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Get-CimInstance -ClassName Win32_Keyboard | Select-Object Description, Status, NumberOfFunctionKeys
Example Output:
Description Status NumberOfFunctionKeys
----------- ------ --------------------
USB Input Device OK 12
HID Keyboard Device OK 12
Logitech USB Input Device OK 12
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Get-CimInstance -ClassName Win32_Keyboard queries all keyboard devices recognized by the system - it's common to see more than one entry, since a single physical keyboard can register as multiple logical devices (a standard USB input device plus a separate HID-compliant entry).
- Description identifies each device, often showing the manufacturer name or a generic Windows-assigned label.
- Status shows OK if the device is functioning correctly.
- NumberOfFunctionKeys returns how many function keys (F1-F12, etc.) the keyboard reports having.