Migrate from BlogEngine.NET to WordPress

November 2nd, 2011

I just had the opportunity to migrate or company blog from BlogEngine.NET to WordPress. It was not fun, or easy so thought I would share it with you.

There are a few things to note with this process.  Following these steps will import Posts, Authors, Categories, and Comments.  It will not migrate tags.  The conversion script I wrote will give you a list of tags that were associated with each post for you to manually fix later.


Step 1 – Export the data:

We need to export your current blog information.  To do this, log in to your existing BlogEngine.NET Blog.  Open Settings and at the bottom under Import & Export Click Export.


Save the BlogML.xml file to a location you will remember.


Step 2 – Convert the data:

Run my conversion script to make the BlogML file compatible with WordPress.

Download the BlogEngineToWordpress import script from My Downloads Page.  This script needs a few lines at the top changed before use.

Open the script and in the Config section, set the following to match your environment:

BlogEngineExportFile: The path to the BlogML.xml file that we downloaded earlier.

outputFolder: The path where you want the new files to go.

blogDomain: The URL that points to your blog.

imageURLPrefix: This path will be appended to blogDomain and will point to all the image files that will be imported to wordpress.

postURLPrefix: This path will be appended to blogDomain and will point to all the posts that will be imported to wordpress.

spacesInTab: The number of spaces in a tab.  I use this when I create the redirect rules that I will add to the web.config file in IIS.

Save the changes you have made and run the script at a command prompts as cscript BlogEngineToWordpress.vbs.

Note: This is not a perfect script.  There are still some things that may go wrong.  If there are weird symbols or incorrect html in the existing posts, the script will fail. 

If this happens, open the WPImport.xml file, scroll to the bottom, and see what post failed.  Then open the BlogML.xml file, find the bad post and fix the issues.  (Usually removing weird symbols that notepad cannot understand).  Save the files and try again.

If you need help trying to find out what is wrong, you can set the variable enableDebuging to true in the Config section.  This may help if you want to dig into the code a little bit.

If you still cannot get past a problem post, I recommend deleting the data between the <![CDATA[    ]]> tags in the BlogML.xml file.  This way you will still migrate the post to the new system, it will just be blank.  You can then edit that post in the WordPress UI add re add the text.

After a few bad posts that I had to fix, 8 out of about 900 for me.  I finally saw the end of the script.

The script created 6 files.  They are:

postsAndTags.txt – A list of the old URL to each post and the tags that were associated with it.

redirectFile.txt – A comma separated list of the old and new urls.

redirectNeedsFixedFile.txt – A comma separated list or URLs that I was unable to fix.  (You will manually have to update these)

web.config_partial – The list of rewrites you will need to add to the web.config file in IIS if you want to use rewriteMaps.

web2.config_partial – The list of rewrites you will need to add to the web.config file in IIS if you want to use redirectRules.

WPImport.xml – A WordPress compatible import file.

If redirectNeedsFixedFile.txt is empty then you are done with the conversion step and are ready to skip to Step 3 and importing the data.

If your redirectNeedsFixedFile.txt is not empty we will need to address this.  I have 11 urls in this list, most of them pointing to “Pages” on the old blog.  I don’t use pages so most of these can go.

1- /Blog/admin/Pages/www.groupon.com,/needtofix/page//blog/admin/pages/www.groupon.com

This is line 1 for me.  the left hand /Blog/admin/Pages/www.groupon.com looks like a malformed url.  I want o be certain though so I opened it in a browser.  I got a 404 Page Does Not Exist error.  Now I need to fix the import data.

Open WPImport.xml and search for the string on the right


I found only one occurrence and it looked like a link to www.groupon.com so I updated it.

2 – /blog/,

Line 2 is a special one.  I think every site will have one of these.  This is saying that the old site had a link to /blog/, but every link on my blog will have this because it lives in a subfolder on my site.  I can ignore this one.

3 – /Blog/?tag=/saving+money,/needtofix/tag//blog/?tag=/saving+money

Line 3 is a link to a list of tags.  When I wrote this script, I did not add the ability to update URLs that point to tags or pages. I didn’t need to feature and I was in a time crunch.  If you have many URLs in this list because of links to tags or pages, leave a comment and I will try to update the script soon.

If you don’t have many links like this you can manually update them.  Search for the string to the right of the comma in the WPImport.xml file and update it accordingly.

4 – http://www.rollinzrox.com/blog/,/needtofix/other/http://www.rollinzrox.com/blog/

Line 4 is a link to another blog.  The way I fix URLs caught this one and placed it in my other broken URL list.  I have to manually set this back to the way it was.  In WPImport.xml replace the text to the right of the comma with the text on the left of the comma.


