Quickly Upgrade Windows 7 To Windows 10 For Free With This PowerShell Script

Quickly Upgrade Windows 7 To Windows 10 For Free With This PowerShell Script
Image: Getty Images

If you’re reading this, you probably know how to upgrade one version of Windows to another. Even though it’s an easy process, it’s still tedious and boring to watch Windows download and install, and then you have to spend more time moving through screens and tweaking settings. Meh.

If you, or someone you know, has been clinging to Windows 7 until the bitter end, you should know that your operating system won’t receive any more security updates past January 15. Now is as good a time as any to finally upgrade your system to Windows 10, especially since it might be free—and because I found a super-simple PowerShell script that makes it easy to perform an unattended upgrade.

In other words, you start the upgrade process, click a dialog box or two in the beginning, and you can then get up and go do something else while Windows 10 downloads and installs automatically. Your system will reboot when it needs to, and the next time you need to click the mouse, you’ll be a minute away from your brand-new OS. Upgrading doesn’t get much easier than this.

Getting started with PowerShell in Windows 7 SP1

Since we need PowerShell to do this quick little upgrade, and PowerShell comes baked into any version of Windows since Windows 7 SP1, make sure you’ve upgraded the operating system at least that far. In other words, just run Windows Update and install whatever it wants you to install (if anything).

Once you’re ready to begin, click on the Start button, type in Powershell, right-click on “Windows Powershell,” and select “Run as Administrator.”

As a security measure, PowerShell is set to not run scripts by default until you change a certain registry key. To do that, type this into Powershell and hit Enter when you’re done:

Set-ExecutionPolicy Unrestricted

You can close PowerShell now. Yes, that’s right.

Typing up your installation script

On your desktop, open up a new text file and copy and paste the following (courtesy of the incredibly helpful /r/PowerShell subreddit):

$dir = “c:\temp”mkdir $dir$webClient = New-Object System.Net.WebClient$url = “https://go.microsoft.com/fwlink/?LinkID=799445"$file = “$($dir)\Win10Upgrade.exe”$webClient.DownloadFile($url,$file)Start-Process -FilePath $file -ArgumentList “/quietinstall /skipeula /auto upgrade /copylogs $dir” -verb runas

Feel free to delete the extra blank spaces between the lines, too. Once you’ve done this, close Notepad and save your file with whatever name you want, but change its extension to .PS1 (from .TXT).

Starting your unattended upgrade

Right-click on your new .PS1 file and select “Run with PowerShell.” You’ll probably have to confirm at least one prompt, allowing “Microsoft Windows” to make changes to your computer, but that’s it. A PowerShell window will briefly appear and disappear, and then you won’t see anything else for some time.

Screenshot: David Murphy

If you’re paranoid, like me, you can check that the installation is running by pulling up Task Manager and making sure that the “Windows10UpgraderApp.exe” application is running. (You should see it early on in the process.) Otherwise, go do something else. Your system will automatically restart when it needs to, and the Windows 10 installation will fire off without any additional input from you.

You’ll know it’s done when your computer asks you to do something, which should look like this:

Screenshot: David Murphy

You’re basically just a screen or two away from completion, which should take you all of 15 seconds to check out. Once you hop into Windows 10, you’ll hopefully notice two things: One, all of your data and apps should be where they were originally (since we upgraded from Windows 7, rather than performing a clean install). There’s no guarantee that everything is there—certain programs may have been incompatible and couldn’t be brought along for the ride—but that’s an issue I’ll address in a later article.

The upgrade aspect is critical, though, as you should also have a fully activated version of Windows 10, assuming you came from an activated version of Windows 7. If not, entering your Windows 7 key should be all you need to activate Windows 10, and logging in with your Microsoft account should make the activation process even easier for any subsequent installations.

Don’t forget to reset PowerShell’s execution policy

Remember when we unshackled PowerShell and allowed it to run any scripts it wanted? Well, now’s a great time to reverse that, for security’s sake. Open up PowerShell with administrative privileges (same as before), and enter this:

Set-ExecutionPolicy Restricted

Screenshot: David Murphy

Once you’ve done that, you can close PowerShell and start tricking out Windows 10 to your liking. You probably won’t need to run Windows Update right away, however, as you should already have the most up-to-date version of the OS that Microsoft has available.

Comments

  • Another method is using a bootable windows 10 USB or disc (which can be downloaded from MS) and using your old Windows 7 Home licence key. It’s a legit key and will work for upgrades. I did it just the other day for my parents aging PC. The licence key is often printed on the side of the machine, but can always be extracted using something like Belarc Advisor.

  • Remember folks, if you are running a business and Microsoft comes and software audits you (as they are increasingly now doing to ensure compliance). If you can not prove that you legitimately upgraded from Windows 7 to 10 you can expect that you upgrades will be far from free.

  • Excellent article, thank you, David! Do you know if this PowerShell method allows the selection of Windows Edition? I have Windows 7 Ultimate SP1 as a virtual machine in VirtualBox, so I would want to upgrade to Windows 10 Pro. Thanks for any advice you might be able to provide.

Log in to comment on this story!