Chapter 19. CIM cmdlets and sessions

This chapter covers

  • Using WMI methods in cmdlets created from WMI objects
  • Demonstrating the PowerShell v3 CIM cmdlets
  • Using CIM sessions to access remote machines

In this chapter, we’re going to continue our investigation of the CIM API introduced in PowerShell v3. In chapter 18, you saw how to create cmdlets directly from WMI classes. In this chapter, you’ll learn how to extend the use of PowerShell v3’s cmdlets-over-objects functionality to utilize the methods presented by WMI classes. You’ll create additional cmdlets to provide a mechanism to utilize those methods. WMI methods may or may not require parameters. You’ll learn how to work with both of these scenarios.

Note

This chapter builds on chapter 18 and should be read after that chapter.

The CIM cmdlets are analogous to the WMI cmdlets that you’ve been using in PowerShell v2, but there are some subtle differences in the way you can access information. These differences provide a great opportunity to brush up on WQL. I strongly advise mastering WQL, as the changes introduced with PowerShell v3 will ensure it becomes an important part of your administration toolset.

WMI has always had great support for working with remote machines. The only snag is that it has required you to use the DCOM protocol. The CIM cmdlets continue to support DCOM, but you can also use WSMAN in a much simpler way that’s similar to the way you use PowerShell remoting sessions.

19.1. Using WMI methods

19.2. CIM cmdlets

19.3. CIM sessions

19.4. Summary

sitemap