"Monad is a way to automate the system. It has four components. First is it's as interactive and composable as kshell or bash. So if you're familiar with those types of shells, we have those capabilities. It's also as programmatic as say Perl or Ruby. So when you really need to get great automation to really get sophisticated, you don't have to switch tools. The same tool can be both interactive and programmatic. Third is we've focused in on some production-oriented capabilities of it, like VMS's DCL or the AS400. We're really focused in on trying to solve admins' problems. And then fourth, we go and we take all the management information in your system and make it as easy to find as files in the file system. So for developers it's a way that they can participate in Microsoft's strong focus in on automation, and to line up with our initiatives around dynamic systems, and it's a hosting environment. So you'll see how this is very different than traditional approaches, how in this world we have commands, we call them commandlets, and they're .NET classes. And then MSH is a hosting environment that takes your .NET classes and surfaces them as commands where the hosting environment does a ton of the traditional work you had to do as a developer before. So you'll see you just get fantastic productivity out of this environment." - Jeffrey Snover, Microsoft.
Here is a sample:
using System;
using System.Management.Automation;
namespace GetCommands
{
[Cmdlet("get", "Environment")]
public class GetEnvironment: Cmdlet
{
public override void BeginProcessing()
{
WriteObjects(Environment);
}
}
}
This would be used as follows:
MSH C:\> $environment = get-Environment
The thing to notice is the commandlet passes a .NET object (which is also available to the next consumer along the pipe). For example, it is now possible to do the following:
MSH C:\> write-console $environment.OSVersion.ToString()
Microsoft Windows NT 5.1.2600.0
The .NET Show has a demonstration of MSH (see the Enter The Programmer section) in Longhorn Fundamentals.
No comments:
Post a Comment