Files

47 lines
2.1 KiB
PowerShell
Raw Permalink Normal View History

2019-11-11 19:22:39 -05:00
## Make sure the computer is running Windows 10
2020-09-09 16:59:40 -04:00
If ( IsWindowsVersion -ge "10.0" ) {
2019-11-11 19:22:39 -05:00
2021-06-10 12:37:53 -04:00
## Make sure the endpoint isn't already running the version we're installing
2022-03-08 12:32:14 -05:00
If ( IsWindowsBuild -lt 19043 ) {
2019-11-11 19:22:39 -05:00
## Set the directory where the Windows Update Assistant will be downloaded to
2020-09-09 16:59:40 -04:00
$DOWNLOADS = $Env:TEMP
2019-11-11 19:22:39 -05:00
2021-06-10 12:37:53 -04:00
## URL to the Windows Update Assistant
2022-09-01 16:03:47 -04:00
$URL = 'https://download.microsoft.com/download/4/1/0/410b6165-c770-4944-b074-ecbe9461034c/Windows10Upgrade9252.exe'
2019-11-11 19:22:39 -05:00
## Uninstall previous Windows 10 Update Assistant
If ( Test-Path "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" )
2020-05-22 14:35:46 -04:00
{
2023-10-05 13:11:38 -04:00
Write-Output "Uninstalling existing Windows 10 Update Assistant"
2020-09-09 16:59:40 -04:00
Try { Start-Process "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" -ArgumentList '/ForceUninstall' -Wait }
2023-10-05 13:11:38 -04:00
Catch { Write-Output $_.Exception.Message }
2020-05-22 14:35:46 -04:00
}
2019-11-11 19:22:39 -05:00
## Download Windows 10 Update Assistant
$FILENAME = Split-Path $URL -leaf
2020-05-22 14:35:46 -04:00
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
{
2023-10-05 13:11:38 -04:00
Write-Output "Deleting existing installer: ${DOWNLOADS}\${FILENAME}"
2020-09-09 16:59:40 -04:00
Try { Remove-Item "${DOWNLOADS}\${FILENAME}" -Force -ErrorAction SilentlyContinue }
2023-10-05 13:11:38 -04:00
Catch { Write-Output $_.Exception.Message }
2020-05-22 14:35:46 -04:00
}
2023-10-05 13:11:38 -04:00
Write-Output "Downloading ${URL} to ${DOWNLOADS}\${FILENAME}"
2020-09-09 16:59:40 -04:00
Try { (New-Object System.Net.WebClient).DownloadFile($URL,"${DOWNLOADS}\${FILENAME}") }
2023-10-05 13:11:38 -04:00
Catch { Write-Output $_.Exception.Message }
2019-11-11 19:22:39 -05:00
## Install and run the Windows 10 Update Assistant
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
2020-05-22 14:35:46 -04:00
{
2023-10-05 13:11:38 -04:00
Write-Output "Launching installer: ${DOWNLOADS}\${FILENAME}"
Try { Start-Process -FilePath "${DOWNLOADS}\${FILENAME}" }
2023-10-05 13:11:38 -04:00
Catch { Write-Output $_.Exception.Message }
2020-05-22 14:35:46 -04:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "${DOWNLOADS}\${FILENAME} does not exist" }
2019-11-11 19:22:39 -05:00
2020-09-09 16:59:40 -04:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "This endpoint is already up to date." }
2019-11-11 19:22:39 -05:00
2020-09-09 16:59:40 -04:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "This endpoint is not running Windows 10." }