Darryl Mitchell


I break things and then fix them

772 words

@darrmitchell Thank
You'll only receive email when Darryl Mitchell publishes a new post

Server 2003 to Azure

May 21, 2018

I was tasked recently with migrating an entire datacenter off of VMware and on to Azure, and their production servers were predominantly Server 2003. Yes, seriously.

There is no documented process for migrating Server 2003 to Azure because Microsoft doesn't support running Server 2003 in Azure. But, I was able to find some small tips here and there, and after many months (!) of testing I was able to come up with a relatively foolproof process for getting Server 2003 VMs out to Azure. These are rough notes, so you'll need to fill in some gaps with your own Azure knowledge.

The first thing to know is the Azure VM agent doesn't run on Server 2003, so you're not going to get any of the helpful reset networking, RDP config type stuff you get with 2008R2+ machines. What that also means is, since Azure lacks a console, you need to make absolutely certain your machine is reachable over the network when it boots in Azure.

Import necessary PowerShell modules:

Import-Module AzureRM
Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'

Login to Azure account:


Login to 2003 VM and add local admin - this is critical because the domain will be uncontactable when booted in Hyper-V

Note: cached domain credentials can work, but only if you logged in recently

Download VMDK from VMware datastore - ensure you have enough space locally, as it will "expand" if it's thin provisioned

Also note the -VhdType FixedHardDisk and -VhdFormat vhd as Azure only supports Fixed VHDs, not dynamic or VHDX.

ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath .\Desktop\testserver.vmdk -DestinationLiteralPath 'C:\Users\Administrator\Desktop' -VhdType FixedHardDisk -VhdFormat vhd

Create new Hyper-V VM using converted VHD

  1. Launch Hyper-V
  2. New > Virtual Machine
  3. Set Name
  4. Generation 1
  5. Set RAM, Networking
  6. Use existing virtual disk - choose VHD (NOT VMDK)
  7. Finish and launch VM

Login to Hyper-V VM

  1. Install Hyper-V integration tools - gives mouse access
  2. Uninstall VMware tools
  3. Reboot
  4. Run Windows Updates
  5. Shutdown - make sure no blue-screen/clean shutdown because the "Add-AzureRmVhd" command you're about to run will check the filesystem for corruption

Set a resource group and destination for the uploaded VHD:

$rgname = "Test-RG"
$destination = "https://your.blob.core.windows.net/vhds/testserver.vhd"

Upload VHD:

Add-AzureRmVhd -ResourceGroupName $rgname -Destination $destination -LocalFilePath .\Desktop\testserver.vhd

Create global VM variables:

$location = "Central US"
$vmName = "myVM"
$osDiskName = 'myOsDisk'
$vnet = Get-AzureRmVirtualNetwork -Name "test-vnet" -ResourceGroupName $rgname

Create managed disk:

$osDisk = New-AzureRmDisk -DiskName $osDiskName -Disk (New-AzureRmDiskConfig -AccountType StandardLRS -Location $location -CreateOption Import -SourceUri $destination) -ResourceGroupName $rgname

Create security group and rule to allow all local traffic:

$nsgName = "myNsg"
$allowAllRule = New-AzureRmNetworkSecurityRuleConfig -Name "LocalNetwork-AllowAll" -Description "Allows all traffic from local subnets" -Access Allow -Protocol * -Direction Inbound -Priority 100 -SourceAddressPrefix "" -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange *
$nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $rgname -Location $location -Name $nsgName -SecurityRules $allowAllRule

Create a network interface:
Make sure your subnet Id is actually $vnet.Subnets[0].Id

$nicName = "myNicName"
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -SubnetId $vnet.Subnets[0].Id -NetworkSecurityGroupId $nsg.Id

Create VM config:

$vmConfig = New-AzureRmVMConfig -VMName $vmName -VMSize "Standard_A2"
$vm = Add-AzureRmVMNetworkInterface -VM $vmConfig -Id $nic.Id
$vm = Set-AzureRmVMOSDisk -VM $vm -ManagedDiskId $osDisk.Id -StorageAccountType StandardLRS -CreateOption Attach -Windows

Deploy VM config:

New-AzureRmVM -ResourceGroupName $rgname -Location $location -VM $vm

If your VM isn't reachable over the network in 5-10 minutes, you can check Boot Diagnostics in Azure to take a look at where the login process is - Windows logo screen, updating, etc.

Not an easy process by any stretch, but this process brings together several hours of searching and notes, so should point you in the right direction.

Simplenote Export

May 14, 2018

Simplenote provides an easy export, but the exported file names are actually a Simplenote object identifier of some kind. Not super useful.

The exported note has the note name stored as the first line in the file. You can use a simple PowerShell one-liner to recover your filenames.

Download .zip from Simplenote

Extract to directory

cd to directory in PowerShell and run the following command:

ls | % {$names = (Get-Content $_.name -First 1)+".txt"; foreach ($name in $names) {Renam
e-Item $_.Name -NewName $name}}

As a bonus, if you want to remove extra spaces leftover at the top of the file as a result of the export, you can quickly remove those:

ls | % {(Get-Content $_.name | select-object -Skip 1) | Set-Content $_.name}

There may be a better way to do this - i.e. in a single script or line, but this will get the job done and get it done quickly.