Creating Windows OEM recovery DVDs with Windows AIK (part 1)

Posted on Updated on

This post follows the previous post in were I explained how I bought a new ASUS laptop with preinstalled Windows 7 PRO x64 OEM and they didn’t give me the restore DVDs. Instead they had a retarded restoring system that relied on a 20GB partition in the HD that got useless when I changed my Partitions to use the Striped and Mirror features that come with the OS.

In this post I’ll explain how to manually create a set of DVDs from the original ASUS system image files named asus.swm, asus2.swm and asus3.swm. This method can be used for other brands that have the same type of lame restoring system or if you want to split an image bigger than the size of a DVD (usually the split is named install.swm install2.swm install3.swm).

After you finish reading your post you’ll be able to create a set of DVDs/CDs of the size you want and have a bootable DVD/CD that will automate the restoring and prompting to introduce the next disk. I’m going to add as many details and explanations as I can to allow non developers to be able to understand the process and create their set of DVDs. So if you find it too easy, skim through. If you find it still complicated, add a comment and I’ll try to give more samples (you can read the MS documentation as well).

To create the recovery DVDs we are going to need “Windows Automated Installation Kit for Windows 7” (Windows 7 AIK) installed (you can download it and install it for free). This is the set of tools that the laptop manufacturers use create the images that are installed in your system. This post can also be used as a tutorial to understand the process of deployment using Windows 7 AIK (the steps used here are taken out from Microsoft documentation and they are using the tools that MS has made freely available to users to deploy Windows in an alternative way to standard setup). I take no responsibility of any errors in the scripts that I’ll be providing in the next post and I take no responsibility of the information that could be lost by using these steps. Please take your time to read the official Microsoft documentation about the tools and the risks of using them ( and remember that restoring the image will wipe out all the data in your HD so you need to run a backup of your data before you restore your system. And remember that these instructions should never be used to install Windows in a computer other to the one that you have paid the license for (no license no install). Please read read your Windows license agreement before following the steps to install your Windows image.

Lets get started!

Before we start with the process ne need to have the full image file (install.wim or asus.wim or image.wim) or the image already split in parts (asus.swm, asus2.swm and asus3.swm or install.swm install2.swm install3.swm). If you want to change the size to use double layer DVDs or CDs or a Blu-Ray or any other thing, you can join your image and then split it back in the size that you want. To do that you can use imagex command to:

Split an image file:

  • imagex /split C:\imaging\asus.wim D:\imaging\asus.swm 4000
  • imagex /split C:\imaging\install.wim D:\imaging\install.swm 4000

Join an image file:

  • imagex /ref asus*.swm /check /export asus.swm 1 asus.wim
  • imagex /ref install*.swm /check /export install.swm 1 install.wim

Now that we have our images with the size that we want, we are going to start.

Create a bootable DVD to start the process

To restore the system we need to create a bootable DVD with all the tools required to boot, configuration files to create partitions and scripts to restore the image.

In this process I will assume that we have installed Win AIK in the standard path (c:) and that we want to do the work in the d: drive.

    1. Start Windows AIK command line as an administrator


  1. Get the required files for the boot DVD (boot image with standard MS tools)
    • copype.cmd x86 d:\winpe_x86
  2. Mount the image to add custom restore scripts (this is similar to mounting an ISO but here we use a folder for you to modify the files)
    • imagex.exe /mountrw d:\winpe_x86\winpe.wim 1 d:\winpe_x86\mount
    • mount winpe.wim (MS boot image) in the folder that we specify)
  3. In this step we will copy the restore script and the commands to re create the disk partitions (I’ll explain this later in the next post). However, with the DVDs you can already manually restore your system once you boot with the first restoring disk (the process requires to create 2 partitions, 1 for Windows and 1 to copy the *swm files)
        • restore.cmd: script to restore the system automatically
        • clear_partitions.txt: Cleans the Hard drive
        • create_partitions.txt: Creates the partitions before restoring the image

    copy restore.cmd d:\winpe_x86\mount\Windows\System32\
    copy clear_partitions.txt d:\winpe_x86\mount\Windows\System32\
    copy create_partitions.txt d:\winpe_x86\mount\Windows\System32\

  4. Modify startup to call our restore script (This step required opening notepad as administrator. You can launch it from an Administrator command line)
    • notepad.exe d:\winpe_x86\mount\Windows\System32\System32\startnet.cmd
    • startnet.cmd is the script the is executed when booting the DVD. We need to add an extra line at the end of the file to call our restore.cmd script
    • What we have done here is to call our script to start the restoring process. This allows us to create an automated restoring process for simplicity.
  5. Save the changes in the customized image (commit the changes to the mounted boot image)
    imagex.exe /unmount /commit d:\winpe_x86\mount
    imagex.exe /unmount d:\winpe_x86\mount
    imagex.exe /unmount /cleanup

    Note: For some reason, sometimes the first command sometimes doesn’t do all the work and there are files still hanging around. Most likely the command has successfully updated the image but it can’t unmount and release the files. If this happens, you need to close all the Windows Explorer windows and run the second and third commands (some times even several times) until “imagex.exe /unmount /cleanup” tells you that nothing is mounted.
  6. Create the DVD folders (each folder will be one DVD)Create folders:
    d:\ASUS\DVD1\sources (this will be the bootable DVD)
    d:\ASUS\DVD3\sourcescopy asus.swm d:\ASUS\DVD1\sources
    copy asus2.swm d:\ASUS\DVD2\sources
    copy asus3.swm d:\ASUS\DVD3\sources
  7. Add extra required tools to DVD1 to make the DVD bootable and copy the program used to restore the system
    xcopy /y /e d:\winpe_x86\ISO\*.* e:\ASUS\DVD1\
    copy “C:\Program Files\Windows AIK\Tools\x86\imagex.exe” d:\ASUS\DVD1\
  8. Copy customized boot to DVD1 (created in step 6)
    • copy d:\winpe_x86\winpe.wim d:\ASUS\DVD1\sources\boot.wim
    • Notice the change of name. The destination name must be boot.wim
  9. Create the disk images (notice that the first one is bootable)
    oscdimg -m -n -b”d:\winpe_x86\” D:\ASUS\DVD1 D:\ASUS\DVD1.iso
    oscdimg -m -n D:\ASUS\DVD2 D:\ASUS\DVD2.iso
    oscdimg -m -n D:\ASUS\DVD3 D:\ASUS\DVD3.iso
  10. Burn images to DVDs (with Windows 7 right click on the ISO and choose burn)
  11. Congratulations! You have created your set of restoring DVDs.

