Many households, and most businesses, have more than one computer. Being able to remotely monitor and maintain these computers can save valuable minutes every day. NetPing makes these tasks a little easier by serving two purposes: Simple display of computer
information and the ability to perform actions on these computers. What makes the application truly useful, though, is the ability to easily add to the application's functionality with add-ins written in .NET. Add-ins come in two flavors: ColoumnProviders,
which display information for each computer in a single column, and ContextMenuItemProviders that allow the user to execute an action via context menu.

How NetPing works

When NetPing is launched, it loads all add-ins in the AddIns directory. When the Start button is pressed, all IP addresses in the given range are pinged and ColumnProvider add-ins are executed for each that respond. Finally, ContextMenuItemProvider add-ins
are executed when the user right-clicks a row and selects an item from the context menu.

In the screen shot below, ‘Name', ‘Uptime' and ‘Operating System' are ColumnProvider add-ins. ‘Remote Deskop' and ‘System Information' are ContextMenuItemProviders.

The NetPing projects

NetPing consists of the following projects:

· NetPing: This contains the core application. MainForm and HostListViewItem are where the most of the action lives, but most of this action involves threading and is outside the scope of this article. The classes are fully commented, so the adventurous
are welcome to dig around.

· NetPing.Common: Common contains what could be considered the NetPing ‘SDK' (software development kit). It contains the classes that add-in authors use to integrate with NetPing.

· NetPing.AddIns: Finally, AddIns contains the ‘Name', ‘Uptime', ‘Operating System', ‘Remote Desktop' and ‘System Information' add-ins. Note that any number of add-in assemblies may be put into the AddIns directory – this project need not be modified
to extend NetPing.

Writing ColumnProvider add-ins

The IColumnProvider interface, shown below, must be implemented by all ColumnProvider add-ins:

The abstract ColumnProviderBase class is provided to make ColumnProvider creation a little easier. Classes that inherit ColumnProviderBase are only required to implement Execute, which returns a ColumnValue object.

The ColumnValue class represents three different values:

Text: This is the text that will be displayed.

SortKey: SortKey is a string that will be used when comparing values during a sort, since the text value of a field doesn't necessarily represent its value. For example, the Uptime column displays uptime in English but its SortKey is a numeric representation
of the boot date and time, which sorts chronologically.

ColumnIndex: Indicates which column the row should update with the value.

The simplest ColumnProvider, ComputerNameColumn, is shown below in both Visual Basic and C#.

What next?

All kinds of information is available via
WMI (Windows Management Instrumentation). Add-ins can be written to display a computer's CPU, RAM, disk drive information and so on. The OperatingSystemColumn and UptimeColumn classes use WMI to retrieve their values and are a good place to start.

Regarding ContextMenuItemProviders, anything that requires an IP address can be executed. For example, a reboot command could be initiated, ports scanned, Computer Management opened, etc. The options are endless!

Using with Windows Vista

Vista's User Account Control may get between NetPing and Vista computers' WMI, and behavior is different for workspace and domain compters. The following articles explain the issue and solutions: