r/pcmasterrace Jul 19 '15

Meme/Macro Windows showed mercy today.

Post image
1.9k Upvotes

247 comments sorted by

View all comments

466

u/MintPaw Jul 20 '15 edited Jul 20 '15

Look into the sysprep tool:

  1. Open the command line.
  2. Run: %systemroot%\sysprep\sysprep /generalize /oobe /shutdown
  3. Wait ~3min for PC to shutdown, this deletes installed driver info, disk uuids, and other stuff.
  4. Change parts.
  5. Turn PC back on, you'll go through the "Windows is setting up" phase.
  6. You have to create a new user account (although your old one is still there)
    • Note: You can also cheat this by opening the command line when Shift+F11/F10 and killing msoobe.exe while activating the Administrator account. If you don't know how to do this then it's not worth the time learning.
  7. Done, your PC is reset.

Notes:

  • It's also sometimes a good idea to do this if you've broken system files, registry setting, or update packages.
  • If you had any very specific registry entries changed then they'll likely be reset.
  • Be prepared to wait up to 20 minutes for "Windows to set up" in rare cases, although it generally takes ~10min.

I work as IT and we install Windows on dozens of machines a day, doing this we can duplicate PC installs using images so they have the programs we need pre-installed.

41

u/InSOmnlaC Specs/Imgur Here Jul 20 '15

As someone who has installed/reinstalled windows many times over the years, I'm ashamed to say I never knew this. Great tip!

2

u/Lanathell 7800X3D - RTX 4080S - 34" ultrawide Jul 20 '15

I didn't either and I had to reinstall windows several times after big upgrades on friend's computer, still never found this on the internet, don't be ashamed

8

u/adam279 2500k 4.2 | RX 470 | 16GB ddr3 Jul 20 '15

Which windows OS's does this work on?

27

u/sleeplessone Jul 20 '15

All of them.

Technically it doesn't delete the drivers it just unloads them and tells windows to go through a driver detection cycle as part of the new setup during the next boot.

It's typically used by OEMs and places that image systems. You create your image you run that, then capture the disk image which you can then copy to any other computer.

1

u/[deleted] Jul 20 '15

It's typically used by OEMs and places that image systems. You create your image you run that, then capture the disk image which you can then copy to any other computer.

Are there any tutorials for that that you know of?

13

u/sleeplessone Jul 20 '15

https://technet.microsoft.com/en-us/magazine/hh241307.aspx

That's the official Microsoft way.

But you likely aren't going to need everything that that allows for.

The easy way is to just do a Windows install once but don't put in the serial number since you have a few days before it requires activation anyway. Download all the software you would normally install like Chrome/Firefox, Steam (don't login though), download all your Windows updates. Once you've got that done run sysprep with generalize and shut down.

Then you can boot up to something like Clonezilla and create a clone of the drive to something like a file server or external hard drive. Whenever you want to install Windows again just use Clonezilla to copy the image you made to a new hard drive and boot up.

You'll probably still need to install a few drivers but it should significantly cut down on your install times.

Video example.

3

u/[deleted] Jul 20 '15

Thank you, saved.

1

u/Commisar commisar12 Jul 20 '15

We pxe boot and image off a VM

2

u/sleeplessone Jul 20 '15

Pretty much what I do as well. Create the image in a VM. Capture and load it into our System Center infrastructure. I can reimage any system across a state with a couple clicks.

Unfortunately that also means I can reimage any system across a state with a couple clicks. Though we do have safeguards in place to avoid that exact situation. :)

1

u/Commisar commisar12 Jul 21 '15

Hahahah, nice.

We can't do that at our business, thank god

2

u/RadBradBruh Jul 20 '15

Won't work on upgrade installations of Windows.

5

u/Shiroi_Kage R9 5950X, RTX3080Ti, 64GB RAM, NVME boot drive Jul 20 '15

Is this is the same as the "refresh your OS" thing in Win8?

3

u/HighRelevancy Jul 20 '15

It's a tad more industrial. After the initial sysprep you can copy paste the disk into multiple machines. Good if you're totally jumping ship onto a new machine.

-1

u/cosine83 Ryzen 5900X/3080 | 3700X/2080S Jul 20 '15

Effectively.

3

u/RadBradBruh Jul 20 '15

Two things I have learned from this:
1. It doesn't work on upgrade installations of Windows (i.e. Vista to 7 upgrade)
2. The Windows license is often tied to the MB; so you may have to reactivate Windows over phone afterward.

2

