Source: 

Note
Important

You must use the Sysprep /generalize command to generalize a complete Windows installation before you can use the installation for deployment to a new computer, whether you use imaging, hard disk duplication, or another method. Moving or copying a Windows image to a different computer without running the Sysprep /generalize command is not supported.
 
Warning
Using this method causes Windows 7 to lose all activation information, and it needs to be reactivated afterwards. If your Windows 7 is an OEM version, you might not be able to reactivate it, at least not without phone activation option.

I do not recommend to use this method on RAID systems. All experiments on RAID I know have failed.
 
Warning

An upgraded Windows cannot be sysprepped. As this method is based in sysprepping, this tutorial is valid only for Windows setups which have not been upgraded.

This means that if you have for instance in-place upgraded Vista to Seven, or using Anytime Upgradeupgraded for instance a Home Premium to Ultimate, you cannot sysprep and this tutorial cannot be used in your case.

Notice that a repair install is also an upgrade install, so if you have ever done a repair install (= in-place upgrade to same edition), you cannot sysprep.


PLEASE DO NOT FORGET TO CREATE A SYSTEM IMAGE BEFORE PROCEEDING!


As you can read on this thread, on rare occasions this method does not work. If this happens, you can always restore your system using your backup image.

Backup Complete Computer - Create an Image Backup
System Image Recovery

IE10 Users: Please read this article first: Sysprep Fatal Error With IE 10 (FIX) | System Administration
METHOD ONE 
 
Changing hardware components but keeping old hard disk(s)

Use this method if you:
- Change other hardware components but keep your old HD containing Windows 7
- Move the HD containing Windows 7 to another computer
  1. Before installing new hardware, boot Windows 7 normally
  2. Disconnect all external hardware except mouse, keyboard and main display. If your system folders are located only on C: drive, disconnect all other hard disks except that containing the C:. In case of relocated system folders, for instance the profile folder Users located in another drive and other system folders on C:, first move the relocated system folders back to C: then disconnect all other drives. Reboot after this
  3. Run Command Prompt as administrator
    .
    Name:  Audit_1.png
Views: 247750
Size:  56.0 KB
    .
  4. Type to Command Prompt: %windir%\System32\Sysprep\Sysprep.exe, and hit Enter
    .
    -sysprep_start.png
    .
  5. In sysprep dialog that opens, choose System Cleanup Action as Enter System Out-of-Box-Experience (OOBE), selectGeneralize, select Shutdown Options Shutdown. Click OK
    .
    Name:  Sysprep_Run_and_generalize.png
Views: 223522
Size:  12.6 KB
    .
  6. Sysprep generalizes now your Windows 7 setup and shuts down your computer. Do not run any other programs during this phase!
    .
    Name:  Sysprep_Run_and_generalize_2.png
Views: 463549
Size:  3.5 KB
    .
    Name:  Sysprep_Run_and_generalize_3.png
Views: 463319
Size:  3.4 KB
    .
  7. Switch the main power of your PC off and install the new hardware OR dismount the hard disk(s) and mount it (them) to a new computer
  8. Boot the PC from sysprep generalized hard disk. You will notice Windows booting as if it was the first boot after installation, installing default drivers and updating registry. One or two reboots are needed, depending on your system specifications
    .
    Name:  Sysprep_Reinstalling_devices.png
Views: 224951
Size:  5.0 KB
    .
    Name:  Sysprep_Registry_settings.png
Views: 224524
Size:  46.2 KB
    .
    Name:  Sysprep_Reboot_needed.png
Views: 224053
Size:  8.8 KB
    .
  9. When Windows finally boots up, you will need to enter all information as if this really was a new, fresh installation
    .
    Name:  Sysprep_First_boot_2.png
Views: 221785
Size:  18.4 KB
    .
  10. Because your old user profiles already exist, Windows does not accept your normal username, but instead you have to create a new temporary user. I use username Test for this purpose
    .
    Name:  Sysprep_First_boot_3.png
Views: 223198
Size:  21.8 KB
    .
  11. When login screen appears, choose your old user account to login
    .
    Name:  Sysprep_First_boot_5.png
Views: 221618
Size:  56.0 KB
    .
  12. Windows boots now to default OOBE first boot desktop, with default 800*600 resolution and default theme. All your installed applications are there, as well as your old user profiles and folders. Windows has installed the default drivers for your setup, you can update them if needed
    .
    -sysprep_first_boot_6.png
    .
  13. Go to Control Panel > User Accounts and delete the temporary user account (in this case Test) that you just created
METHOD TWO 
 
Change the hard disk(s) or move Windows 7 setup to a new computer using third party imaging software

Use this method if you:
- Replace the HD containing Windows 7 on your old computer 
- Move Windows 7 to a new HD on another computer

  1. Follow steps 1 through 5 above (method 1)
  2. Boot PC with an imaging CD/DVD (Paragon, Macrium etc.). Here's a tutorial for imaging with Macrium FreeImaging with free Macrium
  3. Create an image of your system
  4. Turn PC off, change the hard disk(s) and reboot with imaging application, restoring the image OR boot the new computer with imaging software and restore the image
  5. Continue from step 7 above (method 1)


This procedure is failsafe, and works every time. There is nothing to worry, but of course it is recommended to make a backup before trying this. I have even used this method when some serious driver issues caused the PC to constantly crash (BSOD), to reset all drivers to Windows defaults and then reinstalling them one by one to find the culprit.

Note
What does Sysprep generalizing do to my Windows 7 setup?
  • All system specific information is removed or uninstalled
  • Security ID (SID) of your hardware setup is reseted
  • All system restore points are deleted
  • All event logs are deleted
  • All personalization is removed (taskbar, toolbars, folder options, start orb etc.)
  • Built-in administrator account is disabled (if it was enabled) and needs to be re-enabled if needed

What happens when booting first time after sysprep generalizing?
  • First boot configuration is run
  • New SID is created
  • Re-arm counter is reseted if not already re-armed three times
  • Windows 7 is booted using first boot default drivers and settings



I have tested all above mentioned methods with all versions of Windows 7, from Starter to Enterprise. It works every time, with one exception: for reasons unknown to me, sysprep seems sometimes dislike Windows Media Player networking service, which is by default started every time Windows 7 starts. In about every third time I've done this, I've got an error message when trying to generalize:

Name:  Sysprep_Fatal_Error.png
Views: 222341
Size:  6.8 KB

However, this is not a big problem. You just need to stop the WMP networking service, and run sysprep with generalize option again. You can stop the service in question by typing net stop WMPNetworkSvc to command prompt, and hitting Enter:

-sysprep_stop_wmp_service.png

If you have any questions, do not hesitate to ask.

Happy computing!

Kari

EDIT: A Useful tip from xxxwea, as later confirmed by Victor:

Quote   Quote: Originally Posted by Victor S View Post
Kari, just a suggestion.

You might note in the tutorial that if on first booting Windows can't finish configuring, a reboot into safe mode, then a normal reboot will allow it to finish successfully.

This has happened to me both times I used a sysprepped system drive in a new computer. I found the answer to this problemburied deep in this thread the first time I ran into it, and the same thing happened yesterday on a different computer.

It's a seemingly very silly solution, but it works. I do believe many people have abandoned their sysprep work when they encounter the problem.

I think the solution deserves more visibility.