Step 3 – Import the data:

When we are finally done converting the data, we need to import it into WordPress.  Here is what we need to do:

Download the BlogML importer plugin for WordPress from http://wordpress.org/extend/plugins/blogml-importer/

This is a plugin written by Aaron Lerch.  You can read about his experiences changing blogging platforms at aaronlerch.com

Log into your new WordPress Blog.

Open Plugins and then Add New.  Click on the Upload link at the lop and point it to the zip file you just downloaded.

Click the Install now button.

Click Activate Plugin.

Go to the Tools –> Import screen and Click on BlogML

If your WPImport.xml file is large than 2 mb we will need to increase the upload size in our php.ini file.  I am doing this on a self hosted machine that I control so the process might be a little bit different for you. 

Open your php.ini file and change the following two lines:

upload_max_filesize = 10M

post_max_size = 10M

Now restart IIS and upload the WPImport.xml file

It will take a little while to upload depending on your internet speed.

After the file completes the upload, the plugin asks about importing users.  You have the ability to import all the old users or to map them old users to new ones.  Make you choices and click Submit.

The data is now importing into WordPress.  This will take a while if you have many posts. 

After a healthy amount of time, you will see a page with a (possibly) long list of post titles.  When you see this, you can be happy because you know that the data import to WordPress is now done. 

Return to your dashboard and see the results of the data import.


Step 4 – Move the media:

Now you have all the posts and authors and comments moved over, but now pictures.  We will need to manually copy the pictures and other media to the new blog.

You will need to copy all the files out of the BlogEngine media folder (for me this was at C:\Inetpub\BlogEngine.NET\App_Data\files) into the WordPress uploads folder.

The location in the uploads folder depends on the path you set in the conversion script.  The variable imageURLPrefix set the path.  I wanted the content to be located in wp-content/uploads/1000/01.

Copy the files and check the posts on the blog.  Verify that WordPress can find the files.


Step 5 – Add new media to Media Library (Optional):

This step is optional.  After you copy the images to the WordPress uploads folder, all the posts will be able to see them correctly, but they will not be accessible via the WordPress UI.  If this bothers you, there is a plugin available that will allow you to import the files and you them with the WordPress media manager.

(This plugin will also bulk up the folder that contains the images.  The plugin creates 3 additional copies of each file, each with a different size.)

Download the plugin from http://wordpress.org/extend/plugins/add-from-server/ and add it the same way we added the BlogML import plugin.

Activate the plugin.

On the page with the Plugin list, click ………

Browse to the files that you want to add (this took a while to list them all for me.  A popup from IE kept asking me if I wanted to stop a script that was slowing down the webpage.  I repeatedly clicked No, Don’t stop the script.)

Check the boxes next to all the files and click Import.


Step 6 – Redirect rules:

Now we have one of the most important parts of the migration.  We need to add all the redirect rules to IIS so we don’t look bad to search engines.

Decide if you want to use an individual redirect rule for each URL or if you want to use a rewrite map.  I chose to use a rewrite map because it is smaller.

Open up you web.config file for your WordPress site and add the text from the web.config_partial (or web2.config_partial) file that was created by the conversion script.

Insert the text after the first <rewrite> tag, but before the first <rule> tag.

If you choose the redirectMap, you will also need to add this rule before the default WordPress rule:

<rule name="WP Redirect Rule" enabled="true">
          <match url=".*"/>
            <add input="{StaticRedirects:{REQUEST_URI}}" pattern="(.+)"/>
          <action type="Redirect" url=http://www.myblog.com{c:1} redirectType="Permanent" appendQueryString="false"/>

Save your web.config file.  If your web.config file is larger than 250kb we need to edit the registry to increase the allowed size.

Open regedit and add the following DWORD value to HKLM\SOFTWARE\Microsoft\InetStp\Configuration and


DWORD "MaxWebConfigFileSizeInKB" = Decimal "1000"

(You may have to create the Configuration Key as well.)

After editing the registry,  you will need to reboot the server.

After the reboot, (or after editing web.config and not needing to reboot)

Browse to one of the old URLs to verify the redirect.


Step 7 – Add tags and fix any other issues:

Unfortunately the conversion scripts do not add the tags to all the posts for you.  We have to manually do that now.  Open up the pastsAndTags.txt file and browse to the main page of your blog.  Manually edit each post and edit the tags.  This may take a while, but I think it is worth it to verify that everything is working.

During this time you can also check that all the images work.  Some images I had were broken because BlogEngine.Net passes in files with spaces in the name with a + icon.  I had to edit the links to any pictures with a + in the name to point to the right place.



