Is it safe to use WMI in .NET?

J. Scott Elblein

Well-known member
Joined
Dec 14, 2006
Messages
166
Location
Chicago
Programming Experience
10+
I have tried using a few small routines utilizing WMI in some older VB6 apps, and after distributing it, seems like i got a lot of users contacting me saying this or that 'isn't working', which ended up being WMI related. I usually had to tell them to make sure WMI was installed on their computer, and finding the version that is right for their machine (win9x, xp, etc.) online to provide a link for them was also kind of a pain.:eek:

I am looking through he Microsoft WMI tool, and WMI seems really nice to use with tons of features, but will it be more of a pain than it's worth once the .NET app is distributed?

As a side question to the above, does .NET somehow automatically include WMI buitl into the namespaces? Or is it still a separate entity?

Thanks!
 
.Net has WMI built into System.Management namespace, this also requires to add the extra reference to the .Net library System.Management.dll if you want to use it.

My impression is that much but not all of the WMI library goes with Win9x, and all(?) with Win2000/XP. Since Win9x is officially not a supported OS range any longer, also you are "allowed" to remove them from your support list.
 
It is safe, it is still Microsofts system management api of choice, and still shows up in their development exams as a topic. One thing I will say is that most of the emphasis I see is using the WMI query language (WQL) to accomplish things.

There is (or was) another approach for WMI that I don't see mentioned much , used to be common I want to say circa 2003 where you create a com object and iterate over a collection of lets say windows services. I think it was OLE based and not very resource efficient.
 
Back
Top