Weekend Scripter: Discover the Power of WMI and PowerShell

Doctor Scripto

Summary: Guest blogger, Brian Wilhite, talks about using Windows PowerShell and WMI in the enterprise.

Microsoft Scripting Guy, Ed Wilson, is here. Brian Wilhite is with us today to share a preview of his presentation for Windows PowerShell Saturday, whiche is coming to you in two weeks on September 15 in Charlotte. NC.

Photo of Brian Wilhite

If you’re like me and most system administrators, you are challenged daily to do more with less. Windows PowerShell, coupled with WMI, is one awesome duo, like Magic/Kareem, Jordan/Pippen, or Kobe/Shaq—you get the idea. With this duo, you know that you’ll be able to get the job done quickly, effectively, and efficiently. I use Windows PowerShell and WMI frequently, especially when my manager asks questions like, “How many computers do we have in our environment that are running Windows 2003 Server with Service Pack 1 or less?” Obviously, Windows PowerShell and WMI are on the top of my list when addressing this very question in a timely manner.

With the release of Windows 8 and Windows Server 2012, a few new players emerge that will change the way we interact with the CIM/WMI model within Windows. If you’re not familiar with these new “players,” you can quickly identify them with the following Windows PowerShell one-liner:

Image of command output

As I briefly mentioned earlier, if someone needs information quickly, and you don’t quite remember what WMI class has the particulars needed, Get-CimClass comes to the rescue. I know I’m going to need server name, operating system, and service pack data elements, so what class has that information? I could run Get-CimClass and wade through all 1100 WMI classes to try to find what I need, or I could simply run the following Windows PowerShell command and pinpoint exactly what I’m looking for.

Image of command output

The Win32_OperatingSystem WMI class looks like something I can use and it appears to have a property similar to “Service Pack.”

I’ve run out of time for now, but the good news is that there is more to come on September 15, when we will get deeper into detail with my “Discovering the Power of WMI and PowerShell in the Enterprise” session at the second Windows PowerShell Saturday.

~Brian

Thank you, Brian, for sharing this sneak peek.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

0 comments

Discussion is closed.

Feedback usabilla icon