2019-11-11 19:22:39 -05:00
|
|
|
## Make sure the computer is running Windows 10
|
|
|
|
|
If ( ([System.Environment]::OSVersion.Version).Major -ge 10 ) {
|
|
|
|
|
|
2020-05-22 14:35:46 -04:00
|
|
|
## Make sure the endpoint isn't already running 1909
|
|
|
|
|
If ( ([System.Environment]::OSVersion.Version).Build -lt 18363 ) {
|
2019-11-11 19:22:39 -05:00
|
|
|
|
|
|
|
|
## Set the directory where the Windows Update Assistant will be downloaded to
|
|
|
|
|
$DOWNLOADS = "${Env:TEMP}"
|
|
|
|
|
|
2020-05-22 14:35:46 -04:00
|
|
|
## URL to the 1909 version of the Windows Update Assistant
|
|
|
|
|
$URL = 'https://download.microsoft.com/download/9/b/f/9bf08afb-bfd8-488a-9ce6-90134cea4d8f/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
|
|
|
{
|
|
|
|
|
Write-Output "Uninstalling existing Windows 10 Update Assistant"
|
|
|
|
|
Start-Process "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" -ArgumentList '/ForceUninstall' -Wait
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
## Create download directory if not using $Env:TEMP
|
|
|
|
|
#If (!( Test-Path $DOWNLOADS ))
|
|
|
|
|
#{
|
|
|
|
|
# Write-Output "Creating "${DOWNLOADS}"
|
|
|
|
|
# New-Item -ItemType Directory -Path $DOWNLOADS
|
|
|
|
|
#}
|
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}" )
|
|
|
|
|
{
|
|
|
|
|
Write-Output "Deleting existing installer: ${DOWNLOADS}\${FILENAME}"
|
|
|
|
|
Remove-Item "${DOWNLOADS}\${FILENAME}" -Force -ErrorAction SilentlyContinue
|
|
|
|
|
}
|
|
|
|
|
Write-Output "Downloading ${URL} to ${DOWNLOADS}\${FILENAME}"
|
|
|
|
|
(New-Object System.Net.WebClient).DownloadFile($URL,"${DOWNLOADS}\${FILENAME}")
|
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
|
|
|
{
|
|
|
|
|
Write-Output "Launching installer: ${DOWNLOADS}\${FILENAME}"
|
|
|
|
|
Start-Process -FilePath "${DOWNLOADS}\${FILENAME}" -Wait
|
|
|
|
|
}
|
2019-11-11 19:22:39 -05:00
|
|
|
|
|
|
|
|
## Delete the downloaded program
|
|
|
|
|
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
|
2020-05-22 14:35:46 -04:00
|
|
|
{
|
|
|
|
|
Write-Output "Deleting installer: ${DOWNLOADS}\${FILENAME}"
|
|
|
|
|
Remove-Item "${DOWNLOADS}\${FILENAME}"
|
|
|
|
|
}
|
2019-11-11 19:22:39 -05:00
|
|
|
|
2020-05-22 14:35:46 -04:00
|
|
|
} Else { Write-Host "This endpoint is already up to date." }
|
2019-11-11 19:22:39 -05:00
|
|
|
|
|
|
|
|
} Else { Write-Host "This endpoint is not running Windows 10." }
|