Find USB to Serial device via WMI

Posted on 2007-10-09
Last Modified: 2013-11-26
I'm writing an appication that talks to a small symbol scanner.

I need a way to find teh serial port the scanner is connected to. It uses a serial to USB adaptor that I know the name of and could easily identify. I've been trying to locate the device using WMI with no luck. I've tried several classes including the  Win32_SerialPort class which returns the serial port that is on the motherboard but not the one created by the USB to serial adapter. Trying to search the USB devices hasn't gotten me any closer either.

Here is an example of some of the code I've tried:
Dim scope As New ManagementScope("\\.\root\cimv2")

      Dim objectQuery As New ObjectQuery("SELECT * FROM Win32_SerialPort")
      Dim searcher As New ManagementObjectSearcher(scope, objectQuery)
      Dim os As ManagementObject
      Dim moColl As ManagementObjectCollection = searcher.Get()
      Dim sep As String = vbCrLf
      For Each os In moColl
      Next os
Question by:Chad Penney
    1 Comment
    LVL 16

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now