Use WMI to Associate win32_SerialPort device with win32_LogicalDrive mapping

Hi,
My c# application requires to flash a micro-controller, which has been configured as a removable device and is connectable by means of a Virtual Com Port.
So, I need to recognise the volume label of the mapped drive and perform the flash using a simple file copy.
The problem is that some of the micro-controllers produce slightly different volume labels making it difficult to identify all possible cases via string comparison.
I know how to retrieve drive info for removable devices using DriveInfo.GetDrives(). This gives me the drive letter and the volume label
removableDriveList = (List<RemovableDrive>)DriveInfo.GetDrives()
        .Where(d => d.DriveType == DriveType.Removable)
        .Select(s => new RemovableDrive
                Drive = s.Name,
                Label = s.VolumeLabel
            }).ToList();
 I know how to detect the com port and recognisable description of the development boards using WMI to query Win32_SerialPorts.
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_SerialPort"))
        collection = searcher.Get();
var removableDevices = from ManagementObject x in collection
    where x.Properties["Name"].Value.ToString().Contains("MyManufacturer")
    select x;
    portName = (String)(removableDevices.First().GetPropertyValue("DeviceID"));
However, I can't associate the virtual com port with the drive mapping. I want to be able to say, this device with ID COM7, manufacturer "MyManufacturer", matches drive mapping "I:\My_Microcontroller".
I noticed (from device manager properties) that they both have the same container ID and are derived from the same usb controller, however I don't know how to access the this information from each child using WMI. Is this possible?
Thanks

