joefitzgerald / packer-windows

Windows Packer Templates
MIT License
1.63k stars 1.12k forks source link

Added a script for downloading and installing KB3102810 for Windows 7… #194

Closed ferhaty closed 8 years ago

ferhaty commented 8 years ago

… 64-bit. Installing and searching for updates is slow and high CPU usage occurs in Windows 7 SP1 (https://support.microsoft.com/en-us/kb/3102810).

StefanScherer commented 8 years ago

@ferhaty Cool, sounds interesting. Do you have a comparison installing all updates without and with this KB? Where should this KB script be added? Can you provide an updated Autounattend.xml?

ferhaty commented 8 years ago

@StefanScherer Sure. The updates on Windows 7 Enterprise SP1(64-Bit) are not installed by default without installing the hotfix. So I've added the hotfix batch file such that the updates are installed after the hotfix has been applied. The script should be applied before installing the Windows Updates. For example:


                <SynchronousCommand wcm:action="add">
                    <CommandLine>cmd.exe /c a:\hotfix-KB3102810.bat</CommandLine>
                    <Order>97</Order>
                    <Description>Install Windows Update Hotfix (KB3102810)</Description>
                </SynchronousCommand>

                <SynchronousCommand wcm:action="add">
                    <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine>
                    <Description>Install OpenSSH</Description>
                    <Order>99</Order>
                    <RequiresUserInput>true</RequiresUserInput>
                </SynchronousCommand>

                <!-- END WITHOUT WINDOWS UPDATES -->
                <!-- WITH WINDOWS UPDATES -->
                <!-- Disable automatic updates so the system update process doesn't interfere with the update script -->
                <SynchronousCommand wcm:action="add">
                    <CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine>
                    <Order>98</Order>
                    <Description>Enable Microsoft Updates</Description>
                </SynchronousCommand>

                <SynchronousCommand wcm:action="add">
                    <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1 -MaxUpdatesPerCycle 30</CommandLine>
                    <Description>Install Windows Updates</Description>
                    <Order>100</Order>
                    <RequiresUserInput>true</RequiresUserInput>
                </SynchronousCommand>

Error without the hotfix:

error installing updates before

After the hotfix:

schermafbeelding 2016-01-19 om 09 24 51

I've attached an example Autounattend xml. Autounattend.xml.zip

StefanScherer commented 8 years ago

@ferhaty Great! Can I persuade you to add the updated Autounattend.xml to your PR?

ferhaty commented 8 years ago

@StefanScherer Sure I'll test the changes thoroughly and add it to the PR.

bmolz commented 8 years ago

I think changing the Windows Update settings to something other than 'Install Updates Automatically (Default)' also fixes these errors:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 1 /f
ferhaty commented 8 years ago

@StefanScherer added the changes to the PR

ferhaty commented 8 years ago

@StefanScherer my bad reverted the changes and added the installation of KB3102810 to the WITH WINDOWS UPDATES section. The hotfix should indeed be installed before searching for Windows Updates using microsoft-updates.bat. The search for Windows Updates takes too long and causes a timeout without the hotfix.

StefanScherer commented 8 years ago

@ferhaty Thanks! I'll give it a shot in the next few days.

sneal commented 8 years ago

WOMM :shipit:

StefanScherer commented 8 years ago

Thanks for the major cleaning task. I hadn't the time for tests.