log messages to log file instead of output stream
This commit is contained in:
@@ -13,34 +13,34 @@ If ( IsWindowsVersion -ge "10.0" ) {
|
|||||||
## Uninstall previous Windows 10 Update Assistant
|
## Uninstall previous Windows 10 Update Assistant
|
||||||
If ( Test-Path "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" )
|
If ( Test-Path "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" )
|
||||||
{
|
{
|
||||||
Write-Output "Uninstalling existing Windows 10 Update Assistant"
|
LogMsg "Uninstalling existing Windows 10 Update Assistant"
|
||||||
Try { Start-Process "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" -ArgumentList '/ForceUninstall' -Wait }
|
Try { Start-Process "${Env:SystemDrive}\Windows10Upgrade\Windows10UpgraderApp.exe" -ArgumentList '/ForceUninstall' -Wait }
|
||||||
Catch { Write-Output $_.Exception.Message }
|
Catch { LogMsg $_.Exception.Message }
|
||||||
}
|
}
|
||||||
|
|
||||||
## Download Windows 10 Update Assistant
|
## Download Windows 10 Update Assistant
|
||||||
$FILENAME = Split-Path $URL -leaf
|
$FILENAME = Split-Path $URL -leaf
|
||||||
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
|
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
|
||||||
{
|
{
|
||||||
Write-Output "Deleting existing installer: ${DOWNLOADS}\${FILENAME}"
|
LogMsg "Deleting existing installer: ${DOWNLOADS}\${FILENAME}"
|
||||||
Try { Remove-Item "${DOWNLOADS}\${FILENAME}" -Force -ErrorAction SilentlyContinue }
|
Try { Remove-Item "${DOWNLOADS}\${FILENAME}" -Force -ErrorAction SilentlyContinue }
|
||||||
Catch { Write-Output $_.Exception.Message }
|
Catch { LogMsg $_.Exception.Message }
|
||||||
}
|
}
|
||||||
Write-Output "Downloading ${URL} to ${DOWNLOADS}\${FILENAME}"
|
LogMsg "Downloading ${URL} to ${DOWNLOADS}\${FILENAME}"
|
||||||
Try { (New-Object System.Net.WebClient).DownloadFile($URL,"${DOWNLOADS}\${FILENAME}") }
|
Try { (New-Object System.Net.WebClient).DownloadFile($URL,"${DOWNLOADS}\${FILENAME}") }
|
||||||
Catch { Write-Output $_.Exception.Message }
|
Catch { LogMsg $_.Exception.Message }
|
||||||
|
|
||||||
## Install and run the Windows 10 Update Assistant
|
## Install and run the Windows 10 Update Assistant
|
||||||
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
|
If ( Test-Path "${DOWNLOADS}\${FILENAME}" )
|
||||||
{
|
{
|
||||||
Write-Output "Launching installer: ${DOWNLOADS}\${FILENAME}"
|
LogMsg "Launching installer: ${DOWNLOADS}\${FILENAME}"
|
||||||
Try { Start-Process -FilePath "${DOWNLOADS}\${FILENAME}" }
|
Try { Start-Process -FilePath "${DOWNLOADS}\${FILENAME}" }
|
||||||
Catch { Write-Output $_.Exception.Message }
|
Catch { LogMsg $_.Exception.Message }
|
||||||
}
|
}
|
||||||
Else { Write-Output "${DOWNLOADS}\${FILENAME} does not exist" }
|
Else { LogMsg "${DOWNLOADS}\${FILENAME} does not exist" }
|
||||||
|
|
||||||
}
|
}
|
||||||
Else { Write-Output "This endpoint is already up to date." }
|
Else { LogMsg "This endpoint is already up to date." }
|
||||||
|
|
||||||
}
|
}
|
||||||
Else { Write-Output "This endpoint is not running Windows 10." }
|
Else { LogMsg "This endpoint is not running Windows 10." }
|
||||||
|
|||||||
Reference in New Issue
Block a user