Friday, January 27, 2006

Microsoft Ups the Security Ante In 64-bit computing

MS has justannounced that it will "harden" Vista Against Kernel-mode malware by requiring all kernel mode drivers to be signed by MS. From a sound bite perspectivre, this sounds a really good thing., But fortunately for many of us, this is limited to 64-bit Windows not the 32-bit versions I'm running since the reality is goning to be bad news. As anyone who uses the latest hardware, or who uses niche hstfetgproducts, signed drivers are not always available. In some cases any there are NO drivers avaialbe for the latest systems - a problem I encounteered during the Windows 2000 and XP betas.

For me, this decision is a good one for my pocket book as it removes any current interest I have in 64-bit boxes in the short term. It also means MS has probably lost a launch customer for 64-bit Vista as I'm not prepared to go 64-bit without better driver support). Security is an important features, but in this case, just being able to install and run Vista seems a more important feature. As an example: I've just purchased a new (32-bit) Dell Laptop that simply does not run Vista - I've take Vista off, and gone back to XP. Given the low level of driver support thus far with Vista, I'm not prepared to buy into a platform which will come with even fewer drivers. I simply can not affort more xpensive but useless door-stops. I'd have been happier had MS also announced that better driver support full stop - something rather noticibly absent.

Tuesday, January 24, 2006

TechEd Europe in Amsterdam Cancelled

It was a bit of a shock to find that Microsoft TechED Europe 2006 in Amsterdam has been cancelled. I was really looking forward to it. I have attended every Euro Teched since the start - a cold wet Bournouth 11 years ago. It's sad to see it cancelled - all the more so since I love Amsterdam in July!!

Sunday, January 22, 2006

More Excitement over Monad

Informit.com has a nice article on Monad, entitled Monad, the Three-Dimensional Command Prompt. It's cool to see the more mainstream IT press sites slowly getting to grips with Monad.

MSN and Privacy

Ken Moss, General Manger of MSN Web search has published a blog article: Privacy and MSN Search where he attempts to justify Microsoft's position over the request by the US Government for data in relattion to child porn. I will not go into detail here on this (you can Google for the details! or see here for my earlier take on this issue).

As you can see from the comments on the MSN blog, most contributors do not take kindly to MSN's actions. There are a few pro-MS comments (some curiously anonymous, and possibly astroturfed), but most are pretty negative. No matter how Ken spins it, Microsoft has lost some trustworthy points over this.

Saturday, January 21, 2006

Microsoft ads aim to erase 'huge' image

According to the Seattle PI, Microsoft is embarking on an ad capaint to erase it's "huge" image. The PI peice says Micosoft will be spending £120 MILLION dollars a year on ads, with the purpose of trying to show they are not a big American company. Maybe I'm missing something but surely only a large American company would need, or indeed want, to spend $120m to demonstrate they are not a huge American company.

The Day After: Points In The Search Trust Sweepstakes

I've just read an interesting article: The Day After: Points In The Search Trust Sweepstakes regarding the requrests made by the US Government to various search engines. MS's "Trustworthy Computing" programme would appear to have taken a further battering. Any company that wants customers to trust it does not issue a non-statement which did not confirm or deny anything. Frankly the way MS caved in to this rather absurd demand, and Google didn't, makes it less likely that I am going to use MS as a search engine and a several trust points for Google. MS's Trustworthy Computing supremos could learn from Google's stance here. After all, it's not like MS is short of lawyers, now is it?

Monday, January 16, 2006

Friday, January 13, 2006

Scripting with the Windows "Monad" Shell

Microsoft have a put up a new page up on its Technet site: Scripting with the Windows "Monad" Shell. It's the Monad equivalent of the TechNet (VB) Script Center. The cool thing, IMHO, is that they link to my www.reskit.net/monad page as "Monad Information Center". I had wondered why the traffic on my site had suddenly jumped up a bit!

Creating a MSH Snap-in with MSH B3 - Part 2

In Creating a MSN Snap-in with MSH B3 Part 1, I showed you how easy it was to create a Snap-in. Well, at least I demonstrated the code for a snapin, one containing a simple cmdlet. In this blog article, I'll look at the details of how to compile and install your snap-in.

