tags:

views:

68

answers:

3

I used WMI way back during the .net 2.0 days. I had to use it coz there was no alternative. But today as we have a lot of functionality in BCL, does it still makes sense to use WMI? Is it supported by MS - Should I use this in my production code?

One of the things I hate about it is that I need to write string query. It is prone to typo errors, no syntax check. I could convert it to C# classes using Management Strongly Typed Class Generator (Mgmtclassgen.exe) but it still takes string arguments as path.

A: 

We still actually use it in some of our production code, a toolkit for historical monitoring of various server performance and configuration details.

It was very handy for us since it was quite easy to put together some VBScript files under the control of Scheduled Tasks which did the data collection and transmission. This makes it runnable on a wide variety of Windows boxes without having to worry about compiling to the right target. It also allowed very fast bug fixing in the field since we can just ship a simple text file.

The fact that the source code is viewable is of no concern to us, it's not as if the idea of using WMI to collect data is some sort of precious IP :-)

I'm sure there's better tools but this was the simplest way we found. As far as I'm aware, it's still supported, inasmuch as they're still providing it in the later operating systems.

The only thing that burnt us (once) was the subtle changes between releases, such as objects themselves being deprecated or removed, making the WMI queries useless. We just need to watch out for that happening and adjust the scripts as necessary.

paxdiablo
+1  A: 

I would say that the WMI support in PowerShell is a pretty good indicator that WMI still has a future. I use it from time to time for remote administration to perform certain maintenance tasks.

kbrimington
A: 

WMI Is still intensively used by monitoring systems. For example it is used by Microsoft Operations Manager. Also as already mentioned you can see WMI support in PowerShell.

I would suggest you also to check this in ServerFault as IT Administrators must be well aware about it also.

Incognito