Hello Marcpolo,
I move it to the desktop forum since it is more related with Windows Management Instrumentation development.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How do I associate a device with my Apple ID?

    I have an iPad and an iPhone.  I sync them with my iMac desktop computer, and never with any other.  I always use the same Apple ID.  As far as I know, it's the only one I have.
    Recently, I purchased an app using my iPad.  The next time I synced the iPad with the computer, I got an alert saying "The purchased item 'App' on the iPad
    'Etchemendy's iPad' could not be transferred to your iTunes library because you are not authorized for it on this computer."  The alert goes on, in fine print, to say, "To authorize this computer for items purchased from the iTunes Store, choose Store > Authorize This Computer."
    So I choose Store > Authorize This Computer, and I get a second alert saying, "This computer is already authorized."  A nifty little continuous loop that neatly precludes me from using the app on any device except the one I used to purchase it.
    But it gets better.  In stumbling around trying to figure out what's going on here, I accessed "My Account" using iTunes on my desktop computer (logging in with the same Apple ID I used to purchse the troublesome app).  When I click "Manage Devices," I arrive at a box that says, "These computers and devices are associated with your Apple ID for Automatic Downloads or to download previously purchased music, apps, and books..."  It then gives me a "list" showing just one device -- my iPhone.  The iPad is not shown here.  Neither is the desktop computer iTunes just told me is already authorized.  There's a button that says "Remove" next to the iPhone.  And two bigger buttons.  One says "Cancel" and the other says "Done."  There is no "add a device" option.
    So how to I associate a device with my Apple ID?  And, as a matter of fact, why aren't all the devices I registered using my Apple ID already associated with it?  I never had any of these problems till the big iOS system upgrade a few months ago.  Since which, my interactions with Apple have nearly all been nightmarish.  Apple obviously put the WAY wrong guy in charge of iOS development.
    Oh.  And BTW, when I look at the drop-down menu for choosing the "product" I'm having a problem with, only about half the devices registered with my Apple ID appear there.  And I have no clue what kind of iPad I currently have.  I have the warranty right in front of me, and all it says is "iPad WiFi 64GB Black." No doubt if I try to solve this using Apple phone support, I'll have to pay $20 to straighten out Apple's problem for them.  Which is why I'm here.

    My guess is you're using a long Apple ID and just omitted or mistyped a letter sometime, or something similar.
    Anyway, the way to recover is this:
    You cannot change ownership of the mistyped Apple ID to the correct one.  After all, the mistyped one purchased it.  However, you can authorize purchases from the mistyped Apple ID on your devices by doing Store > Authorize This Computer on iTunes on your computer, and enter the mistyped Apple ID and password.  Then sync again and you'll be all set.
    When you change computer (e.g., sell your current one and buy a replacement), you'll have to repeat this process.

  • I have two Apple IDs - one associated with iPad and iPhone and the other associated with iMac and MacAir. I am going to lose the former e-mail address imminently and would like to associate all devices with just one ID. How do I do this? Thanks

    I have two Apple IDs - one associated with iPad and iPhone and the other associated with iMac and MacAir. I am going to lose the former e-mail address imminently and would like to associate all devices with just one ID. How do I do this? Thanks

    Thanks - I guess it is like there were two of me!
    I bought the iPhone first and it seemed natural to link it to the (work) e-mail address which was in constant use. The iMac for home use came next and it seemed natural to use my home e-mail address, particularly as I knew by then that I would lose the work address after my imminent retirement. The same logic went for the recent puchase of the MacAir. I am not sure what happened with the iPad (also a recent purchase) - iTunes seemed to puch me towards the same ID as the iPhone.
    It is not a huge problem - just makes my persona look schizoid! Otherwise very happy with everything Apple.

  • Can i set up my iPad and iPod to use iMessage between the two devices with the same Apple ID?

    Can i set up my iPad and iPod to use iMessage between the two devices with the same Apple ID? SO i could iMessage if out from my iPod to my iPad at home to be viewed by a family member?

    Look into using Apple Configurator.  It's the easiest way to "reimage" and Manage iPads that I know of right now. 
    http://itunes.apple.com/us/app/apple-configurator/id434433123?mt=12
    Also, look into using the Educational Volume Purchase Program, if you have not already done so. 
    http://www.apple.com/education/volume-purchase-program/

  • Can I use iCloud to sync two devices with different apples Ids?

    Can I use iCloud to sync two devices with different apple ID's

    What do you mean by "apple ID"?  There's an ID you can use at the iTunes store to buy songs, apps, etc.  there's an ID you can use for your iCloud account - the two can be different or the same. So which service are you referring to when you talk about an apple ID?

  • Can I use a Plantronics m55 Bluetooth device with Skype for Iphone 4s

    Can I use a Plantronics m55 Bluetooth device with Iphone 4s for Skype call?

    only if the headset support a2dp bluetooth profile

  • Can I use Family sharing on a device with iOS 7?

    Can I use Family Sharing on a device that is not with iOS 8?

    Hi milxtor,
    To setup or use Family Sharing, you will need devices to be on iOS 8. Take a look at the article below for more details on setting that up. 
    Start or join a family group using Family Sharing
    http://support.apple.com/en-us/HT201088
    Take it easy,
    -Norm G.

  • Using a mtech hiface usb device with macbook air is producing a lot of static. when i touch the mac air it stops then starts when i remove my hand. Help?

    Im using a mtech hiface usb device for audio on my Mac Air. If i disconnect it from its ac and disconnect the hiface from the usb then take the Mac Air to a new location to work then return it I have an awful lot of static. im assuming its static electricity from the move or something. ive tried to ground it with my body by touching the mac air while touching something grounded. The static stops at that point but starts all over when i move my hand away from the computer. Any suggestions, could it be a setting in the USB? Thanks.

    how long have you had your ipod? mine did the same but after a while you need to get a new one because of the battery...

  • Associate a device with a DN using AXL API

    Hi guys,
    I am trying to add a DN to an existing phone device using AXL API via Java. I keep getting this error:
    Devices can only be associated with DNs, Route Patterns and Hunt Pilots.
    I have two existing lines on this device which I added through call manager, but now I am trying to add a third one using AXL API. This is what I did to get this error and I am not sure why:
    XDirn dn = new XDirn();
    dn.setPattern("6340");
    XPhoneLine phoneLine = new XPhoneLine();
    phoneLine.setDirn(dn);
    phoneLine.setAsciiLabel("TESTING - 6340");
    phoneLine.setDisplay("TESTING - 6340");
    phoneLine.setDisplayAscii("TESTING - 6340");
    phoneLine.setLabel("TESTING - 6340");
    phoneLine.setBusyTrigger("2");
    phoneLine.setIndex("3");
    phoneLine.setMaxNumCalls("4");
    UpdatePhoneReq updatePhone = new UpdatePhoneReq();
    updatePhone.setName("SEPD824BDBBCAF1");
    UpdatePhoneReq.Lines newLine =  new UpdatePhoneReq.Lines();
    newLine.getLine().add(phoneLine);
    updatePhone.setLines(newLine);
    port.updatePhone(updatePhone);
    the error occurs at the last line when I try to push the update.
    Thanks

    I just tried to execute SQL commands through the API and that is not working well either. The Axlsoaptoolkit.java file works fine but not through the API. this what I have done:
    ExecuteSQLQueryReq sqlReq = new ExecuteSQLQueryReq();
    sqlReq.setSql("select * from device");
    ExecuteSQLQueryRes sqlRes = port.executeSQLQuery(sqlReq);
    System.out.println(sqlRes.getReturn().getRow().get(0));
    System.out.println(sqlRes.getReturn().getRow().get(1));
    System.out.println(sqlRes.getReturn().getRow().get(2));
    This returns null on the first 3 rows where I have more than a 1500 entries in that table. I verified using the Axlsoaptoolkit.java app

  • HT203433 An apple id is already associated with my device ( i signed out of exising id and created a new one) and wont let me associate my device with a new apple id for 85 days. How do i get my new content purchased with new id onto my ipad?

    Hi, can anyone please tell me how I can receive downloads onto my ipad that i have purchased with a new apple id via itunes on my pc? I added a new apple id and signed out of existing one on my ipad and now receive a message saying that i cannot associate a new id for 85 days - and it won't let me download my purchased content onto the ipad even though i can purchase new content on my pc with the new id. The new content shows in my purchases when accessed on my ipad but the message appears when i attempt the download. I have set up the new id on both devices.
    Any suggestions?

    Yes. I have tried that. When I use the ID I had before, it sets it up as a new account and I don't want to lose my stats attached to my old account.
    Let's say that my old nickname was "user10" and I used the email, "[email protected]" for my apple id. I changed my apple id to "[email protected]" and it changed my game center account to "mynew" and somehow I am friends with my old acct, "user10". I tried getting a password reset for "user10" but I apparently don't know my own birthday, which is possible because I usually give a false one, but the same false one each time.

  • How do I use more than one USB device with Airport Extreme?

    I would like to plug a shared hard drive into my new airport extreme and still be able to plug in a shared printer as well. How am I supposed to do this with only one USB port. Do I use a USB hub???
    Is it possible to connect a hard drive using one of the ethernet ports?

    To use multiple USB devices you would use a powered USB hub.
    You can connect a hard drive to one of the Ethernet ports providing the hard drive is a NAS and supports Ethernet connections. In that situation the NAS hard drive is just like any other Ethernet client and the AirPort Extreme base station (AEBS) does not handle the file sharing services. The drive itself would provide the file sharing services.

  • HT4914 Can you use iTunes Match on multiple devices with different apple id's ?

    I have multiple phones with the same iTunes ID but they have different apple ID , will the iTunes Match work with all my devices ?

    I've got the latest version of iTunes & it's supposed to be able to be enabled under top panel "store" then appear down left side panel to subscribe. Which makes me think that it musn't be able to be used if you're running XP as it's not there....

  • Can I use a Telstra USB broadband device with my Macbook Air OS 10.7.4?

    Any advice about USB use with my Mac? I don't have regular access to WiFi. Thanks.

    Fixed from earlier thread.

  • Can I associate a device with more than 1 iCloud account, and still track on find my iPad?

    After one of my offices' iPads was stolen, I was made responsible for tracking them. I'd like to add them all to my iCloud account. If they were added to another iCloud account, could I still track them on mine? They are all retina iPads.

    You have to be signed into the iCloud account you are trying to track in order to track it, either on icloud.com or on the Find My iPhone App.  If you added them all to your iCloud account, they would all have full access to all your synced data: contacts, calendars, notes, photo stream photos, your iCloud email account, etc.  They would also all be backing up to your iCloud account, which would no doubt require a large storage upgrade to hold them all.  Also any data they sync with the account would be merged with yours so you would all end up with each other's contacts, calendars, etc. on your devices.
    So it's really not a good idea to try to put them all on your account.  Instead, you'll just need to get everyone's iCloud login credentials if they expect you to be able to log in and track all of these devices.

  • HT202213 Can I use home sharing on devices with different apple ids?

    I have my computer set up with my Id. Can my daughter use home sharing on her device with a different Id?

    I do not think so. See:
    Understanding Home Sharing
    Troubleshooting Home Sharing

Maybe you are looking for

  • Using USB Microphone With GarageBand iPad?

    Hi, I have the Samson G-Track USB Microphone and have been using it with GarageBand for iPad (with a powered USB hub) and I was wondering if there is a way to enable "Monitor" so that when I speak into the microphone I can hear myself in the headphon

  • How to make a procedure from a select statement please.....

    Dear All, i am new to oracle db, but i do have nice knowledge on sql in sql server, could you please help me.,,,,, in the below issue i do have below query in oracle db just joining two views, select docview.firstname as "First Name", docview.lastnam

  • How to create MS (Mid Side) tracks from a stereo file

    Hi everyone. Can anyone tell me how to create MS tracks from a stereo file? I used to do it on old analogue desks but can't figure how to it in logic. Would appreciate assistance.

  • New To OOPs ABAP

    Hi Friends, I am new to OOps ABAP, can any give me the differences between Procedural ABAP & OOps ABAP ? what is class ? what is Object ? thanks vijaya

  • Keyword filter has stopped working

    Whilst I can select any folder in my catalogue and the photos are displayed, complete with metadata, exif info, and keywords, selecting a keyword tag in the navigation panel just brings up a message that 'no photos match the filter'. The correct numb