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 IfFunction PNPCheck(DeviceName)
‘PNPID = “%VID_04DA&PID_250C%” ‘GOBI PNP ID
‘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
Else
PNPCheck = False
End If
End Function
Sorry for necro-posting but your code is incorrect.
Where DeviceID LIKE “”%” & PnpID & “%”””)
Should be:
Where DeviceID LIKE “”%” & DeviceName & “%”””)
The device id when passed to the PNPCheck function is called DeviceName not PnpID .
Where DeviceID LIKE “”%” & PnpID & “%”””
should be
Where DeviceID LIKE “”%” & DeviceName & “%”””