I have created a simple compilation script to compile snapins, csnap.msn, which take 3 paramaters (SnapinName, Snap-in Source file, and Snap-in DLL name. While you can provide paramaters, I use the convention that for a snapin , the source file is .cs, and the output is .dll. The script attempts a bit of intellegence here. The script next compiles your cmdlet, using the C# compiler, and copies the output dll to $MSHHOME, so consoles can later load the snap-in. Finally, we use the .NET Installer to install your cmd let and we're done. Well - we're done installing the snapin. Here is my cnap.msh script. A better formatted version is on http://www.reskit.net/monad/samplescripts.htm, or will be soon!


#csnap.msh
# comples and installs an MSH snapin - V1.2.3
param ($snapin,$snapinsrc,$snapinout)
#some simple validation
if (!$snapin) {
Write-Host "Snap-in name not specified - try again."
Return}
# Examine 1st parm - if a single token,
# Or (1st param is two tokens and 2nd is .cs) then...
# make make intelligent choices in absence of src/output
$s=$snapin.split(".")
if (($s.length -eq 2 -and $s[1].tostring() -match "cs") -or
($s.length -eq 1))
{if (!$snapinsrc){$snapinsrc = $snapin + ".cs"}
if (!$snapinout){$snapinout = $snapin + ".dll"}}
$x=$snapinout #save for later
#Output what we're doing
Write-host "Compiling: $snapinsrc"
Write-host "Output to: $snapinout"
# The C# compiler,and references we'll need
set-alias csc C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe
$ref = "$env:programfiles\microsoft command shell\v1.0\System.Management.Automation.Dll"
# Compile it
&csc /target:library /out:$snapinout $snapinsrc /reference:$ref
#Copy it to its home
Write-Host "Copying : $x to $out"
$out= $mshhome + "\" + $snapinout
copy $x $out
# Finally Install it
$ins = "$env:windir\Microsoft.NET\Framework\v2.0.50727\installutil.exe"
&$ins $out
#all done
Write-Host "All Done"

So that's pretty much it! If you were to take the random number snap-in sample I posted last time, saved as random.cs, you'd call script by running:

./csnap random

In the next article in this series, I'll demo how to install and use your new snap-in.

Thursday, January 12, 2006

Creating a MSH Snap-in with MSH B3 - Part 1

MSH Beta 3 comes with a snap-in feature, which simplifies creating additional cmdlets for your own use. I'll not go in to why developers need to create cmdlets here, hopefully that's a given (if not, I'll talk about this in another article). In this muli-part article, I plan to discuss what MSH snap-ins are, then show how easy it is to create a MSH snap-in with B3. I've also created a compile script to do the compilation and implementation of a snap-in too - which you may find useful.

First some background. In MSH, a cmdlet is a simple unit of work. MSH comes with a bunch, but you can add more (typically for some task specific reason). Exchange 12 will for example come with some like New-Mailbox, etc. You have two ways of delivering cmdlets to a user: via an extended shell (using makeshell and creating your own shell) or, new in B3, you use the snap-in feature. I plan to cover make-shell in a separate article.

To a developer, a cmdlet is a bit of code you write to do some task. Because your code will be snapping into Monad, it has to follow some simple rules. Each cmdlet implements a class that derives from a base MSH Cmdlet class. This class over rides one or more of three cmdlet methods: StartProcessing(), ProcessRecord() and EndProcessing(). Finally, you need to decorate your source code with the appropriate attributes to define your cmdlet to Monad and then compile your code. Once compiled, it's ready for deployment (details to follow in a later article).

With Beta 3, a snap-in is just a bit more code - a simple class definition giving some basic information about the snap-in - it's mainly template code (fill in the blanks). This information is then used in the compilation and installation process (in part 2)

Here is the code for a simple MSH Snap-in containing one cmdlet. It's based on the sample in the release notes:
//random.cs
using System;
using System.ComponentModel;
using System.Management.Automation;
using System.Reflection;
[assembly: AssemblyVersion ("1.2.0.1") ]
[assembly: AssemblyTitle ("Randon Numbers") ]
[assembly: AssemblyProduct ("MSH Beta 3 Testing") ]
[assembly: AssemblyCompany ("QA plc") ]
namespace QACmdletSnapins
{
// This class defines the properties of a snap-in
[RunInstaller(true)]
public class QARandomNumberSnapin : MshSnapIn
{
///

Creates instance of DemonSnapin class.
public QARandomNumberSnapin() : base(){ }
///Snapin name is used for registration
public override string Name
{ get { return "QARandomNumberSnapin";} }
/// Gets vendor of the snap-in.
public override string Vendor
{ get { return "QA, Thomas Lee";}}
/// Gets description of the snap-in.
public override string Description
{ get{ return "Contains a cmdlet to generate random number";}}
}
/// An implementation of a random number generator.
[Cmdlet("Get", "Random")]
public class QAGetRandomCommand : Cmdlet{
protected override void EndProcessing(){
Random r = new Random();
WriteObject(r.Next());
}
}
}

I plan to post a better laid out version to www.reskit.net/monad/samplescripts. Looking at this C# program, it starts with standard using clauses, then some important assembley attributes. The snap-in Namespace is QACmdletSnapins, and it defines a single class - QARandomNumberSnapin, over-riding the base MshSnapIn class. There are then 4 public strings (and the attribute) and that's done your snap-in definition.

The Snap-in program finishes up with, in this case, a single cmdlet although you can put multiple cmdlets into a single snap-in. It's called Get-Random, and is implemented by a class called QAGetRandomCommand which derives from the base MSH Cmdlet class. Plus the necesary Attribute to define the cmdlet to MSH.

In terms of writing the cmdlet/snap-ins that's it. It's really very staightfoward! I'll cover compiling and deploying your new snap-in in a future article. Hopefully that's whetted your appetite for more!!

MSH Memo - A Japanese Monad Blog

Although written mainly in Japanese, MSH Memo is another good Monad blog - with some neat ideas. You'll need to work a bit to translate in to English, but probably worth it. Not sure of this guy's name, but he seems to know what he's talking about!

Monad - An O'Reilly Book by Andy Oakley

Along with the release of Monad B3, I've been reading through Monad a new book by Andy Oakley, published by O'Reilly. You can read the Press release about this book here. Although Andy must have forgotten when he wrote the intro, I was one of the reviewers of this book - and I'm pleased to see the book published.

The book is a really good introduction into the basics of Monad. It's short (around 150 pages), provides a great introduction to the langage and to the MSH shell and is accurate wrt Beta 3 (it was written around B2, but so far I've not found anything in the book that does not work in B3). I found reading at the keyboard and trying out the code samples was a great way to learn more about Monad

The book does not do any deep dives, such as details on extending the shell, or how to host Monad in your own application. Andy had written a chapter on extending Monad, but it was not published (and would have been overtaken by events anyway). But as a great introduction to Monad and starting place for admins who want to learn about Monad, this is a good book to have!

Python inside MSH

IronPython is the codename for a beta release of the Python programming language for the .NET platform. And a Japanese blogger has got MS's new beta of Python insider MSH on top of Windows. Turns out it is really pretty easy as his blog entry shows and as summarised below:

Basically, you download the new Iron Python beta from here. The download is a tiny (around 759kb!) zip file. Exract the contents of the zip file into a folder (eg C:\Program Files\IronPython). Once "installed", you load then invoke it like any other scriptable object. For example:

[void] [Reflection.Assembly]::LoadFrom("C:\Program Files\IronPython\IronPython.dll")
$IPEngine = new-object ironpython.hosting.pythonengine
$code="print 'Hello World from IronPython'"
$IPEngine.Execute($code)

What results in the MSH window when you run this code, unsurprisingly, is the text "Hello World From IronPython" is displayed in your console. By itself this is not overly interesting, but it shows that if you do it in Python, you can add this into MSH. Here is an example of this to create a very simple GUI:

#Load Python
[void] [Reflection.Assembly]::LoadFrom("C:\Program Files\IronPython\IronPython.dll")
$IPpEngine = new-object ironpython.hosting.pythonengine
#Create Code Array
$code=@"
import sys
sys.LoadAssemblyByName("System.Windows.Forms")
from System.Windows.Forms import *
f = Form(Text="IronPython Sample")
f.ShowDialog()
"@
#Execute it
$IPEngine.Execute($code)

Wednesday, January 11, 2006

MSH Beta 3 - Registry Changes

I've been looking at what MSHB3 does to the registry on installation. The installation program creates a new key HKLM\Software\Microsoft\MSH\1\ with two subkeys: MshEngine, and ShellIds, illustrated below (click on the pic for one full size):

The \MshEngine subkey has 5 Reg_Sz value entries:

* ApplicationBase - where you load Monad
* ConsoleHostAssemblyName - S.M.A.ConsoleHost Assembly
* ConsoleHostMOduleName - S.M.A.CnsoleHost DLL file
* MshVersion - "1.0!
* RuntimeVersion - the version of .NET needed, V2.0.50727

The \ShellIds key has a subkey per Shell. By default, there's just one shell and the subkey is Microsoft.Management.Automation.MSH, which has two Reg_Sz value entries:
* ExectionPolicy => how to run scripts
* Path - the path to Msh.

If you create new shells using the Make-Shell make kit, you end with additional subkeys under ShellIds. Additional registry entries are used to support MSH snap-ins, which I plan to cover in later blog posts.

MSH Beta 3 - Coming Really Soon

As a Monad MVP, MS has kindly sent me a pre-release of the shortly to be released Monad/MSH Beta 3. This beta, which should be posted to the web any day now, incorporates a new MSH Snap-in technology that allows you to create then add snap-ins to existing monad shells (i.e. MSH.EXE).

I've built the sample snap in - and it's really pretty easy. The snap-in approach adds a little complexity to the writing of custom add-ons but I think it's the right approach. I would expect to see a variety of 3rd party snap-ins to emerge and a vibrant open source community around this as well.

To support my playing around, I've written some comilation/build scripts - I plan to post them as well as more blog entries around Monad. As quickly as I can get the time to play and write.

So if you are using Monad now, you should ensure you have the RTM of the CLR installed (while waiting, you can also use the updated version of MSH that is tarteed at the .NET 2.0 CLR). Also, take backups of any customised profile.msn files you have.

Note also: B3 installs at slightly different locatios in both the registry and filestore than for b2, so if you have any location sensitive scripts which reference these, they need updating. The MSH B3 installer now installs Msh by default to: %ProgramFiles%\Microsoft Command Shell\v1.0, Note the "\v1,0 at the end!"

Enjoy Monad Beta 3.

Monday, January 09, 2006

Db.etree.org,Grateful Dead and Monad

As many of you may (or may not) know, I have a large and growing collection of live shows by the Grateful Dead and some of the related bands (Jerry Garcia Band, Phil and Friends, Bobby Weir, etc). Over Christmas, I had a huge re-organisation of my Dead/Jerry Collection - making a back up being top of my priority list! Also, with the removal of the lossles sound board recordings from the Live Music Archice, I wanted to ensure I could gather what I could before it goes away. As I listen to these shows, I'm finding some are of really very high quality. Some of the sbds are CD quality for sure - so rediscovering some of these shows has been a pleasure.

I also started cataloging my colection up to Etree. I've got all my 1960's Dead, some early 70's Dead and some Jerry - around 200 hours catalogued thus far with a lot more to upload. And if there's a show you want, B&P works for me!

So (and I know you were waiting for it!) here's the Grateful-Dead to Monad link...

To manage this collection, I've started writing some Monad scripts to process the collection. The first script is count.msh. this goes through the collection and reports on what's there, based on folder naming conventions and the presensnce or absence of flag files (empty files with a specific name).

I use an Etree folder naming convention that contains details of the show in the folder name. For example a folder name matching "*.sbd*.*" or *.aud.*.* contains soundboard or audience recordings, folders ending with ".shn?" or ".flac?" contain shn and flac files respecitively. There are a few more conventions I use - you can see these in the code. En each folder I have a few Flag files used that indicate the state of this show, including whether I have a CD backup of this show and whether I've checked the MD5s to ensure my copies are sound. I've also started adding a flag file to indicate if this show has been posted to db.etree.org.

This is count.msh:

#count.msh
#Count the Dead and Jerry Shows in my archive

# Some constants:
# $DeadShowBase - folder at top of gd shows
# $JerryShowBase - folder at top of jerry shows
# $BobbyShowBase - folder at the top of bobby shows
# $PhilShowBase - filder at the top of the phil shows

$DiskRoot = "G:"

$DeadShowBase = $DiskRoot + "\gd"
$JerryShowBase = $DiskRoot + "\Jerry"
$BobbyShowBase = $DiskRoot + "\bobweirshn"
$PhilShowBase = $DiskRoot + "\philshn"

# Announce Ourselves
"Count.msh - v 1.0.5"
"Count My Shows"
< "---------------------------------"
"Dead Show Base : $DeadShowBase"
"Jerry Show Base : $JerryShowBase"
"Bobby Show Base : $BobbyShowBase"
"Phil Show Base : $PhilShowBase"
"---------------------------------"
"" # Count the Dead shows
$Dir= ls $DeadShowBase | where {$_.mshiscontainer -eq- $true}
$DeadShows=$Dir.count
#Create subsets based on names of the folders
$deadsbds=$dir | where {$_.name -match ".sbd" }
$deadbrkn=$dir | where {$_.name -match "broken" }
$deadpart=$dir | where {$_.name -match "partial" }
$deadauds=$dir | where {$_.name -match ".aud" }
$deadunkw=$dir | where {$_.name -Match ".unk"}

#and see how many have the md5ok's file?

$DeadMD5Checked=0
foreach ($d in $dir)
{
$sn=$d.fullname + "\md5check_ok"
$md5ok= ls $sn -ea silentlycontinue
if ($md5ok )
{$DeadMD5Checked++}
}

#Display results
"Grateful Dead Show Summary"
"--------------------------"
"Total shows: $deadshows"
"Soundboards: $($deadsbds.count)"
"Auds : $($deadauds.count)"
"Unknown : $($deadunkw.count)"
"Partial : $($deadpart.count)"
"Broken : $($deadbrkn.count)"
$DeadPctChecked=($DeadMD5checked/$DeadShows).tostring("P")
"MD5's check: $DeadMD5checked ($DeadPctChecked)"
""

#
#next count the Jerry shows
#
...omitted to shorten the listing # Display Summary
"SUMMARY"
"-------"

$totalshows= $DeadShows+ $JerryShows+$PhilShows+$BobbyShows
$pctchecked=($Jerrymd5checked+$DeadMD5Checked+$PhilMD5Checked+$BobbyMD5Checked)/$totalshows
$pcs=$pctchecked.tostring("P")

"Total Shows: $totalshows"
"MD5s OK : $pcs"
$totalsbds=$Jerrysbds.count + $deadsbds.count+$philsbds.count+$bobbysbds.count
"Total Sbds : $totalsbds"
$totalauds=$Jerryauds.count + $deadauds.count+$Philauds.count+$bobbyauds.count
"Total Auds : $totalauds"

# The End

In the next blog post, I plan to show how I upload this to my ftp server using Monad

Friday, January 06, 2006

PC Pro's New Column - Starting .Net

I'm kind of excited about a new column now appearing in PC Pro (the UK's largest computer magazine). The main reason I'm excited is because I'm the author! The column, called Starting .NET, is now on PC Pro's web site. Well the first column is now online. Technically, the column appears in the February edition - but as PC Pro's February issue was published mid December, my column is now on the web.

Thursday, January 05, 2006

A Monad / MSH IRC Bot

This post has been around for a while, but it's about an MSH Based IRC Bot. Even if the idea of IRC bots fill you with (security) horror, this is a pretty neat post. It's also a good one for those of you wanting to play with Monad and networking.

Wednesday, January 04, 2006

PCWorld.com Discovers Monad

PC World appears to have discovered the existance of Monad! Wonders will never cease.

Read about about it in Eric Larkins's article: The Return of the C:\ Prompt?