Skip to content

Commit

Permalink
Keep showing output when Windows 7 SP1 and convenience rollup are ins…
Browse files Browse the repository at this point in the history
…talling

fixup
  • Loading branch information
qmfrederik committed Jul 2, 2020
1 parent 73acbeb commit a5a7c3d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion scripts/win-7-update-2016-convenience-rollup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ Write-Host "$(Get-Date -Format G): Extracting $update"
Start-Process -FilePath "wusa.exe" -ArgumentList "C:\Updates\$kbid.msu /extract:C:\Updates" -Wait

Write-Host "$(Get-Date -Format G): Installing $update"
Start-Process -FilePath "dism.exe" -ArgumentList "/online /add-package /PackagePath:C:\Updates\$kbid.cab /quiet /norestart /LogPath:C:\Windows\Temp\$kbid.log" -Wait
$process = (Start-Process -FilePath "dism.exe" -ArgumentList "/online /add-package /PackagePath:C:\Updates\$kbid.cab /quiet /norestart /LogPath:C:\Windows\Temp\$kbid.log" -PassThru)

# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait#comment71507068_23797762
$handle = $process.Handle # cache proc.Handle

while ($null -eq $process.ExitCode)
{
Write-Host "$(Get-Date -Format G): Convenience rollup update for Windows 7 is still installing (PID $($process.Id))"
Wait-Process -Id $process.Id -Timeout 180 -ErrorAction SilentlyContinue
$process.Refresh()
}

Write-Host "$(Get-Date -Format G): Convenience rollup update for Windows 7 exited with exit code $($process.ExitCode)"

Remove-Item -LiteralPath "C:\Updates" -Force -Recurse
Write-Host "$(Get-Date -Format G): Finished installing $update. The VM will now reboot and continue the installation process."
14 changes: 13 additions & 1 deletion scripts/win-7-update-sp1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ Write-Host "$(Get-Date -Format G): Downloading Windows 7 Service Pack 1"
(New-Object Net.WebClient).DownloadFile("https://download.microsoft.com/download/0/A/F/0AFB5316-3062-494A-AB78-7FB0D4461357/windows6.1-KB976932-X64.exe", "C:\Updates\windows6.1-KB976932-X64.exe")

Write-Host "$(Get-Date -Format G): Installing Windows 7 Service Pack 1"
Start-Process -FilePath "C:\Updates\Windows6.1-KB976932-X64.exe" -ArgumentList "/unattend /nodialog /norestart" -Wait
$process = (Start-Process -FilePath "C:\Updates\Windows6.1-KB976932-X64.exe" -ArgumentList "/unattend /nodialog /norestart" -PassThru)

# https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait#comment71507068_23797762
$handle = $process.Handle # cache proc.Handle

while ($null -eq $process.ExitCode)
{
Write-Host "$(Get-Date -Format G): Windows 7 Service Pack 1 is still installing (PID $($process.Id))"
Wait-Process -Id $process.Id -Timeout 180 -ErrorAction SilentlyContinue
$process.Refresh()
}

Write-Host "$(Get-Date -Format G): Windows 7 Service Pack 1 exited with exit code $($process.ExitCode)"

Remove-Item -LiteralPath "C:\Updates" -Force -Recurse

Expand Down

0 comments on commit a5a7c3d

Please sign in to comment.