Skip to content

Instantly share code, notes, and snippets.

@LoganDark
Created May 31, 2022 11:18
Show Gist options
  • Save LoganDark/9c6fbbac9d9dcf17ca38363ec2d328ff to your computer and use it in GitHub Desktop.
Save LoganDark/9c6fbbac9d9dcf17ca38363ec2d328ff to your computer and use it in GitHub Desktop.
Perform an in-place upgrade

Why not reinstall?

You may have seen that the premier advice online whenever literally anything goes wrong is to reinstall Windows. No, don't reset or refresh - wipe your hard drive and reinstall the entire OS. Windows can't be trusted to unbreak invariants.

What are invariants?

For non-technical users, "invariants" are rules that must apply in order for an operating system to work correctly. This includes things like file & folder permissions being correct. These invariants are sometimes broken which result in one or more parts of your working system becoming nonworking.

Windows is famously bad at repairing broken invariants, which is why the advice is typically that you need to reinstall the entire thing - to get a fresh new system with all the invariants upheld.

This is also the reason why rebooting tends to solve a lot of weird problems - Windows has invariants in RAM, too, and those can get corrupted. Rebooting recreates all those invariants from scratch, starting them out as valid. Since Windows is famously bad at repairing broken invariants, these issues never get resolved without a reboot.

This is also why you should always disable Fast Startup, because that setting preserves broken invariants rather than fixing them.

However, reinstalling Windows is a huge commitment for all but the most trivial of environments. You may have programs installed. You may have web browser cookies keeping you logged into your online accounts. You may have hard-to-find drivers, you may have WSL installed, you may have compilers and development infrastructure. You don't want to lose all that from a reinstall! You depend on your software!

Plus, not all issues are reinstall-worthy in the first place! For example, maybe you messed up the permissions on some system folder and all the files are still there, but UWP apps no longer launch. Maybe you're trying to install .NET Framework and you're getting some stupid error message, but the rest of your computer still works fine.

These are small things that don't require an entire reinstall because your system is not wholly broken. Instead, perform an in-place upgrade.

What is an in-place upgrade?

An in-place upgrade is the holy grail that restores the invariants of a working system, without wiping all your data. It:

  • Repairs file and folder permissions
  • Resets the state of critical Windows components
  • Reinstalls things like the bootloader, kernel, etc.

while keeping all your programs, drivers, apps, and settings, including registry hacks, WSL distributions, compiler toolchains and so on. Any extensive customizations you've done to your system are retained - it's just the core of the OS that is reinstalled in-place. That makes this incredibly convenient as long as you have about 4 hours to spare.

Warning: an in-place upgrade does restore Windows Update. If this is undesirable, you can use a tool like WUB to re-disable it after the upgrade. If you want to go this route, disconnect your internet before the upgrade and don't reconnect until Windows Update is fully disabled.

Before I get into anything, how do I back up my system?

See my backup guide for a comprehensive step-by-step tutorial on how to back up your drive. Note: you will need some intermediate knowledge of Linux. The backup is a compressed snapshot of your entire disk, including bootloader, all partitions, etc. but is mostly optional in this case, as running an offline upgrade does not have the same risk as activating live Windows Update.

OK, how do I perform an in-place upgrade?

Please note - you will be downgraded to the original build of your edition. For me I was on 19041.928 but "upgrading" to the same version (2004) left me on 19041.572. This usually has no functional changes. If it is a hurt to your pride then you can use the Microsoft update site to manually install updates to get back up to your chosen build.

Here are the steps - preserving user choice as much as possible - rejecting Microsoft's forced updates:

  • Download the MediaCreationTool.bat
    • Disclaimer: Running random Batch files from the Internet is a bad idea. I have audited this file myself and you have my guarantee (as a random internet stranger) that it does not contain any malicious code. Additionally, the user who uploaded it is fairly popular and there have been no controversies over the quality of their code.
  • Double-click it; it will open a window allowing you to select a Windows version
  • For me, I was running 2004, which is 20H1 in the tool, so I selected 20H1
  • When it asks you between a bunch of "auto" options, click "Select", which will simply open the media creation wizard
  • Use the media creation wizard as normal, i.e. install to a spare USB drive. Make sure to not let it install extra updates for you.
  • Make sure you have WUB on your machine...
  • Disconnect your internet and then run setup.exe from the USB drive you just created.
  • Let it go for about an hour. Wait till it's done.
  • Windows Update is back, so before reconnecting your internet, run WUB to kill Windows Update again.
  • Reconnect your internet, and you're back in business.

Feel free to omit the WUB/internet access steps if you want Windows Update to stay enabled for whatever reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment