Select Page

Happy New Year everyone! 2016 is going to completely ROCK! I love the feeling of optimism with all new beginnings, and the beginning of the year always has me take time to think about what was great about the previous year and what is going to be great about the next! I’m thinking WMI may be a recurring topic this year!

Strictly work perspective here, but I think much of the technology I will embrace this year is going to be expanding on the breadth of the configuration space. Working with Desired State Configuration, building on that momentum. Working with cross platform challenges and building or exploring solutions in that arena. Continuing to develop skills in important areas related to configuration management and solving real regulatory compliance issues around configuration. Lots to do, a mountain to climb, but it is going to be fun!

PowerShell, WMI and the [wmisearcher]

Today I wanted to share a little tidbit I was working on related to PowerShell and WMI. As Forest Gump would say, these two things go together “like peas and carrots”. A full working knowledge and skills development around WMI will increase your reach in incredible ways. It seems like even though I’ve been working with WMI since before SMS 2.0 came out (read: a very long time ago!), I still learn new things all the time.

I was reading a PowerShell about topic, specifically about_WQL and began playing with this accelerator. I realized it is something that deserves some attention. It is relatively simple, just cast your variable as a [wmisearcher] type and begin exploring.

casting type as wmisearcher

WMI and [wmisearcher] type cast

Now you have access to the object. It is a System.Management.ManagementObjectSearcher type and you can execute the query, find the options on the object, execute the query with the get() method. You can also manipulate this object on the fly. Super helpful in scripts and automation. This is an interesting item to have in your back pocket for sure.

WMI and wmisearcher type accelerator

WMI and [wmisearcher] type accelerator

Clearly a super simple example above but I imagine you can see the possibilities. Give it a spin, explore and share your ideas.