Chapter 8. Working with WMI

Chapters 5, 6, and 7 showed how to manage event logs, services, processes, environment variables, and the registry with Windows PowerShell cmdlets. In this chapter, you will learn how to manage the same resources through Windows Management Instrumentation (WMI) classes. WMI is Microsoft's primary technology for managing Windows systems. WMI is so essential to Windows management that it has been included in every operating system released by Microsoft since Windows NT 4.0. WMI includes a large collection of classes that represent various system components, which enables Windows-based operating systems to be monitored and controlled, both locally and remotely. Since SQL Server 2005, new WMI classes were introduced to manage SQL Server configuration settings and events. This chapter focuses on the operating system components; the WMI classes specific to SQL Server administration are explained in Chapters 9 and 10.

This chapter covers the following topics:

  • Permission issues regarding WMI

  • The WMI model

  • Working with Event Log

  • Working with services

  • Working with processes

  • Working with environment variables

  • Working with the registry

Permission Issues and WMI

In order for WMI to work, the Windows Management Instrumentation service must be running. The service cannot be disabled and it must run under the local system account. If this account is changed, WMI will not have the permissions needed to operate properly.

If you connect with WMI remotely with a user account that is ...

Get Microsoft® SQL Server® 2008 Administration with Windows PowerShell™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.