joefitzgerald / packer-windows

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

Issue adding Windows Management update (Win2k8R2) #192

Closed geerzo closed 8 years ago

geerzo commented 8 years ago

I've gotten the base windows 2008 R2 build to work but now I'm trying to install an additional package and it just hangs. Here is my new script

if not exist "C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu" (
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/3/D/6/3D61D262-8549-4769-A660-230B67E15B25/Windows6.1-KB2819745-x64-MultiPkg.msu', 'C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu')" <NUL
)

wusa.exe C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu /quiet
powershell -Command "Start-Sleep 60" <NUL

I add this to the provisioner after vagrant-ssh.bat. In the logs I see that it runs and downloads the file but as soon as it tries to run the install it just hangs forever (I let it sit for 8 hours). Here are the logs

==> virtualbox-iso: Provisioning with shell script: ./scripts/vagrant-ssh.bat
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if exist a:\vagrant.pub (copy a:\vagrant.pub C:\Users\vagrant\.ssh\authorized_keys )  else (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant\.ssh\authorized_keys')"  0<NUL )
==> virtualbox-iso: Provisioning with shell script: ./scripts/winmgmt.bat
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if not exist "C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu" (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/3/D/6/3D61D262-8549-4769-A660-230B67E15B25/Windows6.1-KB2819745-x64-MultiPkg.msu', 'C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu')"  0<NUL )
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>wusa.exe C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu /quiet

I did my last run with headless=false so I could see what was going on. When it got to this stage I checked the temp folder and the file was there but when I checked the process list the update wasn't running. I also couldn't find any entries in the Event Viewer showing it ran and failed. This is the first time I've tried to add a new script so maybe I'm doing something wrong?

kensykora commented 8 years ago

Is it possible that this package does not support /quiet or non-interactive installation modes? Try running that same command on any other VM and see what happens.

geerzo commented 8 years ago

I should have specified that, that script works just fine if run natively on the box. For now I've moved that exact script to my Vagrant file so it happens later in the process.

StefanScherer commented 8 years ago

Hm, a Vagrant box is at least one "reboot" after the packer build. Perhaps a reboot in between the packer provision scripts? Just my two cents.

sneal commented 8 years ago

Closing. This isn't specifically a packer-windows issue.

You can try adding a log command: wusa.exe C:\Windows\Temp\Windows6.1-KB2819745-x64-MultiPkg.msu /quiet /log C:\Temp\KB2819745.htm.