Mass upgrading Windows 10 Using PowerShell

Someone asked med a while back

– Is it possible to upgrade our Windows 7,8,8.1 and unsupported Windows 10 machines to a supported version of Windows 10 without a deployment solution?

….(thinking)

– You mean without running around to all machines?

….(Thinking)

– Yes, it is possible

Before explaining how that can be done, let’s be clear, if you have ConfigMgr or Microsoft Deployment Toolkit, that is far better then doing it this way, but you could be in a situation when that is not an option but you still need to achieve the same goal, upgrade to a supported version of Windows 10. (I’ll write another post on how to combine the scripts here with MDT)

Overview:

Assuming you have a licensed version of Windows 10, the Windows 10 Media, a network and access to all the computers over the network it will be possible to push out an upgrade. This method also works if you are running an older version of Windows 10 and would like to upgrade to a never version of Windows 10. The way to do this is rather easy, we basically need to perform the following steps:

– Enable remote access for PowerShell

– Copy the media down to the computer

– Run a compatibility scan to verify that we can upgrade

– Upgrade

Create a CSV file for computers that should be upgraded:

First of all we need to create a .CSV file with the computers that should be upgraded, the file contains the 3 servers I would like to upgrade to Windows 10.

image
Content of computers.txt

Store the file in your computer, in my case I stored it in D:\Upgrade2w10\Computers.txt

Enable remote access for PowerShell:

We need to access the computers using Remote PowerShell and therefor we need to enable that. This can be done using various method and one easy/weird/fun way to to that is to use WMI. The script below will connect using WMI and execute two commands on each server:

The following PowerShell script enables WinRM (Remote Access) and Remote PowerShell.

image
Content of Invoke-ComputerPrep.ps1

The result after running the script is this:

image

Copy the media down to the computer:

Now when we have access to all the machine, we can copy the media down to each machine and we will do that in a reversed way. We will create a scheduled task on each Windows 7 machine and the scheduled task will then download the content to the local hard drive. You need to edit the settings in this file to match your environment.

image
Content of Invoke-ImageDownload.ps1

Here is how it looks when you run the script:

image

Run a compatibility scan to verify that we can upgrade:

Ok, so we have the Windows 10 image in the C:\Source folder of each computer, now lets run the Compat Scan.

The script will connect to each computer, create a plain vanilla .BAT file and then we will remotely execute that:

image

And here is the result, as you can see all, none of the machines had any issues.

image

Upgrade:

Ok, so the final step. The only thing we need to do is fire up the install program, and for that we use PsExec, it’s old but works for this kind of work.

The script will connect to each machine, create a .BAT file and then we let PSExec execute it.

image
Content of Invoke-ComputerUpgrade.ps1

Here is the result of running that, as you can see all (you can only see Win-01) of the machines is returning a success (return code 0)

image

Ok, so, what next, well, since the return code was 0, lets restart them…

image

The scripts can be downloaded here: https://github.com/DeploymentBunny/Files/tree/master/Tools/MassUpgradeWindows10

/mike


Tags
OS Deployment
OSD
Windows 10
Infrastructure
PowerShell
Windows Client
Deployment
Latest posts
  • Test-NetConnection is annoying, gives me warnings, I don’t want that - PowerShell is King 2017-12-07
  • Mass upgrading Windows 10 Using PowerShell 2017-12-05
  • The October 2017 Update – “Inaccessible Boot Device” 2017-10-11
  • OSD – Adding Description to the WIM file during Build and Capture 2017-10-10
  • How Windows 10 Deployment impact your environment 2017-09-25
  • Event – TrueSec Infrastructure Summit 21 of June 2017-05-24
  • Inspelning direkt från MMS 2017, Minnesota 2017-05-19
  • Sommartips till IT-avdelningen från Mikael Nyström | TrueSec 2017-05-19
  • Workaround for ADK issue in 1703 - OSD 2017-05-16
  • A data deduplication script that runs the optimization, garbage collection and scrubbing 2017-04-28
Twitter