Customize administrative tools with MMC snap-ins

The Windows 2000 Microsoft Management Console (MMC) provides a framework for administering and managing system configurations. The beauty of MMC is that it replaces the many interfaces you need to manage Windows NT and simplifies system management. Microsoft has widely documented MMC's architecture, so you can expect software companies to begin including MMC snap-ins for installation and configuration processes.

MMC Basics
MMC provides a GUI for snap-ins—administrative components that define and perform management tasks. MMC in itself contains no management capabilities; its power is that it lets you add and coordinate snap-ins easily and seamlessly. MMC offers a multiple-document interface (MDI) that can even leverage Internet technologies and ActiveX controls.

MMC runs on any Win32 platform (e.g., Win2K, NT 4.0, Windows 9x). Win2K includes standard snap-ins in the Start menu's Administrative Tools menu. Many other Microsoft products, including the Microsoft Windows 2000 Resource Kit, Microsoft SQL Server, and Microsoft Exchange 2000 Server, offer additional snap-ins.

You can assemble multiple snap-ins to create a customized, robust console for administering computers across your enterprise. Save the consoles you create as Management Saved Console (.msc) files, and use any convenient method to distribute them throughout your system (e.g., make the files available as desktop shortcuts or Start menu items, email the files, post the files to a Web page).

MMC Interface
The MMC user interface (UI) is flexible. For example, you can load several snap-ins at one time in one console window or across multiple windows. You can limit the console to one window for less-experienced users who might find multiple-window consoles hard to work with.

The MMC window displays a toolbar and a menu bar, which includes Console, Window, and Help menus. Use the Console menu to create new consoles from snap-ins, open and save console files, add snap-ins to and remove them from the current console, and set security and authoring options. The Console menu also lists the four most recently used consoles. The Window menu lists commands that control the behavior of the console windows (e.g., Cascade, Tile, Arrange Icons), and the Help menu opens local and Web-based Help files. The toolbar includes New, Open, Save, and New Window icons.

Figure 1, page 170, shows the MMC window for the DNS snap-in, which manages the domain's DNS server. The console window typically fills the MMC window, but Figure 1 reduces the console window to show both windows.

The console window has a menu bar and toolbar; the contents of the menu items and the icons on the toolbar vary according to the snap-ins that make up the console. The Action menu contains the available commands for the loaded console, and the console's snap-ins customize this menu to add or remove command items as needed. The View menu provides options for displaying a snap-in's objects. The View menu also includes the Customize command, which opens a Customize View dialog box in which you can select options for both windows, as Figure 2, page 170, shows. However, be careful about clearing the Standard menus (Action and View) check box in this dialog box, because if you hide this item, you can't return to the Customize View dialog box to make changes. When you work in the console window, use the Alt+Enter keyboard shortcut to display the Properties dialog of the items you select and press F5 to refresh the window.

A console can host multiple snap-ins, which are automatically placed in named containers (each snap-in creates and names its container). The console window's left pane is the Tree pane, which displays the containers in a hierarchical collection that resembles the Windows Explorer interface. The folders that appear in the Tree pane are nodes that each snap-in provides, and you expand and collapse the nodes as needed. The console window's right pane is the contents pane and varies according to which node is selected in the Tree pane. Figure 3 shows a console that hosts both the Routing and Remote Access and Telephony snap-ins.

Working with Snap-ins
Technically, snap-ins are OLE in-process servers that execute in MMC's process context. Snap-ins are typically stored in .dll files, and one .dll file can contain several snap-ins. Some snap-ins might call on other supporting controls and DLLs to accomplish their mission.

Snap-ins are available in a variety of types. Standalone snap-ins work on their own, providing objects in the Tree pane, menu items, and toolbars. Extensions are sets of code that extend or complement other snap-ins. These extensions sometimes provide additional objects, menus, and toolbars.

Required extensions are sets of code that some snap-ins automatically add; these extensions can't be removed programmatically. Dual-mode snap-ins can operate as standalone snap-ins or extensions.

A console's snap-ins create the console's namespace, which is the ordered collection of nodes, as well as submenu commands for the New and All Tasks menu items on the Action menu. Specific snap-ins or extensions own nodes, and only the node owner can place menu items on the Action menu in the console window. (The same commands are available when you right-click an object in the Tree pane.) Some extensions automatically add items to the second-level All Tasks and New menus and will add the menu items in the order in which you loaded the extensions. MMC controls the menu separator bars; users can't adjust the menu order or position of the menu items. Snap-ins can also create their own toolbars, which you can dock anywhere you want.

In Win2K, you can load a snap-in in a new or existing console. To open a console, select the Run command and enter mmc. The MMC window opens with a blank console. To load a new snap-in, open the Console menu and select Add/Remove Snap-in. Click Add to display a list of standalone snap-ins, which Figure 4 shows, then double-click the snap-in you want to add. Add the first snap-in you load in a new console to the Console Root; this snap-in becomes the root object. You can add subsequent snap-ins to an existing snap-in root object or add another root object.

To open a previously saved console, choose Open from the Console menu and select the console you want to work with. Select Add/Remove Snap-In from the Console menu to load additional snap-ins in the console.

The snap-in you select might have configuration options such as whether the snap-in manages the local computer or a remote computer. Some snap-ins are available only on servers or domain controllers. Other snap-ins have different choices of modes and smaller scopes of operation, such as applying only to a domain or an organizational unit (OU).

After you add a snap-in, you might be able to add extensions to increase your management capabilities. However, not all snap-ins have extensions. To see whether extensions are available for a specific snap-in, choose Add/Remove Snap-in from the Console menu. Select the Extensions tab to display a list of loaded snap-ins, then select a snap-in to display a list of available extensions (if any).

Customizing MMCs
You can combine snap-ins to create consoles that contain the tools you use most frequently, including the tools from the Administrative Tools menu. For example, you might want to create a console that includes the Event Viewer and Performance snap-ins or the System Information snap-in (or all three). Or, you might want to combine a tool that is available in the Administrative Tools menu with snap-ins that aren't available in that menu.

When you expand a snap-in container, you might find objects in the snap-in's hierarchy that you'll frequently use. You can select objects in the hierarchy and click Favorites to add them to your Favorites list. The next time you want to use one of those objects, open the Favorites tab on the snap-in window and click the object instead of searching the hierarchy.

More to Come
In Part 2, I'll explore more MMC features and functions, including some of my favorite discoveries. I'll also point out some problems that I've encountered while working with MMC.