Chapter 14. Using Windows Management Instrumentation and CIM

We’ve been looking forward to writing this chapter, and dreading it at the same time. Windows Management Instrumentation (WMI) is probably one of the best things Microsoft has ever offered to administrators. It’s also one of the worst things the company has ever inflicted on us. WMI offers a way to gather an amazing amount of system information from a computer. But it can sometimes feel arcane, and the documentation is far from user friendly. In this chapter, we introduce you to WMI the PowerShell way, showing you how it works and explaining some of its less beautiful aspects, to provide you with full disclosure on what you’re up against.

We want to emphasize that WMI is an external technology; PowerShell merely interfaces with it. The focus in this chapter is on how PowerShell does that, and not on the underlying guts of WMI itself. If you’d like to explore WMI further, we offer some suggestions at the end of this chapter. Keep in mind that PowerShell v3 has made some amazing strides in minimizing how much you have to touch WMI yourself, which greatly improves the situation.

14.1. WMI essentials

14.2. The bad news about WMI

14.3. Exploring WMI

14.4. Choose your weapon: WMI or CIM

14.5. Using Get-WmiObject

14.6. Using Get-CimInstance

14.7. WMI documentation

14.8. Common points of confusion

14.9. Lab

14.10. Further exploration

14.11. Lab answers