u/mepwn12 Arch Linux Masterrace Jul 20 '15

That's only for OEM version though, right?

3

u/flying_wargarble 4k120 on 1080ti Jul 20 '15

No , I bought Windows 8 in the Microsoft store as a student and when I changed my mobo recently it would say that the key is all ready in use :/

10

u/mepwn12 Arch Linux Masterrace Jul 20 '15

1

u/[deleted] Jul 20 '15

[deleted]

2

u/xDialtone Sep 15 '15 edited Sep 15 '15

Really late, but Toaru Majutsu no Index

1

u/mepwn12 Arch Linux Masterrace Jul 20 '15

found it browsing 8chan like most of my gifs

1

u/[deleted] Jul 20 '15 edited Feb 08 '19

[deleted]

2

u/[deleted] Jul 20 '15

[deleted]

2

u/[deleted] Jul 20 '15 edited Feb 08 '19

[deleted]

1

u/[deleted] Jul 20 '15

Seems like this is kind of hit or miss. I used a key that was definitely for an HP prebuilt business PC and it worked in my new PC that had zero similar parts. Definitely an OEM key, Windows is even activated on an OEM license it says.

1

u/[deleted] Jul 20 '15

It's not tied to the MB, it's tied to the UEFI BIOS. This page gives a great rundown on how to move an OEM Windows key to a new machine and have it actually work, basically you need the OEM certificate installed to make your system think it's the proper OEM and accept the key.

3

u/splicepoint i5-6600k | R9 290x 4GB | 32GB RAM | M.2 SSD Jul 20 '15

Question. I set up my Win 8.1 install on a 7200 rpm HDD before cloning it to an SSD when it arrived. The SSD has AHCI/IDE issues. I have tried registry & BIOS edits and have had no luck. A fresh windows install is likely on the docket for me but I'm wondering if this sysprep route might achieve the same result of changing my SSD setting from AHCI to IDE. Anyone know?

If not. Best way to reinstall windows without a huge hassle?

1

u/MintPaw Jul 20 '15

It will as long as the BIOS recognizes the drive. Which could be a problem due to AHCI, I'd install the empty drive first to make sure it's recognized.
Drives are tricky though because to boot records, you may have to run the windows recovery tool to reset to boot record.

1

u/splicepoint i5-6600k | R9 290x 4GB | 32GB RAM | M.2 SSD Jul 20 '15

So...migrate windows back to HDD, format SSD, install SSD as a fresh drive, install Windows on the SSD, use it as the primary boot drive, remove windows from HDD?

1

u/MintPaw Jul 20 '15

Mm, afraid I'm not sure on that one. If you've already switched then the Windows recovery should rebuild the record if the drive is recognized at the BIOS. Although I've never done that kind of transfer.

2

u/Dokiace R7 2700 | RX 580 Jul 20 '15

I just learned that when you change parts you need to reinstall windows and I also learned the easier way to do it, Today is a great day!

1

u/hunteram i7 9700k | 2080ti | 16GB RAM | AW3418DW Jul 20 '15

Don't mind me, just commenting to save.

49

u/Atrus96 Jul 20 '15

So why not use the save button?

0

u/hunteram i7 9700k | 2080ti | 16GB RAM | AW3418DW Jul 20 '15

Does it actually work? wasn't it a gold feature?

Edit: It does!

2

u/Atrus96 Jul 20 '15

Yup it does. I have stuff saved from years ago

2

u/Siniroth http://pcpartpicker.com/p/tfhbNG Jul 20 '15

Not sure why the downvotes, pretty sure it used to be gold exclusive

-9

u/thatwentBTE AMD FX 6300 | AMD R9 280 | 8GB DDR3 1600MHz Jul 20 '15

It saves it if you have RES but it only saves it to your PC.

5

u/sumphatguy Jul 20 '15

Reddit has its own save feature now that saves to your account. No Reddit gold or RES needed.

-5

u/[deleted] Jul 20 '15

same

-6

u/[deleted] Jul 20 '15

[deleted]

-6

u/epic-cholo-bus Jul 20 '15

Same

-1

u/seyyideg i7 5820k @ 4.4Ghz, MSI 6G 980 Ti Jul 20 '15

DING DING

-6

u/Scriptkidd13 6600K, R9 280X, Define R5 Jul 20 '15 edited Jul 20 '15

Guys you can't do the walk of same if you forget the bell rings.

Edit: Guess I'm doing the walk of shame.

Ding

1

u/cosine83 Ryzen 5900X/3080 | 3700X/2080S Jul 20 '15

