Jeremy's Blog

Tag: WMI

LinqToWMI Project

by Jeremy on Aug.02, 2008, under General Ramblings

As classes and consulting work at Omega Vortex keep pushing me more and more into .NET development, I thought it would be a good time as any to try to start learning new things and try to keep my mind working on this stuff. I decided to start looking for an Open Source project that I could contribute to.

After noticing someone on Twitter mention a LINQ to WMI project, it seemed like the perfect fit. LINQ (Language-Integrated Query) is something I’m not too familiar with and want to learn. While I’m somewhat familiar with WMI (Windows Management Instrumentation), it’s huge. There’s still plenty left to be learned about it.

I’ve become a developer on the LinqToWMI project at Microsoft’s CodePlex and I’ve already made two major updates for those who are interested. One of which is the ability to generate “Commonly Used” WMI classes instead of just generating the ones you need one at a time. The next is a major speed enhancing change on the ClassGenerator.

It came to my attention while testing the project that it would crash with a NullReferenceException if there were no instances available of the class you wanted to generate. (Example: It would crash when trying to generate a Win32_FloppyDrive class. My laptop has no floppy drive.) In re-working the generator to not use an instance to generate code from, we gained a pretty huge speed boost from not having to search for an instance. Before, it took about 4 or 5 seconds to generate around 15 classes. Now it takes a fraction of a second.

If you’re needing to use the WMI on a project and want an easy way to query it, give this project a shot. If you think it’s good, help us out by contributing patches or bug reports so we can make the project even better.

Comments Off :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!