Extracting Attachments from E-mails

Today I received a 2 .dat files from a client who needed the contents converted into a useful file format, i.e. pdf, jpg, etc. I opened the file in Notepad++ and saw that the .dat files were an e-mail with an attached PDF. The first thing I tried was renamed the files to .msg and tried double clicking on it, hoping that MS Outlook would recognize this as an e-mail and automatically open it. Unfortunately, it didn’t work and I couldn’t find any function to import individual e-mails.

After searching for a while in Google, I found the Decode Shell Extension by Funduc Software. This utility will allow you to multiple files or multi-part files attached to an e-mail, Basic64, yEnc, BinHex, XXENCODED, and plain text from an e-mail.

All that you have to is right click on the e-mail message file, and select Decode and you the following dialog box will be displayed.


The attached files will then be extracted and saved to the same folder.


pscoder: PowerShell plugin for Eclipse

Now that I’m using PowerShell more, I’m looking for a good editor for it. The GUI editor that comes with PowerShell 2.0 is ok, but it only works well with editing one document at a time. If you have multiple libraries and modules, it may be difficult managing your project.

The first place I looked was finding a plugin for Eclipse, and found pscoder. This is an open source plugin from Google Code. The plugin is very basic, but it does colour code the source and has comment/uncomment hot key support. Its still a work in progress, but so is the GUI editor from Microsoft.

You can download pscoder at


PowerShell: A Better CMD.EXE

Every systems administrator and power user is very familiar with CMD.EXE: the command line interpreter for Windows. Its used for running applications from the command line, and also for performing administrative tasks with batch files. Not much has changed with the traditional command line interpreter from the days of DOS 1.0. The batch language has improved and more functionality has been added, but its still very limited and not as capable as Linux command shells (i.e. bash).

Taking on Bash

All of this has changed with Microsoft’s PowerShell. This is a vastly improved command line shell with a built-in programming language. The language is very similar in capabilities to PHP or Perl and works very well with creating small utilities for Windows. The big advantage of PowerShell over Linux shells is the vast .NET Framework that it has access to. You can write a script that can extract data from a Microsoft SQL Server database, send it by FTP to a remote folder, and then send an e-mail notifying a user where they can find the files that were transferred. Before this, a batch file would have to call external applications to perform the FTP and e-mail functions.

PowerShell scripting can easily be replaced by any of the Visual Studio .NET languages, but it has the advantage of being able to edit source code and immediately execute it.

Apart from scripting, the shell is also very good for executing commands, or cmdlets as they are called, from the command line. With this, you can perform complex operations that would require a great deal of programming to do.

Choose the Right Version

If you search, you will find Windows PowerShell 1.0, but I would not recommend using this version. A better choice is the Community Technology Preview version of PowerShell 2.0. This version supports running scripts on a remote machine, creating cmdlets with its scripting language, reusable modules for organizing scripts, a GUI integrated scripting environment, and many more useful features.

Uninstalling PowerShell 1.0

Before you can install PowerShell 2.0, you need to uninstall version 1.0 if you installed it previously. This can be done by checking on the Show updates box in Add or Remove Programs (Control Panel). This is required otherwise Windows PowerShell will not be visible for uninstalling. You can find it in the Windows Software updates section.


Is It Worth Learning?

PowerShell is a powerful scripting language and can hold its own again PHP and Perl. The command line interpreter will save you time as a Windows administrator and you won’t go back to CMD.EXE or batch files after learning it. PowerShell is worth the effort in mastering it.