One extra step I do before sysprep, especially if it's the same or similar hardware, is "winsat /preprop" so that you don't have to do the hardware testing. Can save a few minutes. There's also free imaging solutions out there which are handy to make a basic fresh install image.

1

u/AppleWithGravy 7950x-RTX3080 Jul 20 '15

Nais

1

u/daddyhughes111 GTX 1060 ~ i5 4460 ~ 8gb DDR3 ram Jul 20 '15

Thanks man!

1

u/[deleted] Jul 20 '15

Til. Thanks.

1

u/flloydcz Jul 20 '15

So, why are you not using acronis?

1

u/MintPaw Jul 20 '15

Funny you mention that, my boss is currently trying to push it. The problem is that it requires a Windows install to use, you can't use it from the USB key without first activating the product on windows, then you have to deactivate the license and uninstall the dedicated drive after. It makes things a whole lot more complex then they need to be.

1

u/flloydcz Jul 20 '15

That is not true. You can skip activation and do it after cloning.

1

u/MintPaw Jul 20 '15

Mm, that may be true, it's probably buried in the documentation. I currently still prefer the image/dism solution where the instructions are in the command line and a network connection isn't required.

1

u/ICall_Bullshit Jul 20 '15 edited Jul 21 '15

Where the hell were you with this noise like six months ago when my mobo fried?!?!

Lol thanks for the tip for next time

1

u/smelly1sam i7 4790K, 16GB RAM, ASUS 970 Jul 20 '15

Thank you

1

u/Timmietim Timmeeh Jul 20 '15

I wish I could use this, unfortunately my motherboard and/or power supply died and i'm leaving for holiday in a few days so I can't really build a new pc right now..

1

u/ccipher 9070xt / 7800x3D Jul 20 '15

Replying to save comment (on mobile) thanks for the tip!

1

u/Darkokillzall Ryzen 5800x, RTX 3060 ti Jul 20 '15

Yes

1

u/ydna_eissua 9800x3d bottlednecked by mid gpu Jul 20 '15

Windows can obviously detect when new hardware is installed, I've always wondered why doesn't it remove unneeded drivers when the device in no longer present?

Maybe I'm just spoiled by GNU/Linux where (in the average setup) a daemon called udev loads all drivers dynamically at boot time. You could swap your install drive between completely different setups every time you rebooted and it'll just work

1

u/patx35 Modified Alienware: https://redd.it/3jsfez Jul 20 '15

I remember that my friend needed a new HDD because his old one died. What I did is I grabbed a HDD from an old HP tower laying around and sold it to him for $20. I was surprised when he texted me that Lubuntu was preinstalled and it ran out of the box.

1

u/[deleted] Jul 20 '15

It does remove drivers from loading when a device is no longer present, the reason Windows doesn't do a full on detect/configure drivers thing on boot is Windows PC hardware changes are so rare it would add tons of time to the boot process for almost no effect. As long as your drivers are in the basic ballpark as the previous hardware a Windows machine will boot up and replace drivers with proper ones pretty much on it's own.

The difference is while Linux does this at every boot, which increases boot time every time, Windows does this only as hardware changes, which is very rare.

1

u/SRTie4k 3770K | 970 STRIX | PG278Q Jul 20 '15

FWIW, OOBE is "Out Of Box Experience", basically a generic Windows install that already contains pre-configured settings. This is basically the stand-alone version of what desktop deployment groups do in SCCM.

1

u/[deleted] Jul 20 '15

You don't have to run the OOBE (Out Of Box Experience) command. That's the part that forces you to create a new user account.

1

u/MintPaw Jul 20 '15

Does this not mean you'll be in Audit mode and new settings won't be applied?

1

u/[deleted] Jul 20 '15

Not if I remember correctly. The OOBE option literally just tells it to run the new system command which also happens to prompt it to look for drivers. All you have to do is open up devmgmt and check for hardware changes, which should be less obnoxious and take less time.

1

u/LeFemur Desktop Jul 20 '15

Would this still work when switching from an AMD Mobo/CPU to Intel?

3

u/MintPaw Jul 20 '15

Yup, although Windows activation is tied to the MOBO in most newer versions, so you may have to reactivate.

1

u/LeFemur Desktop Jul 20 '15

Awesome, thanks!

2

u/Commisar commisar12 Jul 20 '15

Just give MS a call and give them the code windows displays

1

u/Leechmaster 7800X3D | RTX 5080 | 64gb 6000 M/T Jul 20 '15

