none
Script to find connected or disconnected state of PS/2 Keyboard & Desktop Monitor RRS feed

  • Question

  • I tried to create WMI Script using Win32_Keyboard & Win32_DesktopMonitor class to find whether the device is connected or not. It works when the device is connected. However it does not detect when the device is disconnected. Device Manager continue to show the device until the desktop is rebooted. I tried with several other Win32 class but it did not work. Is there a way to find the disconnected state of this device.
    Friday, October 31, 2014 8:19 PM

Answers

  • Sometimes there is not a technological solution to a human problem. Perhaps training is needed to tell the people not to disconnect the devices.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, November 12, 2014 3:17 PM
    Moderator

All replies

  • Depends on the hardware vendor and OS. Have you looked at the "status"?


    ¯\_(ツ)_/¯

    Friday, October 31, 2014 9:19 PM
  • Yes. The status output was always given as "OK" irrespective of whether the device is connected or not
    Saturday, November 1, 2014 3:24 AM
  • So then, it would seem that you would not be able to use WMI to determine if they are connected or not connected.

    -- Bill Stewart [Bill_Stewart]

    Saturday, November 1, 2014 3:56 PM
    Moderator
  • Thanks . Any other means to find the status?
    Saturday, November 1, 2014 4:59 PM
  • You're going to need to do your own research, but I suspect you're not going to be able to find this status using standard script APIs.

    -- Bill Stewart [Bill_Stewart]

    Saturday, November 1, 2014 7:29 PM
    Moderator
  • You can try this.  When some devices are disconnected the driver unloads.

    http://msdn.microsoft.com/en-us/library/windows/hardware/ff544831(v=vs.85).aspx


    ¯\_(ツ)_/¯

    Saturday, November 1, 2014 7:38 PM
  • I don't think that's the case for old PS/2 devices. Which leads me to wonder what's provoking the question.

    -- Bill Stewart [Bill_Stewart]

    Saturday, November 1, 2014 8:29 PM
    Moderator
  • Most often when a user asks about a "PS/2" keyboard they mean and keyboard connected in any way.  I just bought a new wireless keyboard.  The box is marked PS/2 keyboard. (compatible).  This is trying to indicate the PS/2 keyboard layout and not the old PS/2 connector.

    We can trap on all PNP events in WMI.  This is one way assuming a PNP keyboard and monitor.\

    To find if this is PNP use tis query

    gwmi Win32_PnPEntity -filter 'Name like "%keyboard%"'
    gwmi Win32_PnPEntity -filter 'Name like "%Monitor%"'


    ¯\_(ツ)_/¯

    Saturday, November 1, 2014 8:49 PM
  • Maybe it's just me, but I was just assuming that when the OP wrote "PS/2 keyboard" they actually meant "PS/2 keyboard". Perhaps you are correct that they are actually using incorrect terminology.

    But we still don't know what's provoking the question.


    -- Bill Stewart [Bill_Stewart]

    Sunday, November 2, 2014 1:43 AM
    Moderator
  • I agree but...old PS/2 keyboard ports - the round ones - cannot usually be detected.  USB keyboards connected by other means can be detected and may be labeled , on the box, PS/2.

    We will have to wait for clarification.


    ¯\_(ツ)_/¯

    Sunday, November 2, 2014 1:52 AM
  • I bet no motherboards built in the last couple of years even have actual PS/2 ports any more...

    -- Bill Stewart [Bill_Stewart]

    Sunday, November 2, 2014 1:56 AM
    Moderator
  • I haven't seen one.

    ¯\_(ツ)_/¯

    Sunday, November 2, 2014 2:00 AM
  • Thank you for your inputs. I will try these options and update. I appreciate all your input.
    Sunday, November 2, 2014 4:53 AM
  • You haven't said why you need to do this.

    -- Bill Stewart [Bill_Stewart]

    Sunday, November 2, 2014 2:36 PM
    Moderator
  • I have a requirement to monitor these devices where they are used by people who are from manufacturing background. Many times we found the devices are removed for un-known reasons and call is logged that computeris not working
    Wednesday, November 12, 2014 1:17 PM
  • Sometimes there is not a technological solution to a human problem. Perhaps training is needed to tell the people not to disconnect the devices.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, November 12, 2014 3:17 PM
    Moderator