Page 1 of 1 1
Topic Options
#184836 - 2008-01-25 11:10 AM Win32_Keyboard
objscripting Offline
Fresh Scripter

Registered: 2007-12-20
Posts: 14
Hi there,

I am using Win32_Keyboard to identify the plugged in keyboard(s). My problem is now that if someone is using a laptop with docking station is shows up with two keyboards.

 Code:
 
For Each $keyboard In GetObject('WinMgmts:root/cimv2').ExecQuery('select * from Win32_Keyboard', , 48)
	$keyboardLayout = Right($keybItem.Layout,3)
	$keyboard = $keyboardLayout
Next



Does someone know a way to identify if the keyboard is the notebook or the external one?

Chris

Top
#184837 - 2008-01-25 11:33 AM Re: Win32_Keyboard [Re: objscripting]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Nope, sorry, I don't have a docked Notebook here, so I can't help you.

The one thing I can do is to move this topic to the COM scripting forum, as it fits better there than in the starters forum ;\)
_________________________



Top
#184843 - 2008-01-25 12:13 PM Re: Win32_Keyboard [Re: Jochen]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
I have a docked notebook, and I can tell you that for my dockingstation WMI does not detect a second keyboard, but that is most likely because HP uses a port replicator so windows does not know there is a second keyboard. It will detect a second one if it is connected trough USB, but you don't need a docking station to test that \:\)
Top
#184848 - 2008-01-25 01:18 PM Re: Win32_Keyboard [Re: Arend_]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Still, my Notebook comes with an integrated keyboard, period. ;\)

No need for port replicators nor docking stations nor USB keyboards attached to the Notebook ... I think I am of not much help here, so I'll just shut up now
_________________________



Top
#184851 - 2008-01-25 02:45 PM Re: Win32_Keyboard [Re: Jochen]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I get two keyboards with a Lenovo + replicator.
Top
#184852 - 2008-01-25 02:52 PM Re: Win32_Keyboard [Re: Richard H.]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You should probably be able to tell which is the external one as it will be connected via USB, so just check the DeviceID or PNPDeviceID strings.

For example using this:
 Code:
For Each $keybItem In GetObject('WinMgmts:root/cimv2').ExecQuery('select * from Win32_Keyboard', , 48)
	 "Description: " $keybItem.Description ?
	 "     Layout: " $keybItem.Layout ?
	 "   DeviceID: " $keybItem.DeviceID ?
	 "PNPDeviceID: " $keybItem.PNPDeviceID ?
	?
Next


My laptop reports:
 Quote:
Description: USB Human Interface Device
Layout: 00000809
DeviceID: USB\VID_049F&PID_0051&MI_00\9&168AC4D9&0&0000
PNPDeviceID: USB\VID_049F&PID_0051&MI_00\9&168AC4D9&0&0000

Description: Standard 101/102-Key or Microsoft Natural PS/2 Keyboard
Layout: 00000809
DeviceID: ACPI\PNP0303\4&38462492&0
PNPDeviceID: ACPI\PNP0303\4&38462492&0


Clearly, the first device connected via USB is the external device.

Top
#184853 - 2008-01-25 04:19 PM Re: Win32_Keyboard [Re: Richard H.]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
 Originally Posted By: Richard H.
I get two keyboards with a Lenovo + replicator.

I think your 2nd keyboard is not PS2 then ;\)
I mean that the port replicator from lenovo (which is known for it's crap) just converts the ps2 to usb \:\)

WMI reports it as PS2 because thats the "name" of the keyboard. At least thats my way of getting out of the first line in this post :P


Edited by apronk (2008-01-25 04:21 PM)

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1362 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.048 seconds in which 0.021 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org