Skip to content

Commit

Permalink
Merge pull request StefanScherer#256 from jeritiana/windows-7-sp1
Browse files Browse the repository at this point in the history
Check before installing Windows 7 SP1
  • Loading branch information
StefanScherer authored Apr 28, 2020
2 parents 761a468 + 4845bda commit 2aa6d28
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/win-7-update-sp1.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# First check if Service Pack 1 is installed.
$os = Get-WmiObject -class Win32_OperatingSystem
if ($os.ServicePackMajorVersion -ge 1) {
Write-Host "Windows 7 Service Pack 1 is already installed."
Exit
}

New-Item -Path "C:\" -Name "Updates" -ItemType Directory

# Service Pack 1 is an absolute requirement. Installing updates from Windows Update
Expand All @@ -14,4 +21,4 @@ Start-Process -FilePath "C:\Updates\Windows6.1-KB976932-X64.exe" -ArgumentList "
Remove-Item -LiteralPath "C:\Updates" -Force -Recurse

Write-Host "$(Get-Date -Format G): Finished installing Windows 7 Service Pack 1. The VM will now reboot and continue the installation process."
Write-Host "$(Get-Date -Format G): This may take a couple of minutes."
Write-Host "$(Get-Date -Format G): This may take a couple of minutes."

0 comments on commit 2aa6d28

Please sign in to comment.