I've recently done something similar (though more complex) for migrating terminal server users.

If you don't get far with Chris' hint ask again and I will dig out the script I used.