mdjake Posted January 11, 2009 Posted January 11, 2009 HOWTO: Reinstall Windows XP preserving user dataSituation:you have to reinstall Windows XP on a hard disk already containing a previous Windows XP and you can't backup your personal data because:-you haven't partitioned the disk as C: for Windows and programs and D: for all personal data-your previous Windows XP is corrupted and unable to boot-don't want to write a bunch of backup DVDs and don't have an external USB HDDNOTE: I've applied the process 10-20 times on different systems without any problem - nevertheless backing up your most critical personal data before the reinstallation is highly advised - I cannot take any responsibility if you mess up something or loose any of your dataWhat can you do:-you can do a Repair Install - if you ever tried this you know that this sometimes just messes things up-repartition or reformat your drive - you will get a clean Windows XP system but loose all your personal data-leave the filesystem intact - but this way you will get a multiboot setup, the new system goes under \WINDOWS.0, and there will be All Users.WINDOWS and Default User.WINDOWS folders under Documents and Settings, and your Program Files folder will be a messOR-boot with BartPE, UBCD4WIN or a Linux Live CD with NTFS write support, delete \WINDOWS, \Program Files and rename \Documents and Settings to e.g. \Archive and after this preparation you launch your Windows XP Setup CD and choose Leave Filesystem Intact instead of partitioning&formatting - the setup process will do a clean install and leave your files unharmed on the disk. I'll show you how to do this in an unattended way.The unattended way:1. you can use nLite to modify your setup source and apply your favourite tweaks (http://www.nliteos.com/) (OPTIONAL)2. after nLite but before the ISO creation slipstream drivers to your source with DriverPacks BASE (http://driverpacks.net/) This is a necessary step (and above that useful too - I always slipstream drivers to my source with Driverpacks so I don't have to hunt for drivers after the install) because we will take advantage of DriverPacks method 2 tweak. If you don't want to slipstream drivers I suggest you run DriverPacks BASE and slipstream the CPU drivers only - it takes on a few Kb of space in your source.3. after DriverPacks BASE finished the slipstreaming process it will replace the original SETUP.EXE which is called right at the start of the Gui Phase of the setup process with its own dummy SETUP.EXE which calls DriverPacks' PreSetup.cmd first (this will unpack the drivers from the CD to the hard disk) and then the original SETUP.EXE next to go on with the XP setup. We will modify this PreSetup.cmd with our batch commands taking advantage of that it gets called at the most appropiate moment of the setup process: after the text mode and in the beginning of the Gui Phase. So we integrate the following lines at the start of the PreSetup.cmd (you can find it in the I386 folder of the source)IF NOT EXIST "%SYSTEMDRIVE%\Program Files" GOTO PRESETUPCD %SYSTEMDRIVE%\RD /Q /S "%SYSTEMDRIVE%\Program Files"RD /Q /S "%SYSTEMDRIVE%\Documents and Settings\All Users"RD /Q /S "%SYSTEMDRIVE%\Documents and Settings\Default User"RD /Q /S "%SYSTEMDRIVE%\Documents and Settings\LocalService"RD /Q /S "%SYSTEMDRIVE%\Documents and Settings\NetworkService"RD /Q /S "%SYSTEMDRIVE%\Documents and Settings\All Users.WINDOWS"RD /Q /S "%SYSTEMDRIVE%\Documents and Settings\Default User.WINDOWS"RENAME "%SYSTEMDRIVE%\Documents and Settings" "Archive.%RANDOM%"MKDIR "%SYSTEMDRIVE%\Documents and Settings\All Users"MKDIR "%SYSTEMDRIVE%\Documents and Settings\Default User"REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList" /v "AllUsersProfile" /d "All Users" /fREG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList" /v "DefaultUserProfile" /d "Default User" /fSET %ALLUSERSPROFILE%="%SYSTEMDRIVE%\Documents and Settings\All Users":PRESETUP...<and here comes the contents of the original PreSetup.cmd>...What these script does is first it checks for the existence of "C:\Program Files" if this exists it assumes that a previous Windows installation is on the hard disk so it cleans up the Documents and Settings folder and renames it to Archive.<somerandomnumber>. After that we create the new empty Documents and Settings directory with All Users and Default User in it then we set the registry and the environment to point to these folders. This happens right at the beginning of the Gui Stage so when the setup process continues it won't have knowledge about the previous system installed on the same disk and this way we will get a fresh new installed system with our personal files backed up in the C:\Archive.<somerandomnumber> from where we can copy back our files to wherever we want them to be. We create a random folder for the backup in case there would already be an Archive folder in C:\.4. Before creating our Setup CD ISO you also need to alter the contents of the I386/WinNT.sif file. You need to set the TargetPath variable under the [unattended] section if it isn't already there like this:[unattended]TargetPath="\WINDOWS"This is necessary because if you don't set this variable the installation will take place under "\WINDOWS.0" folder if there's already a \WINDOWS directory on the partition from the previous system.5. After that you can create your ISO from the source, burn it and pop it in for a nice Windows XP installation without losing your precious personal data on the partition.Usage:1. Boot from the Setup CD.2. When Text Mode lists your partitions to choose for the new Windows install, choose the one where your old XP is already installed.3. Select Keep the filesystem intact option.4. Setup will ask you if it should delete the previous Windows installation, answer yes to that (L key).5. Setup deletes your old \WINDOWS directory and create a new one for the new system.6. Reboots into Gui Mode.7. At the beginning of the Gui Mode our modded Presetup.cmd gets called which backs up the previous Documents and Settings and creates a new empty one.8. The setup process continues further as normal.Issues:1. It is advised that you move back your personal files to the appropriate place after the installation finishes and remove the C:\Archive.<randomnumber> folder after that. If not there may be a small risk of an interference between the Archive folders next time you try to reinstall XP preserving your data.2. After the setup process finishes I always end up with sharedaccess.ini placed inside C:\Documents and Settings\All Users.WINDOWS\Application Data\Microsoft\Network\Connections\Pbk instead of the normal C:\Documents and Settings\All Users\... place. I don't know why it gets placed there (what other registry key should I modify) but I haven't found that this would break anything and I think I can safely copy it to the appropriate location after the setup process finished.Any feedback welcomed!
PuddleJumper Posted January 20, 2009 Posted January 20, 2009 Thanks for a very informative post. I wish I had found it before that long reinstall process! Suppose I did get the "All Users.WINDOWS", etc. folders. I'm sure to cringe and roll my eyes every time my links fail because I neglected the ".WINDOWS" part. Can anyone see any way to rename those folders without having to reinstall windows, or a tedious search and replace of the name through the entire registry? If the registry combing is the only route, will it be sufficient, or will the name be listed elsewhere, too?Thanks,WesleyHOWTO: Reinstall Windows XP preserving user dataSituation:you have to reinstall Windows XP on a hard disk already containing a previous Windows XP and you can't backup your personal data ...What can you do:...-leave the filesystem intact - but this way you will get a multiboot setup, the new system goes under \WINDOWS.0, and there will be All Users.WINDOWS and Default User.WINDOWS folders under Documents and Settings, and your Program Files folder will be a mess...Any feedback welcomed!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now