Questions tagged [wmi]

Windows Management Instrumentation (WMI) is an API for managing the Windows operating system on local or remote computers.

4365 questions
11
votes
3 answers

WMI EnableDHCP fails on disconnected adapter

I'm using the WMI Win32_NetworkAdapterConfiguration Class EnableDHCP Method to enable the DHCP service on a network adapter. I'm using XP Embedded with SP2 but it also happens on my desktop (XP SP3). Everything works great except when the network…
markh44
  • 5,804
  • 5
  • 28
  • 33
11
votes
3 answers

How to reliably and quickly get the MAC address of a network card given its device instance ID

Given a device instance ID for a network card, I would like to know its MAC address. Example device instance ID on my system for integrated Intel Gigabit card: PCI\VEN_8086&DEV_10CC&SUBSYS_00008086&REV_00\3&33FD14CA&0&C8 So far, the algorithm I…
James Johnston
  • 9,264
  • 9
  • 48
  • 76
11
votes
1 answer

How can I improve WMI performance in .NET?

I've inherited code that makes numerous remote WMI calls. When I repeatedly pause execution and look at the call-stack it's almost always in a ManagementScope.Connect() call. A new connection seems to be made with each WQL query. Despite limited…
devgeezer
  • 4,159
  • 1
  • 20
  • 26
10
votes
1 answer

Understanding the WMI object path format

I want to write a class with similar funcionality as the .NET ManagementPath class. On MSDN is a set of articles which handles the format of object paths. However, I don't understand it yet with all special cases String comparisons that deal with…
Etan
  • 17,014
  • 17
  • 89
  • 148
10
votes
1 answer

how to hook to events / messages in windows using python

in short: i want to intercept suspend/standby messages on my laptop, but my program doesn't receives all relevant messages. background: there's a bug in ms-excel on windows xp/2k, which prevents system suspend if a file is opened on a network/usb…
Berry Tsakala
  • 15,313
  • 12
  • 57
  • 80
10
votes
5 answers

How can I look up IIS site id in C#?

I am writing an installer class for my web service. In many cases when I use WMI (e.g. when creating virtual directories) I have to know the siteId to provide the correct metabasePath to the site, e.g.: metabasePath is of the form…
Grzenio
  • 35,875
  • 47
  • 158
  • 240
10
votes
5 answers

How can I resolve a "Provider load failure" for WMI requests?

I'm using WMI to collect system information. It works fine on every system I've tested it on, but I have one or two users that are reporting problems. The debug logs show the WMI code is throwing a "Provider load failure" exception. I haven't…
Chris Thompson
  • 16,203
  • 9
  • 45
  • 62
10
votes
1 answer

Using WMI to identify which device caused a Win32_DeviceChangeEvent

I have been writing some code that detects add and removal of USB devices, and I've used the following WMI code to register for device change notifications: watcher = new ManagementEventWatcher(query); watcher.EventArrived += new…
warriorpostman
  • 2,268
  • 2
  • 16
  • 26
10
votes
4 answers

How can we get a CPU temperature through WMI?

I installed WMI code creator from here, and I'm wondering how we can use it to get the CPU temperature. The application gives many options (as shown below), but I am not sure where I have to click to get the CPU temperature. I went to the…
user5447339
10
votes
3 answers

Unit testing with network-reliant code

I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing…
VanOrman
  • 4,351
  • 5
  • 35
  • 31
10
votes
1 answer

DisconnectedContext MDA when calling WMI functions in single-threaded application

I write an app in C#, .NET 3.0 in VS2005 with a feature of monitoring insertion/ejection of various removable drives (USB flash disks, CD-ROMs etc.). I did not want to use WMI, since it can be sometimes ambiguous (e.g. it can spawn multiple…
Aleksander
  • 238
  • 2
  • 8
10
votes
1 answer

How to differentiate between dedicated and integrated gpu card via c++?

I want to know via WMI or other means in c++ if the user has integrated or dedicated GPU card? I have gone over Win32_VideoController and could not find anything that will help me to differentiate between the two. Thanks in advance.
MickCic
  • 145
  • 2
  • 10
10
votes
3 answers

C# Accessing management objects in ManagementObjectCollection

I'm trying to access ManagementObjects in ManagementObjectCollection without using a foreach statement, maybe I'm missing something but I can't figure out how to do it, I need to do something like the following: ManagementObjectSearcher query = new…
Jamesla
  • 1,378
  • 7
  • 31
  • 62
10
votes
9 answers

Remote WMI connection

I want to connect to remote PC running Windows 7, from another PC using ManagementScope on a local network. On remote PC I've created a new user account "Samuel" without password and set as administrator. ConnectionOptions options = new…
shlomjmi
  • 667
  • 3
  • 12
  • 16
10
votes
2 answers

How to join in a WMI Query (WQL)

I want to get the serial number of the boot-harddisk via a WQL query. The boot-partition can be retrieved using the following query: SELECT * FROM Win32_DiskPartition where BootPartition=True The serial number is in Win32_DiskDrive: SELECT…
j00hi
  • 5,420
  • 3
  • 45
  • 82