3

I am using a WMI query as part of a general diagnostic script, and I query the following:

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PnPEntity",,48) 
For Each objItem in colItems 
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_PnPEntity instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "ClassGuid: " & objItem.ClassGuid
Wscript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "DeviceID: " & objItem.DeviceID
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
Wscript.Echo "Service: " & objItem.Service
Wscript.Echo "Status: " & objItem.Status
Next

Whenever I run this on a workstation with PS/2 ports, I get that both a PS/2 Keyboard and Mouse (not present) are showing the error code for [Not Present, Not Working, No Driver Installed].

Is there any way to differentiate this from other devices that are actually failed? I'd like to still show PS/2 Errors, if possible, but dont see what I could use to separate these from the real entries.

Yablargo
  • 227
  • 1
  • 9
  • Visit all the machines that _do_ have PS/2 keyboards and mice, and replace them with USB keyboards and mice. – Michael Hampton Jan 24 '13 at 01:09
  • 1
    I agree with @MichaelHampton that you need to replace all your PS/2 hardware. But I also think that it is a significant aspect of professional systems administration to have to deal with antiquated systems. And because of that I don't think this question should be closed. – Ryan Ries Jan 24 '13 at 02:40
  • I can think of alot of servers lying around that are hooked up via older PS/2 kvms – Yablargo Jan 24 '13 at 16:06

1 Answers1

2

The Win32_PnPEntity WMI class represents the properties of a Plug and Play device.

The PS/2 interface dates from 1987, before there was such a thing as plug and play.

That said, take a look at the class definition linked above. The Availability and the ConfigManagerErrorCode members break it down into pretty granular status codes. Perhaps they can be of some use to you in differentiating your PS/2 devices. (Which you might be doing already.) You can also try cross-referencing that data with Win32_PointingDevice and Win32_Keyboard. Makes your job harder but that's probably the best you'll get from WMI.

Ryan Ries
  • 55,481
  • 10
  • 142
  • 199
  • Thanks. I did note I could query the mice fine and at least detect the presence. At this point beyond noting presence/absence I am going to shelf any further work on this because it is probably not worth the effort to significantly support PS/2. This is a script that gets deployed on thousands of systems and reports back to a central location. Thus it tries to detect as much as possible. Thanks! – Yablargo Jan 24 '13 at 16:07