By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,321 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,321 IT Pros & Developers. It's quick & easy.

Enumerating devices: disabled devices not shown

P: n/a
I am using the following code to enumerate devices on the local
computer:

ManagementObjectSearcher searcher = new
ManagementObjectSearcher("SELECT * from Win32_PnPEntity");
ManagementObjectCollection devices = searcher.Get();

foreach (ManagementObject device in devices)
Console.WriteLine(device.Properties["DeviceId"].Value.ToString());
It only shows enabled devices. If I disable the LPT printer port (using
the Windows XP device manager GUI), it no longers is in the query
results.
How can I get the query to return all devices, enabled and disabled?

This leads to the next question: how can I enable or disable devices
from the .Net framework?

May 4 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.