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
|
|
|
{
|
2021-10-08 20:13:59 -04:00
|
|
|
LogMsg "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 }
|
2021-10-08 20:13:59 -04:00
|
|
|
Catch { LogMsg $_.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}" )
|
|
|
|
|
{
|
2021-10-08 20:13:59 -04:00
|
|
|
LogMsg "Deleting existing installer: ${DOWNLOADS}\${FILENAME}"
|
2020-09-09 16:59:40 -04:00
|
|
|
Try { Remove-Item "${DOWNLOADS}\${FILENAME}" -Force -ErrorAction SilentlyContinue }
|
2021-10-08 20:13:59 -04:00
|
|
|
Catch { LogMsg $_.Exception.Message }
|
2020-05-22 14:35:46 -04:00
|
|
|
}
|
2021-10-08 20:13:59 -04:00
|
|
|
LogMsg "Downloading ${URL} to ${DOWNLOADS}\${FILENAME}"
|
2020-09-09 16:59:40 -04:00
|
|
|
Try { (New-Object System.Net.WebClient).DownloadFile($URL,"${DOWNLOADS}\${FILENAME}") }
|
2021-10-08 20:13:59 -04:00
|
|
|
Catch { LogMsg $_.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
|
|
|
{
|
2021-10-08 20:13:59 -04:00
|
|
|
LogMsg "Launching installer: ${DOWNLOADS}\${FILENAME}"
|
2021-05-21 12:35:10 -04:00
|
|
|
Try { Start-Process -FilePath "${DOWNLOADS}\${FILENAME}" }
|
2021-10-08 20:13:59 -04:00
|
|
|
Catch { LogMsg $_.Exception.Message }
|
2020-05-22 14:35:46 -04:00
|
|
|
}
|
2021-10-08 20:13:59 -04:00
|
|
|
Else { LogMsg "${DOWNLOADS}\${FILENAME} does not exist" }
|
2019-11-11 19:22:39 -05:00
|
|
|
|
2020-09-09 16:59:40 -04:00
|
|
|
}
|
2021-10-08 20:13:59 -04:00
|
|
|
Else { LogMsg "This endpoint is already up to date." }
|
2019-11-11 19:22:39 -05:00
|
|
|
|
2020-09-09 16:59:40 -04:00
|
|
|
}
|
2021-10-08 20:13:59 -04:00
|
|
|
Else { LogMsg "This endpoint is not running Windows 10." }
|