October 29, 2004

Windows admin made easy

Monad, a new command shell, gives Windows a new lease on life

System administration has always been windows’ Achilles’ heel. The graphical tools that simplify basic chores just get in the way when there’s heavy lifting to be done. And CMD.EXE, the hapless command shell, pales in comparison to the Unix shells that inspired it. Win32 Perl has been my ace in the hole, combining a powerful scripting language with extensions that can wield Windows’ directory, registry, event log, and COM services. But I’ve always thought there should be a better way.

Jeffrey Snover thought so, too. He’s the architect of Monad, aka MSH (Microsoft Shell), the radical new Windows command shell first shown at the Professional Developers Conference last fall.

A meeting with Snover piqued my interest, as did his video demonstration on MSDN’s Channel 9. This week, I finally got a chance to give this new tool a try. You don’t need Longhorn, by the way. I’m running MSH on Windows XP with the 2.0 version of the .Net Framework that comes with the Visual Studio 2005 beta. My first reaction? MSH rocks. System administration on Windows, and ultimately everywhere, will be forever changed for the better.

At its core, MSH is an object pipeline. Unix, of course, invented the pipelining concept. But in Unix-like systems -- including Linux and OS X -- the data that’s passed from one command to the next is weakly structured ASCII text. When you’ve got smart, self-describing objects flowing through that pipeline, it’s a whole new ball game.

Recently, for example, I wrote a typical management script for a Windows 2003 Server. Its job was to filter a subset of running processes by name and then kill any of those exceeding a memory threshold. Using Python in conjunction with Mark Russinovich’s PsTools suite, I did this in the time-honored way: List the processes, split the output into columns, associate the first and third columns with process name and memory use, and then finally identify and kill memory hogs.

Here’s the drill with MSH. You start by typing the command get-process. As does Unix’s ps command, get-process prints a bunch of process statistics on the console. But under the covers, it emits a sequence of System.Diagnostics.Process objects. You can look up that class in the .Net Framework documentation, but it’s easier to just ask an instance of the object to display its methods and properties. If there are too many to view conveniently on the console, pipe the information to an HTML file, a .Net grid control, or an Excel worksheet.

When you’ve identified the properties of interest, it’s trivial to isolate them, filter them, and pipe the filtered subset to the stop-process command. With a pipeline full of .Net objects, it’s all oddly familiar yet dramatically easier.

MSH is quirky, complex, delightful, and utterly addictive. You can, for example, convert objects to and from XML so that programs that don’t natively speak .Net can have a crack at them. There’s SQL-like sorting and grouping. You write ad hoc extensions in a built-in scripting language that feels vaguely Perlish. For more permanent extensions, called cmdlets, you use .Net languages.

With MSH, Windows system administration manages to be both fun and productive. And the story will only improve as the .Net Framework continues to enfold Windows’ management APIs. Competitors take note: Windows is about to convert one of its great weaknesses into a strength.

Close

On Twitter now

Platforms

Powered by Twitter

On Twitter now

White Paper

D2D Virtual Tape Library Replication Primer

This whitepaper explains the terminology and concepts behind Data Replication technologies and establishes some sizing rules through worked examples. Learn the new paradigm in disaster tolerance—protect data anywhere.

Download now »

White Paper

An Alternative to Virtualization for Datacenter Cost Savings

Server virtualization is a popular option for dealing with mounting datacenter costs. Another equally promising approach is the use of an Application Delivery Controller. Citrix NetScaler provides a low-cost way for organizations to reduce their server count and accrue cost savings from a reduction in space, cooling, power and personnel.

Download now »

White Paper

Why Your Firewall, VPN, and IEEE 802.11i Aren't Enough to Protect Your Network

The emergence of WLANs has created a new breed of security threats to enterprise networks.

Included in HP ProCurve WLAN solutions is security technology that alleviates threats from WLANs through:
* Monitoring wireless activity inside and out of the enterprise
* Classifying WLAN transmissions into harmful and harmless
* Preventing transmissions that pose a security threat to the enterprise network
* Locating participating devices for physical remediation

Download now »

White Paper

Bringing the Edge to the Data Center

Effectively address data protection challenges, implementing solutions that help store and protect business–critical data while cutting costs and improving efficiency and reliability.

Download now »

Sign up to receive Platforms Resource Alerts

Subscribe to the Today's Headlines: First Look Newsletter

Find out what will be news for the day, with our first-thing-in-the-morning briefing.

©1994-2009 Infoworld, Inc.