Windows 11 Installer
Summary
Install Windows 11 on a compatible Windows 10 computer. The default behavior of the script is to restart the computer to complete the upgrade. However, the NoReboot
parameter provides an option to suppress the reboot. It is recommended that the computer be rebooted at the earliest convenience to complete the upgrade.
The OS drive should have 20 GB of free space to install the upgrade.
This task can be executed manually against the computers present in the Windows 11 Compatible Machines group.
Sample Run
Dependencies
- CW RMM - Custom Field - Windows 11 Upgrade RunTime
- CW RMM - Device Group - Windows 11 Compatible Machines
Variables
Name | Description |
---|---|
Output | Output of the previously executed PowerShell script. |
User Parameters
Name | Type | Required | Description | Default Value |
---|---|---|---|---|
NoReboot | Flag | No | Provides an option to suppress the reboot while running the script. | False |
Task Creation
Create a new Script Editor
style script in the system to implement this task.
Name: Windows 11 Installer
Description: Install Windows 11 on a compatible Windows 10 computer.
Category: Patching
Parameters
Add a new parameter by clicking the Add Parameter
button present at the top-right corner of the screen.
This screen will appear.
- Set
NoReboot
in theParameter Name
field. - Select
Flag
from theParameter Type
dropdown menu. - Enable the
Default Value
option. - Select
False
from theValue
dropdown menu. - Click the
Save
button.
- It will ask for confirmation to proceed. Click the
Confirm
button to create the parameter.
Task
Navigate to the Script Editor Section and start by adding a row. You can do this by clicking the Add Row
button at the bottom of the script page.
A blank function will appear.
Row 1 Function: PowerShell Script
Search and select the PowerShell Script
function.
The following function will pop up on the screen:
Paste in the following PowerShell script and leave the expected time of script execution set to 7200
seconds. Click the Save
button.
[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072)
if ( ( Get-Volume -DriveLetter $env:SystemDrive[0] ).SizeRemaining -le 20GB ) {
throw @"
The Drive Space health check failed. The drive must have 20GB of free space to perform a Feature Update.
Current available space on $($env:SystemDrive[0]): $([math]::round($systemVolume.SizeRemaining / 1GB, 2))
For more information: https://learn.microsoft.com/en-us/troubleshoot/windows-client/deployment/windows-10-upgrade-quick-fixes?toc=%2Fwindows%2Fdeployment%2Ftoc.json&bc=%2Fwindows%2Fdeployment%2Fbreadcrumb%2Ftoc.json#verify-disk-space
"@
}
$free = (Get-Partition | Where-Object { $_.IsSystem } | Get-Volume).SizeRemaining / 1MB
if ($free -gt 15) {
Write-Information 'Sufficient Space Available' -InformationAction Continue
}
$diskNumber = (Get-Partition | Where-Object { $_.IsSystem }).DiskNumber
$style = (Get-Disk | Where-Object { $_.Number -eq $diskNumber }).PartitionStyle
if ($style -eq 'MBR') {
throw @'
15MB of free space on the System Reserved Partition (SRP) is needed for upgrading a Windows 10 to 11.
Autofix is not recommended for MBR disks.
Please follow the instructions provided for 'Windows 10 with GPT partition' in the this article:
https://support.microsoft.com/en-us/topic/-we-couldn-t-update-system-reserved-partition-error-installing-windows-10-46865f3f-37bb-4c51-c69f-07271b6672ac
'@
}
Write-Information 'Clearing unneeded space on the System Reserved Partition' -InformationAction Continue
cmd.exe /c mountvol y: /s
Get-ChildItem -Path 'Y:\EFI\Microsoft\Boot\Fonts' -Force -Recurse | Remove-Item -Force -Recurse
cmd.exe /c mountvol y: /D
$free = (Get-Partition | Where-Object { $_.IsSystem } | Get-Volume).SizeRemaining / 1MB
if ($free -gt 15) {
Write-Information 'Freed Sufficient Space' -InformationAction Continue
} else {
throw @'
Failed to free up enough space on the System Reserved Partition (SRP).
15MB of free space on the System Reserved Partition (SRP) is needed for upgrading a Windows 10 to 11.
Please follow the instructions provided in the this article:
https://support.microsoft.com/en-us/topic/-we-couldn-t-update-system-reserved-partition-error-installing-windows-10-46865f3f-37bb-4c51-c69f-07271b6672ac
'@
}
$appName = 'windows-upgrader'
$workingDirectory = "C:\ProgramData\_Automation\App\$appName"
$filePath = "$workingDirectory\$appName.exe"
$url = 'https://file.provaltech.com/repo/app/windows-upgrader.exe'
Remove-Item -Path $workingDirectory -Force -ErrorAction SilentlyContinue
New-Item -Path $workingDirectory -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null
try {
Invoke-WebRequest -Uri $url -OutFile $filePath -UseBasicParsing -ErrorAction Stop
Unblock-File -Path $filePath -ErrorAction SilentlyContinue
} catch {
throw "Failed to download the installer. Reason: $($Error[0].exception.Message)"
}
if ( '@NoReboot@' -match '1|Yes|True' ) {
& $filepath --noreboot
} else {
& $filepath
}
Row 2 Function: Script Log
Add a new row by clicking the Add Row
button.
A blank function will appear.
Search and select the Script Log
function.
The following function will pop up on the screen:
In the script log message, simply type %output%
and click the Save
button
Click the Save
button at the top right corner of the screen to save the task.
Click the Save
button at the top right corner of the screen to save the task.
Completed Task
Deployment
It is suggested to run this task manually for the time being.
Output
- Script Log
- Custom Field