# Get-Mouseinfo.ps1
# Sample 7 on http://msdn.microsoft.com/en-us/library/aa394587(VS.85).aspx
# Gets properties of the mouse using Win32_PointingDevice
# Thomas Lee - tfl@psp.co.uk
# Get Mouse information
$mouse = Get-WmiObject -Class Win32_PointingDevice
# Decode detalis
function Deviceinterface {
param ($value)
switch ($value) {
0 {"Other"}
1 {"Unknown"}
3 {"Serial"}
4 {"PS/2"}
5 {"Infrared"}
6 {"HP-HIL"}
7 {"Bus Mouse"}
8 {"ADP (Apple Desktop Bus)"}
160 {"Bus Mouse DB-9"}
161 {"Bus Mouse Micro-DIN"}
162 {"USB"}
}
}
function Handedness {
param ($value)
switch ($value) {
0 {"Unknown"}
1 {"Not Applicable"}
2 {"Right-Handed Operation"}
3 {"Left-Handed Operation"}
}
}
function Pointingtype {
param ($value)
switch ($value) {
1 {"Other"}
2 {"Unknown"}
3 {"Mouse"}
4 {"Track Ball"}
5 {"Track Point"}
6 {"Glide Point"}
7 {"Touch Pad"}
8 {"Touch Screen"}
9 {"Mouse - Optical Sensor"}
}
}
# Display details
"Mouse Information on System: {0}" -f $mouse.systemname
"Description : {0}" -f $mouse.Description
"Device ID : {0}" -f $mouse.DeviceID
"Device Interface : {0}" -f (Deviceinterface($mouse.DeviceInterface))
"Double Speed Threshold : {0}" -f $mouse.DoubleSpeedThreshold
"Handedness : {0}" -f (Handedness($mouse.handedness))
"Hardware Type : {0}" -f $mouse.Hardwaretype
"INF FIle Name : {0}" -f $mouse.InfFileName
"Inf Section : {0}" -f $mouse.InfSection
"Manufacturer : {0}" -f $mouse.Manufacturer
"Name : {0}" -f $mouse.Name
"Number of buttons : {0}" -f $mouse.NumberOfButtons
"PNP Device ID : {0}" -f $mouse.PNPDeviceID
"Pointing Type : {0}" -f (Pointingtype ($mouse.PointingType))
"Quad Speed Threshold : {0}" -f $mouse.QuadSpeedThreshold
"Resolution : {0}" -f $mouse.Resolution
"Sample Rate : {0}" -f $mouse.SampleRate
"Synch : {0}" -f $mouse.Synch
This script produces the following output:
PSH [D:\foo]: .\get-mouseinfo.ps1
Mouse Information on System: UK0N055
Description : Alps Touch Pad
Device ID : ACPI\PNP0F13\4&25E2FF18&0
Device Interface : Unknown
Double Speed Threshold : 6
Handedness : Right-Handed Operation
Hardware Type : Alps Touch Pad
INF FIle Name : oem0.inf
Inf Section : MouFilter_Inst
Manufacturer : Alps Electric
Name : Alps Touch Pad
Number of buttons : 2
PNP Device ID : ACPI\PNP0F13\4&25E2FF18&0
Pointing Type : Unknown
Quad Speed Threshold : 10
Resolution :
Sample Rate :
Synch :