In the next post I’ll explain how to fully automate the process creating the scripts from the step 4.

Update: I have added a new post in where I explain how to fully customise the WIM image, update it with service packs and updates and remove bundled crap to create an updated and clean image that can be safely used to bring your computer to a clean state without the pain of running all the Windows updates again. Please check my post.


21 thoughts on “Creating Windows OEM recovery DVDs with Windows AIK (part 1)

    sasa said:
    July 8, 2010 at 09:29

    I have done almost everything like this without these additional script. When I boot wpeinit appeared and nothing happens afterward. What command should I use to move forward. I create partition with diskpart manually.. and what next ….

    […] alternatives to the creation of the DVDs. To fully understand the process I recommend reading the part 1 of this […]

    sasa said:
    July 9, 2010 at 05:39

    Great article… thank you very much 🙂

    roulette strategy said:
    July 19, 2010 at 05:40

    Damn, that sound’s so easy if you think about it.

    Matteo Adinolfi said:
    November 6, 2010 at 23:03

    Dear Roberto,
    I have read all your posts about creating windows oem recovery dvds with windows aik.
    I found your guide while i was looking for a way to create a clean windows’ image without all the rubbish pre-installed by asus using asus’ recovery image stored in the hidden partition (I got an Asus Eeebox 1501P).
    My Os installed is Windows 7 Home premium 64 bit oem.
    Alternatively, i can obtain a retail clean copy of the os, but i don’t know if in that case the oem key will be accepted.

    Do you have any idea about this?

    Thank you very much if you can help me and also if you wouldn’t be able to help me 🙂

    Greetings, Matteo

      Roberto Mencia responded:
      November 7, 2010 at 22:38

      Hi Matteo,
      I don’t know much about licensing, but I can tell you that I’m 99.99% sure that the license that you have it is for the image that comes installed with your computer and you can NOT use it somewhere else.
      I asked ASUS technical service and they told me that if I wanted to install Windows I had to buy it. AGAIN.
      What I’ve done, though, is get the fresh image, remove all the crap that I didn’t want and save the image in a usb using Windows Backup. That method saves all the partitions and the rest, so it’s very easy to restore the image to the cleaned image I had.
      I’ve kept the original recovery DVD images only in case I have to sell the Laptop.

        James said:
        August 1, 2012 at 15:23


        Well we found all this out via another route.. basically the images we use will accept any valid Windows key.. OEMs as well.. we found a whole market niche for people who have lost their recovery partitions. Basically if you have your COA and can read it (many Windows 7 COA the product key wipes off!!) you are legally allowed to reinstall your Windows without re-buying a full copy.. Provided you are the original owner of that machine and you purchased that with a valid legal COA. I woudl very much give the manufacturers a wide birth as some of them will try to charge you $100 for replacement however Sony will replace a recovery disk for $15 so look around. There is also an upgrade program out there somewhere that will upgrade any valid Windows COA (XP and onwards) to a Windows 7 COA.. Believe it or not if you sell your laptop you are NOT allowed to sell it with the old OS.. even with a valid COA its not transferable.. We have spent a lot of money with the legal beagles working out legal routes too help people.. pretty much ~Windows XP we cant supply

    Matteo Adinolfi said:
    November 7, 2010 at 22:55

    Dear Roberto,
    I just receveid your reply and I thank you very much.
    I’ll make some test and I’ll tell you the results.


    AJ said:
    April 7, 2011 at 00:51

    Hi Robert,

    I was about to start reading your article when suddenly my laptop failed to boot and the only fix available to me at the time was to completely wipe the recovery partition.

    It was ok to me then since I upgraded my OS to a Full License Release version.

    I did a little research about OEM license and I found out that OEM licenses is only exclusive to the computer/unit to which it is installed. The OEM serial keys will not recognize any other machine aside from the motherboard to which the OEM “imprinted its activation memory” (I don’t know how else to explain it so pardon the lack of better explanation).

    That made me feel that it’s ok to delete the recovery partition since I don’t intend to downgrade my OS, but now that you mentioned that it might be useful should I decide to sell my laptop in the future, I think I might be in trouble. lol
    Maybe I’ll just tell the buyer to purchase his/her own OS.

    This is a great article, btw. Thank you for this.

    mystvearn said:
    August 23, 2011 at 10:59

    Hi Roberto, I got some problems with this setup.
    In step no. 2:

    “Get the required files for the boot DVD (boot image with standard MS tools)

    2. copype.cmd x86 d:\winpe_x86”

    The WIn AIK says copye.cmd is not recognised as an internal or external command, operable program or batch file. Where am I going wrong.

    My Asus files are asus.swm…asus4.swm, Do I need to split/join the files?

    Thank you

      Roberto Mencia responded:
      August 23, 2011 at 11:34

      Now that I think, you may need Powershell to run it (I don’t remember now), but Windows 7 already has Powershell, I guess.

      copype.cmd is a command/program from Win AIK installation. When you install WinAIK you should have the commandlet installed.
      To start the commandline as administrator you need to right click on the command prompt (step 1) and choose run as administrator.

      Step number 2 is before needing the asus.swm files, so don’t worry about that yet.
      try to execute copype.cmd only to see if it can find the program. Otherwise you might need to find it using windows explorer by running a search of all your files.

      Let me know if you still have issues and I’ll try to explain myself better.
      Good luck.

    Jackco said:
    October 2, 2011 at 01:00

    I know this post is old, but anyway here’s a solution to mystvearn’s problem above:.:
    It seems that you misspelled the command: you typed “copye” it should be typed “copype”. You omitted the second “p”.
    Whenever an error says that something is not recognised as an internal or external command, operable program or batch file, it is usually because of a typo.Always check your spelling!

    […] while back I explained how to create some Win 7 recovery DVDs using the ASUS WIM recovery image, for the people like me that wanted to have that option. Now, it’s time to get the image updated […]

    matia said:
    May 6, 2012 at 21:07

    Hello I have a asus n61jv and after installing Slackware LILO bootloader partitions except me (wat windows and even recovery) I tried using F9 but I could not seem to me that LILO has deleted MBR then I had to install a 7 windovs and I’m looking for a way to reinstall windows from the recovery partizion.Il f9 still does not make me start recovery mode, and if it does not take it as all.

      Roberto Mencia responded:
      May 6, 2012 at 22:11

      Hi matia, This is the standard recovery scenario that the this post talks about. With your Linux disk, mount all the partitions in your disk and find the ASUS.WIM recovery file. The recovery partition is usually the first one in the disk.
      After you have recovered your file you can follow the tutorial.
      In case you have deleted the partition, you have 2 options: you find someone with the same model (or not, it doesn’t really need to be the exact model, but you need to manually uninstall the drivers and find new ones) and you copy the file from him, or you contact ASUS to get your system recovered. They should be able to do it if it is still under warranty. Otherwise, you need to buy a new copy of Windows or go Pirate.
      Going to Apple is an option as well for your next computer, as Microsoft seems to be making the Windows experience worse and worse with the OEM.

    matia said:
    May 6, 2012 at 21:10

    Ciao ho un asus n61jv e dopo aver installato slackware il bootloader LILO mi ha esclusi i partizioni (quelo di windows e anche recovery)ho provato con F9 ma non ci sono riuscito sembra che LILO mi ha cancellato il MBR poi ho dovuto installare un windovs 7 e sto cercando il modo di reinstallare windows dal recovery partizion.Il f9 ancora non mi fa partire recovery mode, e se come non lo prendesse affatto.

    Derx said:
    August 19, 2012 at 17:33

    Copy restore.cmd doesn’t work for me, as i search the system can’t find any file named ‘restore.cmd’ where can i find this file ?

      Roberto Mencia responded:
      August 19, 2012 at 23:27

      This is a 2 part post. You can find how to create your restore.cmd in the next post (part 2).

    Aries Toding said:
    March 23, 2013 at 00:39

    I have been following your articles well and practice it, according to your article, because I want to make a recovery disk from toshiba file. SWM is a problem now for me is when I have entered the installation message x: \ source \ winpeinit x: \ windows \ system32 and stop there. please give instructions

      Roberto Mencia responded:
      March 24, 2013 at 21:40

      Sorry, I think I need more information about your issue.
      I don’t understand what you are referring to.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s