Click here to Skip to main content
16,019,087 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi!

I am using the following code to find out the list of drivers. This code is working only in the Administrator Mode not in the User Mode. For this code I am referencing the System dll "System.managment.dll".I want to find the list of readers in the User Mode also.
C#
try
           {
               // string s = "";
               ManagementObjectSearcher searcher =
                   new ManagementObjectSearcher("root\\CIMV2",
                   "SELECT * FROM Win32_PnPEntity");

               foreach (ManagementObject queryObj in searcher.Get())
               {
                   string s = "";

                   s = queryObj["Caption"].ToString();
               }
           }
           catch (ManagementException e1)
           {
           }

Thanks
Posted
Updated 19-Mar-12 19:43pm
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900