Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 50723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:38:17+00:00 2026-05-10T16:38:17+00:00

I need my program to work only with certain USB Flash drives (from a

  • 0

I need my program to work only with certain USB Flash drives (from a single manufacturer) and ignore all other USB Flash drives (from any other manufacturers).

is it possible to check that specific USB card is inserted on windows using .NET 2.0? how?

if I find it through WMI, can I somehow determine which drive letter the USB drive is on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:38:17+00:00Added an answer on May 10, 2026 at 4:38 pm

    EDIT: Added code to print drive letter.


    Check if this example works for you. It uses WMI.

    Console.WriteLine('Manufacturer: {0}', queryObj['Manufacturer']); ... Console.WriteLine('    Name: {0}', c['Name']); // here it will print drive letter 

    The full code sample:

    namespace WMISample {     using System;     using System.Management;      public class MyWMIQuery     {         public static void Main()         {             try             {                 ManagementObjectSearcher searcher =                     new ManagementObjectSearcher('root\\CIMV2',                     'SELECT * FROM Win32_DiskDrive');                  foreach (ManagementObject queryObj in searcher.Get())                 {                     Console.WriteLine('DeviceID: {0}', queryObj['DeviceID']);                     Console.WriteLine('PNPDeviceID: {0}', queryObj['PNPDeviceID']);                     Console.WriteLine('Manufacturer: {0}', queryObj['Manufacturer']);                     Console.WriteLine('Model: {0}', queryObj['Model']);                     foreach (ManagementObject b in queryObj.GetRelated('Win32_DiskPartition'))                     {                         Console.WriteLine('  Name: {0}', b['Name']);                         foreach (ManagementBaseObject c in b.GetRelated('Win32_LogicalDisk'))                         {                             Console.WriteLine('    Name: {0}', c['Name']); // here it will print drive letter                         }                     }                     // ...                     Console.WriteLine('--------------------------------------------');                 }                   }             catch (ManagementException e)             {                 Console.WriteLine(e.StackTrace);             }              Console.ReadLine();         }     } } 

    I think those properties should help you distinguish genuine USB drives from the others. Test with several pen drives to check if the values are the same. See full reference for Win32_DiskDrive properties here:

    http://msdn.microsoft.com/en-us/library/aa394132(VS.85).aspx

    Check if this article is also of any help to you:

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/48a9758c-d4db-4144-bad1-e87f2e9fc979

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 77k
  • Answers 77k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer An IEEE754 64-bit double can represent any 32-bit integer, simply… May 11, 2026 at 3:32 pm
  • added an answer Try getting a log file of the Installation, and look… May 11, 2026 at 3:32 pm
  • added an answer Let me preface this by saying: Be careful with that… May 11, 2026 at 3:32 pm

Related Questions

So I have a couple of functions that work with a string type I
(I'm using the pyprocessing module in this example, but replacing processing with multiprocessing should
I need to make sure that user can run only one instance of my
Since I've been learning Java, I've been able to create GUI programs. However, even

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.