title: VBScript to check driver status with WQL query
body: <p>I'm trying to write a script that will check if a device is currently at an error level (has a yellow bang in Device Manager). The ultimate task I'm trying to automate is installing a driver, checking if it installed correctly, uninstalling, and then checking again to verify that it uninstalled. I've got most of that figured out but I am having trouble with the WQL query. I can query if any drivers have an error level other than 0, and I can query if any drivers have a specific device ID, but when I try to do both it fails with "drivertest.vbs(4,1) Microsoft VBSCript runtime error: type mismatch: '[string: "Select * from Win32_"]'  This is the code I have:</p>
  
  <pre><code>strComputer = "."
  Set objWMIService = GetObject(_
      "winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")
  Set colItems = objWMIService.ExecQuery _
      ("Select * from Win32_PnPEntity " _
          &amp; "WHERE ConfigManagerErrorCode &lt;&gt; 0" AND "WHERE objItem.DeviceID = 'acpi\int33d6'")
  For Each objItem in colItems
      Wscript.Echo "Class GUID: " &amp; objItem.ClassGuid
      Wscript.Echo "Description: " &amp; objItem.Description
      Wscript.Echo "Device ID: " &amp; objItem.DeviceID
      Wscript.Echo "Manufacturer: " &amp; objItem.Manufacturer
      Wscript.Echo "Name: " &amp; objItem.Name
      Wscript.Echo "PNP Device ID: " &amp; objItem.PNPDeviceID
      Wscript.Echo "Service: " &amp; objItem.Service
  Next
  </code></pre>