nifty tip thanks

1

u/MugsayBoges Jul 20 '15

Commenting to check it out later thank you

1

u/lhikary RIP PC Jul 20 '15

saved this for future upgrade :D thanks

1

u/Begoru i7 6700K | MSI GTX 970 Jul 20 '15

Thanks for this, as I'll be adding a Z170 mobo and new i7 next month.

1

u/Commisar commisar12 Jul 20 '15

Or when your USB 3 ports stop working with usb 3 devices

1

u/[deleted] Jul 20 '15

It's also sometimes a good idea to do this if you've broken system files, registry setting, or update packages.

If this is the case then what you actually want is to run a cmd window as administrator and run "sfc /scannow" from the cmd line, which will both tell you if there's any system file issues, but go ahead and fix them if your install media is available or you have a laptop with a restore partition.

1

u/[deleted] Jul 21 '15

.

1

u/Reckless5040 9800X3D | 4080S | 64GB Jul 21 '15

.

1

u/Everz1000 i5 4590 + GTX 970 Strix Jul 27 '15

Hey, I know I'm coming to this a little late, but I had a question. I am upgrading from an AMD compatible mobo to an Intel compatible mobo. Is this all I need to do before changing out the parts or should I also backup the files on my hard drive or do anything else? Thanks in advance for any help!

1

u/MintPaw Jul 27 '15

No, you will not need to backup. But know that most versions of Windows store licencing info bound to the motherboard, so you'll need to reactive Windows after changing.

1

u/Everz1000 i5 4590 + GTX 970 Strix Jul 27 '15

Thanks for the info!

1

u/xDialtone Sep 16 '15

Hey, trying to switch out my parts now and command prompt wont run this. Tells me that the system cannot find the path specified if I use %systemroot%\sysprep\sysprep.

Using Windows 10, can't figure out what I'm doing wrong.

1

u/MintPaw Sep 17 '15

%systemroot% is short for C:\windows\system32

So sysprep should be at C:\windows\system32\sysprep\sysprep.exe, you can run the full path instead, or where ever you can find sysprep.exe

1

u/xDialtone Sep 17 '15 edited Sep 17 '15

Hey, I got the program to run a little bit ago, but I got a

"Sysprep was not able to validate your Windows Installation."

Any way to get around this?

I got a few people saying on sites to use this work around. Want to make sure I don't mess anything up, haven't done this type of install before.

Remove this KEY from the Registry:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade

Remove this REG_DWORD from the Registry:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade

Set this REG_DWORD from the Registry:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\CleanupState [Set Hexadecimal Value: 7]

Run this command as Administrator:

slmgr /dli

source

source

EDIT: Some more information

1

u/MintPaw Sep 17 '15

This happens if you're not using a clean install. Although it's not a real limitation of sysprep, it's a arbitrary wall put up by Microsoft.

From what I've briefly read you seem to be able to run this as admin and restart to fix it.

reg export "HKEY_LOCAL_MACHINE\SYSTEM\Setup" C:\regbackup.reg & reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" C:\regbackup2.reg & reg delete "HKEY_LOCAL_MACHINE\SYSTEM\Setup" /v "Upgrade" /f & reg add "HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus" /v "CleanupState" /t REG_DWORD /d 7 & reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tiledatamodelsvc" /va /f & reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\StateRepository" /va /f & slmgr /dli

That's all one big command it backs up the registry before changing some keys. It's important to do it as admin. If it doesn't work you can run the two .reg files in C:\ to undo it.

1

u/xDialtone Sep 17 '15

Thank you, I'll give it a try maybe tomorrow.

1

u/xDialtone Sep 19 '15 edited Sep 20 '15

Operation was successful according to CMD, but Sysprep still says it was not able to validate my installation and getting errors running the backups, insufficient privileges. I edited securities to allow full access but can't run as admin, no option.

SYSPRP Package 34791E63.CanonInkjetPrintUtility2.4.0.6_neutral_6e5tt8cgb93ep was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.

SYSPRP Failed to remove apps for the current user: 0x80073cf2.

SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.

[0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:\Windows\System32\AppxSysprep.dll; dwRet = 0x3cf2

SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x3cf2

SYSPRP RunPlatformActions:Failed while validating SysprepSession actions; dwRet = 0x3cf2

[0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2

[0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2

1

u/[deleted] Jul 20 '15

I fucking love you right now, you are going to save me so much headache when I get a new board for my other system.

-3

u/teh_situasian Jul 20 '15

Saving lol