Creating custom Windows 2000 management tools

One of the biggest differences between Windows NT and Windows 2000 is that Windows 2000 uses a single tool called Microsoft Management Console instead of the usual Windows NT utilities and management tools. Brien Posey explains the change.

If you've used Windows 2000, you've probably discovered that many of the usual Windows NT utilities and management tools no longer exist. Instead, these individual tools have been replaced with a single tool called Microsoft Management Console. Of course, using one tool to do everything can become a little overwhelming, especially if you’re just starting out with Windows 2000. But don't worry. Windows 2000 allows you to create custom tools for specific tasks. In this Daily Drill Down, I'll explain how Microsoft Management Console works, and I'll show you how to create some custom management utilities.

What is Microsoft Management Console?
Microsoft Management Console is a tool that was released as part of the Windows NT Option Pack. Its purpose was to provide a common interface for a variety of tasks. Although the Microsoft Management Console was optional in Windows NT, it’s the backbone of most of Windows 2000’s tasks.

Before you can create any kind of custom management tools in Windows 2000, you must understand how the Microsoft Management Console works. Although it can perform a wide variety of tasks, Microsoft Management Console by itself is nothing more than a shell. Modules of code called snap-ins do the real work. These snap-ins are dedicated to performing a specific task. For example, one snap-in manages users, another snap-in looks at event logs, a third snap-in manages system services. The list goes on and on.

To see Microsoft Management Console in action, select the Computer Management command from the Start | Programs | Administrative Tools menu. The Microsoft Management Console will load, along with the Computer Management snap-in. As you can see in Figure A, this snap-in performs many tasks. For example, through the Computer Management snap-in, you can access the Event Viewer, the Device Manager, Disk Management, and more.

Figure A
The Computer Management snap-in performs more than one task.

The anatomy of Microsoft Management Console and snap-ins
Now, let’s take a look at the anatomy of a snap-in and the anatomy of Microsoft Management Console itself. First, you need to know the difference between Microsoft Management Console and the various snap-ins. An empty Microsoft Management Console screen appears in Figure B. You can access this empty Microsoft Management Console screen on your own system by selecting the Run command from the Start menu and entering the MMC command.

Figure B
Here’s what an empty Microsoft Management Console screen looks like.

As you can see in Figure B, the entire tree structure that appeared in the left-hand column of Figure A is gone, along with the corresponding information that appeared in the right-hand column. What you see in Figure B is the Microsoft Management Console shell.

Now, take another look at Figure A and tree structure in the left-hand column. You can navigate this tree structure by clicking the plus (+) and minus (-) signs that appear beside each item. Doing so expands or collapses the levels of the tree. Navigate the tree to Computer Management (Local) | Storage | Logical Drives. You'll see a screen similar to the one shown in Figure C. This screen lists all of the physical and logical drives in your system. Once you've reached this point, you can perform several interesting tasks.

Figure C
Navigate the tree to Computer Management (Local) | Storage | Logical Drives.

Using the View menu
First, right-click the Logical Drives icon, and a context menu with several options will appear. The available options include View and Export List. The View submenu contains even more options; you can choose to view the information as large icons, small icons, a list, or a list with details. The View menu also contains a Choose Columns command. If you select this command, a dialog box will appear. It allows you to hide or show any of the columns on the right-hand side. For example, with Logical Drives, all of the columns are visible by default. However, you could hide the drive types or the drive mappings by using this option. This feature will become important when you create your own snap-ins. You may not want to display all of the information that will eventually become available.

Another handy option on the View menu is the Customize option. When you select the Customize command, you'll see the Customize View dialog box, as shown in Figure D. This dialog box allows you to enable or disable such things as the console tree and the various menus and tool bars. Use this dialog box to achieve the most comfortable look and feel for your custom console.

Figure D
Use the Customize View dialog box to adjust the look and feel of your custom console.

Using the Action menu
If you look at the top of the Microsoft Management Console, you'll see an Action menu and a View menu. Although these two menus are part of the Microsoft Management Console, the contents of the Action menu are related directly to a snap-in. (The View menu contains items that I've already discussed.) If you select the Action menu, you'll see two commands: Properties and Help. The Properties command applies to whichever logical drive is selected in the right-hand column. You can view a logical drive's properties by right-clicking that drive in the right-hand column and selecting the Properties command from the drive's Context menu.

To see how the Action menu changes, select the Disk Defragmenter option, which appears directly above the Logical Drives option in the tree. When you do so, the right-hand column will change to reflect the purpose of the Disk Defragmenter module. Now, select the View menu, and you'll see that many of the options have disappeared automatically from the menu (because they don't apply to the Disk Defragmenter). Next, select the Action menu. You'll see that the commands have changed here, too. Instead of seeing the Properties and Help commands, you’ll see the Analyze, Defragment, Pause, and Stop commands.

Sorting the right-hand column
The Microsoft Management Console can sort any right-hand column instantly. Simply click a column heading, and the list will be sorted by whichever column you selected. For example, on the Disk Defragmenter screen, click the File System column header. The list will be sorted alphabetically by file system. Now, click Volume, and the list will be sorted by drive letter. Although this feature isn't essential to building a custom snap-in, it can become very helpful when you’re trying to wade through vast amounts of data.

A custom console
Now that you know the basics, you should be able to create a custom snap-in. First, close the Computer Management console and return to the empty Microsoft Management Console screen. This screen has an extra menu at the top of the screen. Select the Add/Remove Snap-In command from the Console menu, and you'll see the Add/Remove Snap-In properties sheet. Now, click the Add button on the Standalone tab to reveal a list of available snap-ins.

Let’s suppose that you want to make a custom Device Manager tool. Select the Device Manager icon from the list and click the Add button. A dialog box will ask you if you want to manage the local computer or another computer. Select Local Computer and click the Finish button. You'll return to the Add Standalone Snap-In dialog box. Click Close. Then, click OK on the Add/Remove Snap-In properties sheet. Doing so will pull the Device Manager snap-in into the Microsoft Management Console, as shown in Figure E.

Figure E
You can pull the Device Manager snap-in into Microsoft Management Console.

Now, select the Options command from the Console menu. You'll see the Options dialog box, as shown in Figure F. It provides you with the opportunity to customize the console and to keep it from being changed. First, change the console name from Console1 to My Cool Device Manager Console. You also can specify a custom icon if you want. Then, from the Console Mode drop-down list, select the console mode that you want to use. A description of each console mode appears directly below the console list. For now, select User Mode—Limited Access, Multiple Windows. You can customize this tool further by selecting or deselecting the check boxes at the bottom of the dialog box. Click OK to continue.

Figure F
The Options dialog box allows you to customize your new console.

Now, select the Save As command from the Console menu. Save the file as DVMGR. Then, close the Microsoft Management Console and return to the Windows 2000 desktop. Go to the Start menu and navigate to Start | Programs | Administrative Tools | DVMGR. When you click DVMGR, your custom Device Manger console will load. This time, however, it will include only the menus and options that you’ve specified. Our custom Device Manager appears in Figure G.

Figure G
Our custom Device Manager looks like a professionally created management tool.

Brien M. Posey is an MCSE who works as a freelance technical writer and as a network engineer for the Department of Defense. If you’d like to contact Brien, send him an e-mail. (Because of the large volume of e-mail he receives, it's impossible for him to respond to every message. However, he does read them all.)

The authors and editors have taken care in preparation of the content contained herein, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

Editor's Picks

Free Newsletters, In your Inbox