How to check for presence of hardware devices via WMI script (PnPEntity)

By | January 2, 2011

In some cases devices are installed on some units and not others even within model groupings.  In my experience, I was looking to target certain Panasonic Toughbook laptops with Embedded Wireless cards installed to install the required software resources to address those needs.  Needless to say, the Wireless switches needed to switched to the “on” position for the OS to see the devices when the script was run.

See example script below to check for the presence of an AT&T Novatel EU860 module:


‘ NAME:  PNPCheck.vbs

‘ AUTHOR: Brian Gonzalez
‘ DATE  : 4/5/2010


If PNPCheck(“VID_1410&PID_2420”) Then ‘Novatel EU860 modem check
MsgBox(“ATT EU860 modem is present”)
End If

Function PNPCheck(DeviceName)
‘PNPID = “%VEN_1022&DEV_2000%” ‘VMWare NIC
Set objWMIService1 = GetObject(“winmgmts:\\.\root\CIMV2”)
Set colItems = objWMIService1.ExecQuery(“Select DeviceID FROM Win32_PnPEntity Where DeviceID LIKE “”%” & PnpID & “%”””)
If colItems.Count > 0 Then
PNPCheck = True
PNPCheck = False
End If
End Function

Leave a Reply

Your email address will not be published. Required fields are marked *