Well, that is all I can think of right now.  I will update the post if I can think of anything else.

Install Linux VM Additions for Virtual Server 2005

September 16th, 2010

Its been a while since Linux VM Additions have been released, but there still is no good writup on how to install them. This is how I do it on a Red Hat install. (I used CentOS 5.2)

Download Virtual Machine Additions for Linux from Microsoft.

Install the msi file and it will add the iso that you need to Virtual Server 2005’s UI.

Mount the iso via the web UI.

Log into the Virtual Machine.

At a Terminal Type:
yum update kernel*
shutdown -r now

After a reboot open the terminal again.

yum install kernel-devel gcc

mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
mkdir /usr/src/vmadd
cp /media/cdrom/*.* /usr/src/vmadd
umount /dev/cdrom

cd /usr/src/vmadd
rpm -ivh vmadd-kernel-module-RHEL-2.0-1.i386.rpm
tail -100 /var/log/vmadd-kernel-module.log | more #
Verify the main install didn’t error.

rpm -ivh vmadd-heartbeat-2.0-1.i386.rpm
rpm -ivh vmadd-shutdown-2.0-1.i386.rpm
rpm -ivh vmadd-timesync-2.0-1.i386.rpm

/etc/init.d/vmadd start
/etc/init.d/vmadd-heartbeat start
/etc/init.d/vmadd-timesync start
/etc/init.d/vmadd-shutdown start

shutdown -r now

If you ever need to uninstall the additions, uninstall in this order:

rpm -e vmadd-heartbeat
rpm -e vmadd-shutdown
rpm -e vmadd-timesync
rpm -e vmadd-kernel-module-RHEL

Once after a large amount of yum updates, the additions broke. To fix the problem, I uninstalled the additions, changed back to my src directory and reinstalled with the same commands. It fixed everything.

Find Mac From IP

September 1st, 2010

Today I wrote a little script that will find the MAC address of a given IP that is on the same LAN.

The script pings the IP, then it checks the ARP cache to find the MAC. Pretty simple, yet very useful.

Download FindMacFromIP.vbs

Usage: cscript findmacfromip.vbs ‘IP Address’

Schedule Outlook appointment in X number of days

August 4th, 2010

In Outlook it is easy to find out what is X number of days away.

Open Outlook and flip to the calendar page. Click the New Appointment button. In the date field, type 60d (replace the 60 with the number of days in advance).

Use Windows Server 2008 R2 as a desktop OS

August 1st, 2010

I am very happy with Window 7. I enjoy the OS quite a bit. The only problem that I have is, there is very poor virtual machine support. Other people may disagree with me here, but I don’t like Windows Virtual PC.

I have been using Microsoft’s Virtual PC 2007 for years. I like the product, it is easy to use and it is compatible with Microsoft’s Virtual Server 2005 (which I use extensively). The new product however, is very difficult to configure, is much more difficult to import existing machines into Virtual Server 2005, and does not have 64 bit virtual machine support.

The lack of 64 bit VMs is the largest flaw of the product. Microsoft claims that VM support in Windows 7 is for compatibility with older software and that is why it doesn’t need to be 64 bit. I think that it is stupid that my OS, and CPU are 64 bit, but Microsoft will not let me use those features when working with virtual machines. The worst part about it is that Windows Server 2008 R2 is 64 bit ONLY. The new OS that Microsoft wants us to work with will not run as a VM on their desktop software.

The way around this flaw in Microsoft’s technology that I use is by running Windows Server 2008 R2 on my desktop. Here is how I do it:

1: Enable Hardware Virtualization

This part is very important. My goal is to be able to run 64 bit virtual machines. To do this, I plan on installing Hyper-V. A prerequisite to Hyper-V is Hardware Virtualization, thus we need to enable it first.

You can enable Hardware Virtualization in the BIOS. It is different in every BIOS, but it is usually under the CPU Options.

2: Install Server 2008 R2

Install Windows just like you normally would. (For me this means install windows to at least an 80 GB partition. I like to keep all my data on a different partition to 80GB is enough for me.)

3: Enable Autologon, Disable Shutdown Event Tracker, and change password requirements

At my home, I like my computer to autologon. I am the only one that uses it, so selecting a user and entering a password is a waste of time. Also I don’t want to have to enter a reason I shut down my computer every night when I go to bed.

Change Password Requirements

Click Start(now the Windows logo in the bottom left corner)->Administrative Tools->Local Security Policy. Expand Account Policies and click Password Policy. I like to change history to 0, Min and Max age to 0, length to 3, and complexity to Disabled.


Open a command prompt and type control userpasswords2. This will open a dialog allowing you to enable autologon. Uncheck the box that says ‘Users must enter a user name and password to use this computer’ and click OK. Enter your username and password and click OK again.

Shutdown Event Tracker

Click Start and type mmc. Click File->Add/Remove Snap-in…, add the Group Policy Object Editor snap-in, select the Local Computer and click OK twice. Now expand Local Computer Policy->Computer Configuration->Administrative Templates. Click on System and browse to ‘Display Shutdown Event Tracker’. Set it to Disabled.

4: Update all your drivers

I know that the new Windows Update will try to find the best drivers for you, but since this is the server OS, it will not find you the best Audio or video drivers, so you should update these on your own. (I would never trust Windows Update to install any drivers unless I absolutely had too. I trust a vender’s website much more than Microsoft.)

If you cannot find Server 2008 R2 drivers, try Windows 7 X64 drivers, then Server 2008 x64 drivers, then Windows Vista x64 drivers. You should be able to find something that works.

5: Install important Roles (Hyper-V, File Services)

After I do my driver install, I install all of the Windows Roles that I fell I will need. I install two roles, Hyper-V and File Services. Hyper-V allows you to work with Virtual Machines and File Services adds Windows Search.

Open Server Manager -> Roles. Click Add Roles, Next, Check the boxes next to File Services and Hyper-V. On the Select Role Services Screen for File Services add the Windows Search Service. Click Next and Finish. The computer will reboot before the roles are finished installing.

6: Add Features

After the Roles comes the Features. I install the Desktop Experience, and Ink Support features so I can enable Aero, and I install the telnet client because I use the telnet client for work.

Open Server Manager -> Features. Click Add Features, Next, Select Desktop Experience, Ink and Handwriting Services->Ink Support, and Telnet Client. Click Next and Finish. Computer may reboot before feature installation completes.

7: Disable IE Enhanced Security

If you plan on browsing the web using IE, you are really going to want to disable the Enhanced Security that comes with the server OS.

Open Server Manager, find the Security Information section and click Configure IE ESC. Set IE ESC to off for Administrators and Users.

8: Enable Aero

Now that we have a working OS, we can work on the eye candy. We need to enable Aero and Windows Audio.

Click Start and type services.msc. Find the Themes Service and the Windows Audio Service and set them to Automatic Start. Reboot. After the reboot, Right click on the desktop and select Personalize. In the center section, select the Windows 7 theme under Aero Themes. Click OK and you now have Audio and Aero.

9: Setup the Wireless LAN Service (If you need wireless)

To make a wireless adapter work in Windows 2008 R2 you need to add a new feature called the Wireless LAN Service.

Open Server Manager -> Features. Click Add Features, Select Wireless LAN Service, Click Next and Install.

That is how I install and configure Windows Server 2008 R2 as a desktop OS.

Here is how to install the Zune Software on Windows Server 2008 R2.

EDIT: I have done some googleing and have found a couple new changes that you might like to try.

vijaysk adds:

1: Processor Scheduling

In the Server OS, background Services are given preference over interactive programs. To fix this, Right Click on My Computer (just Computer now), Select Properties -> Advanced System Settings -> Advanced Tab -> Under Performance Select Settings -> Open the Advanced Tab. Under Processor Scheduling select Programs.

2: Visual Effects

In Server 2008 R2 you will not see any thumbnails by default.

Right Click on My Computer (just Computer now), Select Properties -> Advanced System Settings -> Advanced Tab -> Under Performance Select Settings. Tweak as you see fit.

3: Power Options

Windows Server 2008 R2 by default does nothing to save the earth. You can adjust the power settings by Opening Control Panel -> Hardware and Sound -> Power Options.

John Savill adds how to add Gadgets to Server 2008 R2.

4: Gadgets

To add gadgets to Windows Servero 2008 R2, Copy the ‘Program Files\Windows Sidebar’ folder from a 64 bit version of Windows 7 to the ‘Program Files’ Folder of the Server 2008 R2 install. Copy the shortcut ‘Desktop Gadget Gallery’ from the start menu of any copy of Windows 7 to the Start menu of the Server 2008 R2 install.

From an elevated command prompt run:
Regsvr32 atl.dll
regsvr32 “C:\Program Files\Windows Sidebar\sbdrop.dll”
regsvr32 “C:\Program Files\Windows Sidebar\wlsrvc.dll”
“C:\Program Files\Windows Sidebar\sidebar.exe” /RegServer

Now Copy the following lines into Gadgets.reg and import it into the registry.

Windows Registry Editor Version 5.00