Giter Club home page Giter Club logo

stefanscherer / packer-windows Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joefitzgerald/packer-windows

1.3K 47.0 425.0 1.64 MB

Windows Templates for Packer: Windows 11, Windows 10, Windows Server 2022, 2019, 2016, also with Docker

License: MIT License

Shell 4.92% PowerShell 51.12% Ruby 20.52% Batchfile 19.42% HCL 3.54% Dockerfile 0.47%
packer windows-containers vagrant vmware hyper-v virtualbox windowscontainers windows windows-10 windows-2016 windows-2019 windows-insiders windowsinsiders windows-2022 windows-11

packer-windows's Introduction

Windows Templates for Packer

Build status

Introduction

This repository contains Windows templates that can be used to create boxes for Vagrant using Packer (Website) (Github).

This repo is a modified fork of the popular joefitzgerald/packer-windows repo.

Some of my enhancements are:

  • Support of fullscreen Retina display on a MacBook Pro.
  • WinRM, no more OpenSSH

Packer Version

Packer 1.6.0 is recommended.

Windows Versions

The following Windows versions are known to work (built with VMware Fusion Pro 11.0.2):

You may find other packer template files, but older versions of Windows doesn't work so nice with a Retina display.

Windows Editions

All Windows Server versions are defaulted to the Server Datacenter edition. You can modify this by editing the Autounattend.xml file, changing the ImageInstall>OSImage>InstallFrom>MetaData>Value element (e.g. to Windows Server 2019 SERVERSTANDARDCORE).

To retrieve the correct image name from an ISO file use the following two commands.

PS C:\> Mount-DiskImage -ImagePath C:\iso\17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso
PS C:\> Get-WindowsImage -ImagePath e:\sources\install.wim

ImageIndex       : 1
ImageName        : Windows Server 2019 Standard
ImageDescription : (Recommended) This option omits most of the Windows graphical environment. Manage with a command
                   prompt and PowerShell, or remotely with Windows Admin Center or other tools.
ImageSize        : 8,388,579,855 bytes

ImageIndex       : 2
ImageName        : Windows Server 2019 Standard (Desktop Experience)
ImageDescription : This option installs the full Windows graphical environment, consuming extra drive space. It can be
                   useful if you want to use the Windows desktop or have an app that requires it.
ImageSize        : 14,668,863,719 bytes

ImageIndex       : 3
ImageName        : Windows Server 2019 Datacenter
ImageDescription : (Recommended) This option omits most of the Windows graphical environment. Manage with a command
                   prompt and PowerShell, or remotely with Windows Admin Center or other tools.
ImageSize        : 8,378,362,786 bytes

ImageIndex       : 4
ImageName        : Windows Server 2019 Datacenter (Desktop Experience)
ImageDescription : This option installs the full Windows graphical environment, consuming extra drive space. It can be
                   useful if you want to use the Windows desktop or have an app that requires it.
ImageSize        : 14,673,479,669 bytes

If you are not sure about the exact image name, you can use the index instead. Change the Key element to /IMAGE/INDEX and put the index number in the Value element.

Product Keys

The Autounattend.xml files are configured to work correctly with trial ISOs (which will be downloaded and cached for you the first time you perform a packer build). If you would like to use retail or volume license ISOs, you need to update the UserData>ProductKey element as follows:

  • Uncomment the <Key>...</Key> element
  • Insert your product key into the Key element

If you are going to configure your VM as a KMS client, you can use the product keys at http://technet.microsoft.com/en-us/library/jj612867.aspx. These are the default values used in the Key element.

Using existing ISOs

If you have already downloaded the ISOs or would like to override them, set these additional variables:

  • iso_url - path to existing ISO
  • iso_checksum - md5sum of existing ISO (if different)
packer build -var 'iso_url=./server2016.iso' .\windows_2016.json

Windows Updates

The scripts in this repo will install all Windows updates โ€“ by default โ€“ during Windows Setup. This is a very time consuming process, depending on the age of the OS and the quantity of updates released since the last service pack. You might want to do yourself a favor during development and disable this functionality, by commenting out the WITH WINDOWS UPDATES section and uncommenting the WITHOUT WINDOWS UPDATES section in Autounattend.xml:

<!-- WITHOUT WINDOWS UPDATES -->
<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 -->
<!--
<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:\openssh.ps1</CommandLine>
    <Description>Install OpenSSH</Description>
    <Order>99</Order>
    <RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
    <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine>
    <Description>Install Windows Updates</Description>
    <Order>100</Order>
    <RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
-->
<!-- END WITH WINDOWS UPDATES -->

Doing so will give you hours back in your day, which is a good thing.

Windows 7 support

Windows 7 is going out of support in January 2020, and the scripts for building Windows 7 machines are only sporadically maintained.

Windows 7 was first released in 2009. This means there are a lot of updates available for Windows 7, and running Windows Updates on a Windows 7 box using the mechanism described above takes an extremely long time.

The Windows 7 templates therefore take a slightly different approach, first installing Service Pack 1, updating the servicing stack and then installing the latest update rollup, .NET 4.8 and PowerShell 5.1. Finally, any missing updates are installed using Ansible.

This means you'll need to install Ansible on your machine if you want to run the Windows 7 scripts. You can install ansible on a Linux machine.

If you want to run these scripts on a Windows machine, you can try to run Ansible in cygwin or Bash on Ubuntu on Windows. Alternatively, you can disable the ansible steps in the windows_7.json file. Make sure to manually run Windows Update if you do!

WinRM

These boxes use WinRM. There is no OpenSSH installed.

Hyper-V Support

If you are running Windows 10, Windows Server 2016 or later, then you can also use these packerfiles to build a Hyper-V virtual machine. I have the ISO already downloaded to save time, and only have Hyper-V installed on my laptop, so I run:

packer build --only hyperv-iso -var 'hyperv_switchname=Ethernet' -var 'iso_url=./server2016.iso' .\windows_2016_docker.json

Where Ethernet is the name of my default Hyper-V Virtual Switch. You then can use this box with Vagrant to spin up a Hyper-V VM.

Generation 2 VMs

Some of these images use Hyper-V "Generation 2" VMs to enable the latest features and faster booting. However, an extra manual step is needed to put the needed files into ISOs because Gen2 VMs don't support virtual floppy disks.

  • windows_server_insider.json
  • windows_server_insider_docker.json
  • windows_10_insider.json

Before running packer build, be sure to run ./make_unattend_iso.ps1 first. Otherwise the build will fail on a missing ISO file

hyperv-iso output will be in this color.

1 error(s) occurred:

* Secondary Dvd image does not exist: CreateFile ./iso/windows_server_insider_unattend.iso: The system cannot find the file specified.

KVM/qemu support

If you are using Linux and have KVM/qemu configured, you can use these packerfiles to build a KVM virtual machine. To build a KVM/qemu box, first make sure:

  • You are a member of the kvm group on your machine. You can list the groups you are member of by running groups. It should include the kvm group. If you're not a member, run sudo usermod -aG kvm $(whoami) to add yourself.
  • You have downloaded the iso image with the Windows drivers for paravirtualized KVM/qemu hardware. You can do this from the command line: wget -nv -nc https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso -O virtio-win.iso.

You can use the following sample command to build a KVM/qemu box:

packer build --only=qemu --var virtio_win_iso=./virtio-win.iso ./windows_2019_docker.json

Parallels support

In case you're using Parallels, you can now build the Windows Server 2019 with Docker VM.

Prerequisites:

You can use the following sample command to build a Parallels VM:

packer build --only=parallels-iso windows_2019_docker.json

The Parallels builder config turns efi boot off in order to use the same answer file like all the other builders. If you find you need to turn efi boot on then make sure to adjust the appropriate answer file, especially the section regarding the partitioning of the disk. If you need to further customize the VM, consult the documentation at https://www.packer.io/docs/builders/parallels-iso.html.

VirtualBox support

When using VirtualBox, you can use the following sample command to build a corresponding VM image:

packer build --only=virtualbox-iso windows_2022_docker.json

After building, you can expect a box package like windows_2022_docker_virtualbox.box in the working directory.

Using .box Files With Vagrant

The generated box files include a Vagrantfile template that is suitable for use with Vagrant 1.7.4+, but the latest version is always recommended.

Example Steps for Hyper-V:

vagrant box add windows_2016_docker windows_2016_docker_hyperv.box
vagrant init windows_2016_docker
vagrant up --provider hyperv

Contributing

Pull requests are welcome!

packer-windows's People

Contributors

amotl avatar basictheprogram avatar beutepa avatar bigwave avatar brettporter avatar chappoo avatar codestothestars avatar dylanmei avatar earljon avatar floh96 avatar gadgetmg avatar jcoutch avatar jdub avatar jeritiana avatar joefitzgerald avatar jvimes avatar kensykora avatar kewalaka avatar kocoji avatar lmayorga1980 avatar maximd avatar mwieczorek avatar patricklang avatar philarmstrong avatar qmfrederik avatar rgl avatar seal-ss avatar senglin avatar stefanscherer avatar thebigbear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-windows's Issues

Bad ISO checksum for 1709

โžœ  packer-windows git:(my) git rev-parse --short HEAD
c95fc93
โžœ  packer-windows git:(my) packer build --only=virtualbox-iso windows_server_1709_docker.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: https://software-download.microsoft.com/pr/en_windows_server_version_1709_x64_dvd_100090904.iso
    virtualbox-iso: Error downloading: checksums didn't match expected: ca1108d5be2c091bfb57e8f3db3be1e8baa9c32802131f7a6e43e63f7b596591
==> virtualbox-iso: ISO download failed.
Build 'virtualbox-iso' errored: ISO download failed.

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: ISO download failed.

==> Builds finished but no artifacts were created.

Windows 2016/2016 docker timeouts

Hi

First time building this one, as I am not familiar with windows server I cant be that much of help
Hypervisor: vbox
host: OSX sierra

packer build --only=virtualbox-iso windows_2016_docker.json
packer build --only=virtualbox-iso windows_2016.json

both failed to build as they run in the timeout of 6 hours or something

Sysprep Windows 2016 Server?

Howdy Stefan, wondering if the sysprep command on the readme file works for you when you try it on the windows_2016.json template? Keeps timing out for me for some odd reason..

qemu support

Hello,

is somebody interessted in adding qemu/kvm support to this scripts?

I might consider this but I might need some help.

Windows 2019 evaluation key?

Hi @StefanScherer Solid images. Love using them on Hyper-v

I wanted to testdrive the new ingress networking in Windows Server 2019, but i had some troubles with activating the evaluation version, to get the 180 days. Also tried giving it my 2019 standard MSDN license key, which didn't work either.

What iso are you using as a base for the two 2019 boxes? I couldn't find the evaluation version of 2019 or Server 1809. Only a blogpost where it was stated that the eval version was not released yet.

Did you manage to activate one of the new 2019 boxes? Eval or full license key?

best regards
Lars

differencing_disk depracated

Hyper-V configuration differencing_disk has been depracated and replaced with linked_clone in Vagrant.
Are you already changing templates or should I create (my 1st) PR about it?

config.vm.provider "hyperv" do |v|
v.cpus = 2
v.maxmemory = 2048
v.differencing_disk = true
end

debloat.zip fails to download

I ran packer build --only virtualbox-iso .\windows_10.json

While the build succeeds, there are errors reported in the log output...

Log output

==> virtualbox-iso: Provisioning with powershell script: ./scripts/debloat-windows.ps1
    virtualbox-iso: Downloading debloat zip
    virtualbox-iso: Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure virtualbox-iso: channel."

Seems a bit odd to group screensaver disabling with windows update for Windows 10.

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

I am starting to base my builds on the Windows 10 Autounattend.xml in this repo and I couldn't help but wonder why screen saver disabling was grouped in with enabling/disabling Windows updates. It should probably be moved to the general area.

vmware-iso builder (hardware) version:11 vs VMware Fusion 8 (and higher) Workstation 11 (and higher)

I use VMware Fusion 8, Fusion 10, Workstation 12, Workstation 14 for generating my packer images. All of the above release complain about the hardware compatibility version number and request I upgrade it.

https://kb.vmware.com/s/article/1010675
https://kb.vmware.com/s/article/1014006

VMware Fusion 7.x, hardware version 11,
Latest maintenance release 7.1.3, Nov 12, 2015, newest operating system OS X El Capitan (10.11)

VMware Workstation 11.x, hardware version 11,
Latest maintenance release 11.1.2, Jun 15, 2016, newest operating system Windows 10

Can we increment the version to at least 12?

I'll make a PR if this is approved.

No Operating System - No Images Available

Performing - hangs with the vmware fusion screen

image

โฏโฏโฏ packer build --only=vmware-iso windows_2016.json โŽ โœฑ (git:my)
vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
vmware-iso: Downloading or copying: http://care.dlservice.microsoft.com/dl/download/1/6/F/16FA20E6-4662-482A-920B-1A45CF5AAE3C/14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO
==> vmware-iso: Creating floppy disk...
vmware-iso: Copying files flatly from floppy_files
vmware-iso: Copying file: ./answer_files/2016/Autounattend.xml
vmware-iso: Copying file: ./floppy/WindowsPowershell.lnk
vmware-iso: Copying file: ./floppy/PinTo10.exe
vmware-iso: Copying file: ./scripts/disable-screensaver.ps1
vmware-iso: Copying file: ./scripts/disable-winrm.ps1
vmware-iso: Copying file: ./scripts/enable-winrm.ps1
vmware-iso: Copying file: ./scripts/microsoft-updates.bat
vmware-iso: Copying file: ./scripts/win-updates.ps1
vmware-iso: Done copying files from floppy_files
vmware-iso: Collecting paths from floppy_dirs
vmware-iso: Resulting paths from floppy_dirs : []
vmware-iso: Done copying paths from floppy_dirs
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Starting virtual machine...
==> vmware-iso: Waiting 2m0s for boot...
==> vmware-iso: Connecting to VM via VNC
==> vmware-iso: Typing the boot command over VNC...
==> vmware-iso: Waiting for WinRM to become available...

Unable to RDP into the box due to updates the CredSSP authentication protocol

This box needs to be updated with the latest security patches to get around an RDP issue.

I'm running Windows 10 pro, set up my vagrantfile to use StefanScherer/windows_2016, ran vagrant up to create and configure the machine, and then attempted to RDP into it using vagrant rdp. I ran into this error:

rdperror

Following the provided link brought me here:
CredSSP updates for CVE-2018-0886

It looks like a recent update to my machine was preventing me from RDPing into the box because it didn't have a corresponding update. I was able to get around this by using the Local Group Policy Editor to enable the Encryption Oracle Remediation policy setting, and setting it to Vulnerable. Setting it to Mitigated or Force Updated Clients would result in the same error. Once I had successfully RDPed in, I ran windows update, and installed the following three updates:

windowsserver2016updates

One of those three likely had the fix my VM needed. Once it was installed in the VM, I was able to RDP into it with the Encryption Oracle Remediation set to Not Configured, or Enabled with the Protection level set to any of the three options.

Windows 10 answer file does not work

I tried building windows 10 with virtual box and have issues with the answer files:
The ProductKey cannot be read. I looks the xml has the wrong format and the key itself is missing a part.
If I enter a different key, I then get stuck first and the select language screen and after that on a screen saying "no images available".

Any ideas what went wrong?

Windows 10 1809 virtualbox hangs

When running vagrant up it times out on default: WinRM transport: negotiate.
The vm does boot in virtaulbox, but there are no network devices present.
Used packer build --only=virtualbox-iso .\windows_10.json to build the box.

Error compacting disk: VMware error:

Starting getting this error after after 5bc3cf5 but git blame shows nothing changed regarding windows_10.json and this used to work.

What's changed is I applied:

  • macOS High Sierra 10.13.4 Update
  • Comand Line Tools (macOS High Sierra version 10.13) for Xcode

$ packer build -only=vmware-iso -var 'disk_size=65536' --force windows_10.json

==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Error compacting disk: VMware error: Failed to open the disk '/Users/tanner/projects/packer/Stefan-Schere-packer-windows/output-vmware-iso/disk.vmdk' : The specified virtual disk needs repair (0x3e86).
Failed to defragment: The specified virtual disk needs repair (0x3e86).

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Error compacting disk: VMware error: Failed to open the disk '/Users/tanner/projects/packer/Stefan-Schere-packer-windows/output-vmware-iso/disk.vmdk' : The specified virtual disk needs repair (0x3e86).
Failed to defragment: The specified virtual disk needs repair (0x3e86).

windows_2016_docker fails to build

When I follow the instructions here, I get the following error:

    vmware-iso: SUCCESS: The scheduled task "InstallContainerImage" was successfully deleted.
    vmware-iso: Error response from daemon: no such id: windowsservercore:10.0.14300.1000
    vmware-iso: Error response from daemon: no such id: nanoserver:10.0.14300.1016
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

Any idea what the problem might be? If there's any additional debugging info you need (or if I'm posting this to the wrong repo), please let me know.

Thanks!

Testing the hyperv box hangs with username/password prompt for shared folder

In my Jenkins build agent I also try to test the newly built vagrant box. In Azure I can create the boxes with the hyperv-iso builder. A vagrant up hangs with the following problem using the shared folder

demo@pckrwin45e110 C:\Windows\workspace\packer-windows_my-PH7VQTN6RDUL23PJXSNDIGZXF5YME4XP2R3GVKXGJIWL7LIVCX5A\boxtest>vagrant up --provider=hyperv 
Bringing machine 'tst' up with 'hyperv' provider...
==> tst: Verifying Hyper-V is enabled...
==> tst: Configured Dynamic memory allocation, maxmemory is 2048
==> tst: Configured cpus number is 2
==> tst: Configured differencing disk instead of cloning
==> tst: Importing a Hyper-V instance
    tst: Cloning virtual hard drive...
    tst: Creating and registering the VM...
    tst: Setting VM Integration Services
    tst: Successfully imported a VM with name: windows_10
==> tst: Starting the machine...
==> tst: Waiting for the machine to report its IP address...
    tst: Timeout: 120 seconds
    tst: IP: 192.168.0.11
==> tst: Waiting for machine to boot. This may take a few minutes...
    tst: WinRM address: 192.168.0.11:5985
    tst: WinRM username: vagrant
    tst: WinRM execution_time_limit: PT2H
    tst: WinRM transport: negotiate
==> tst: Machine booted and ready!
==> tst: Preparing SMB shared folders...
    tst: You will be asked for the username and password to use for the SMB
    tst: folders shortly. Please use the proper username/password of your
    tst: Windows account.
    tst:  
    tst: Username:     tst: Password (will be hidden): 
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
     tst: Password (will be hidden): ==> tst: Mounting SMB shared folders...
    tst: C:/Windows/workspace/packer-windows_my-PH7VQTN6RDUL23PJXSNDIGZXF5YME4XP2R3GVKXGJIWL7LIVCX5A/boxtest => /vagrant
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

cmdkey /add:10.0.0.7 /user: /pass:

Stdout from the command:



CMDKEY: This command requires either the /U switch and 

        a username or else the /smartcard switch with a smartcard.

Help with updates for my packer repo

I have been struggling with this for a couple days now so i thought i would reach out to you. When i run your packer template and utilize the win-updates.ps1 script i notice that upon mandatory reboots the powershell prompt that gets loaded between reboots for performing updates is started as admin. I started my own packer templates repo and i have a different behavior. When the initial updates happen they are run in a prompt as admin but upon mandatory update reboots the shell gets open as a non-admin user and i get alot of access-denied errors for the rest of the update script. I have pin-pointed this to something in the autounattend.xml but i have no idea after looking over it multiple times on what in your autounattend.xml vs mine is causing the powershell prompt for windows updates to be open as admin. Any help is greatly appreciated.

Here is my autounattend.xml https://github.com/TraGicCode/packer-windows-playground/blob/master/answer_files/2016/autounattend.xml

windows_7.json Timeout waiting for SSH

Have a need to go back to Windows 7 for some testing. Tried making an image with windows_7.json and I'm getting a timeout waiting for ssh.

2018/04/27 05:48:12 Detected IP: 192.168.244.131==> vmware-iso: Timeout waiting for SSH.
2018/04/27 05:48:14 ui error: ==> vmware-iso: Timeout waiting for SSH.
2018/04/27 05:48:26 ui error: Build 'vmware-iso' errored: Timeout waiting for SSH.
2018/04/27 05:48:26 machine readable: vmware-iso,error []string{"Timeout waiting for SSH."}
2018/04/27 05:48:26 ui error: --> vmware-iso: Timeout waiting for SSH.
==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Timeout waiting for SSH.

I have not used ssh as a communicator in packer. I do find Reintroduce SSH to Windows boxes? so it looks like ssh is coming? Upstream uses ssh already?

I do not find a "communicator" for the Windows7 builders. The docs hint that ssh is the default?

I'll do some troubleshooting.

Timeout waiting for machine to restart

Testing my PR for #62 and getting unexpected behavior when waiting for a reboot to come back. This behavior started when I git pulled 304705d, well that's the top of my git log.

I am running headless, I altered some timeouts thinking the problem was my slow hardware, diff below:

diff --git a/windows_2016.json b/windows_2016.json
index 3245228..02c5986 100644
--- a/windows_2016.json
+++ b/windows_2016.json
@@ -154,13 +154,13 @@
     "autounattend": "./answer_files/2016/Autounattend.xml",
     "disk_size": "61440",
     "disk_type_id": "1",
-    "headless": "false",
+    "headless": "true",
     "hyperv_switchname": "{{env `hyperv_switchname`}}",
     "iso_checksum": "70721288BBCDFE3239D8F8C0FAE55F1F",
     "iso_checksum_type": "md5",
     "iso_url": "http://care.dlservice.microsoft.com/dl/download/1/4/9/149D5452-9B29-4274-B6B3-5361DBDA30BC/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO",
-    "restart_timeout": "5m",
-    "winrm_timeout": "2h"
+    "restart_timeout": "55m",
+    "winrm_timeout": "29h"
   }
 }
$ packer build -only=virtualbox-iso --force windows_2016.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: http://care.dlservice.microsoft.com/dl/download/1/4/9/149D5452-9B29-4274-B6B3-5361DBDA30BC/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO
==> virtualbox-iso: Creating floppy disk...
    virtualbox-iso: Copying files flatly from floppy_files
    virtualbox-iso: Copying file: ./answer_files/2016/Autounattend.xml
    virtualbox-iso: Copying file: ./scripts/disable-screensaver.ps1
    virtualbox-iso: Copying file: ./scripts/disable-winrm.ps1
    virtualbox-iso: Copying file: ./scripts/enable-winrm.ps1
    virtualbox-iso: Copying file: ./scripts/microsoft-updates.bat
    virtualbox-iso: Copying file: ./scripts/win-updates.ps1
    virtualbox-iso: Copying file: ./scripts/unattend.xml
    virtualbox-iso: Copying file: ./scripts/sysprep.bat
    virtualbox-iso: Done copying files from floppy_files
    virtualbox-iso: Collecting paths from floppy_dirs
    virtualbox-iso: Resulting paths from floppy_dirs : []
    virtualbox-iso: Done copying paths from floppy_dirs
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Attaching floppy disk...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 3701)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm WindowsServer2016 --memory 2048
    virtualbox-iso: Executing: modifyvm WindowsServer2016 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
    virtualbox-iso: The VM will be run headless, without a GUI. If you want to
    virtualbox-iso: view the screen of the VM, connect via VRDP without a password to
    virtualbox-iso: rdp://127.0.0.1:5902
==> virtualbox-iso: Waiting 2m0s for boot...
    virtualbox-iso: PSIsContainer : True
    virtualbox-iso: SubKeyCount   : 0
    virtualbox-iso: View          : Default
    virtualbox-iso: Handle        : Microsoft.Win32.SafeHandles.SafeRegistryHandle
    virtualbox-iso: ValueCount    : 0
    virtualbox-iso: Name          : HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization
    virtualbox-iso:
    virtualbox-iso: Disable 'Updates are available' message
    virtualbox-iso:
    virtualbox-iso: SUCCESS: The file (or folder): "C:\Windows\System32\MusNotification.exe" now owned by user "VAGRANT-2016\vagrant".
    virtualbox-iso: processed file: C:\Windows\System32\MusNotification.exe
    virtualbox-iso: Successfully processed 1 files; Failed processing 0 files
    virtualbox-iso:
    virtualbox-iso: SUCCESS: The file (or folder): "C:\Windows\System32\MusNotificationUx.exe" now owned by user "VAGRANT-2016\vagrant".
    virtualbox-iso: processed file: C:\Windows\System32\MusNotificationUx.exe
    virtualbox-iso: Successfully processed 1 files; Failed processing 0 files
==> virtualbox-iso: Restarting Machine
==> virtualbox-iso: Waiting for machine to restart...
    virtualbox-iso: A system shutdown is in progress.(1115)
    virtualbox-iso: A system shutdown is in progress.(1115)
   <hangs>
==> virtualbox-iso: Timeout waiting for machine to restart.
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
  ild 'virtualbox-iso' errored: Timeout waiting for machine to restart.
  • rdp://127.0.0.1:5902 shows the windows console, so the machine has started
  • I can start up a powershell and ping internal and external hosts
  • I can run Windows Update and it works as expected
  • I -do- find the Windows firewall active

I do not know what packer is doing to confirm the machine reboot and is back online, so I do not know if the windows firewall is blocking the check.

Windows 10 1703

Stefan - I've just started picking up Packer-Windows and working with it specifically to automate Windows 10 builds

I've noticed that since build 1511 the following is treated asynchronously -

<FirstLogonCommands>
    <SynchronousCommand wcm:action="add">
      .
      .
    </SynchronousCommand>
</FirstLogonCommands>

Have you observed random failures due to this - any thoughts of consolidating the FirstLogonCommands

Also - it looks like you've made some adjustments for the latest build of Windows 10 - have you tried these mods on 1703

Thanks in advance for your time

vmware-iso builds + thin disks vs scripts/compact.bat

Discussing this over on the Packer Google Group.

Creating a VMware image with 756GB disk, allocated thin. Everything looks correct until the script/compact.bat runs in the provisioners.

Looks like SDelete causes the thin disk to provision all 756G of disk.

Looking at script/compact.bat I see it's skipped for hyperv.

if "%PACKER_BUILDER_TYPE:~0,6%"=="hyperv" (
  echo "Skip compact steps in Hyper-V build."
  goto :eof
)

I'm not sure of the ramifications of this change so I'm opening an issue for discussion.

Thanks.

Error during build?

Hello, I'm receiving the following error on build? Any tips on what to look at?

Thanks

==> vmware-iso: Provisioning with shell script: ./scripts/docker/patch-boot-time-for-containers.ps1
vmware-iso: Running windowsservercore once and tagging it as latest
vmware-iso: C:\Windows\system32\docker.exe: Error parsing reference: "windowsservercore:" is not a valid repository/tag.
vmware-iso: See 'C:\Windows\system32\docker.exe run --help'.
vmware-iso: C:\Windows\system32\docker.exe: "commit" requires a minimum of 1 argument.
vmware-iso: See 'C:\Windows\system32\docker.exe commit --help'.
vmware-iso:
vmware-iso: Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
vmware-iso:
vmware-iso: Create a new image from a container's changes
vmware-iso: C:\Windows\system32\docker.exe: "tag" requires 2 arguments.
vmware-iso: See 'C:\Windows\system32\docker.exe tag --help'.
vmware-iso:
vmware-iso: Usage: docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
vmware-iso:
vmware-iso: Tag an image into a repository
vmware-iso: C:\Windows\system32\docker.exe: "rm" requires a minimum of 1 argument.
vmware-iso: See 'C:\Windows\system32\docker.exe rm --help'.
vmware-iso:
vmware-iso: Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
vmware-iso:
vmware-iso: Remove one or more containers
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

$ packer --version
1.1.1

macOS 10.12.6

$ packer build -only=virtualbox-iso windows_10.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: http://care.dlservice.microsoft.com/dl/download/6/5/D/65D18931-F626-4A35-AD5B-F5DA41FE6B76/16299.15.170928-1534.rs3_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso
==> virtualbox-iso: Creating floppy disk...
    virtualbox-iso: Copying files flatly from floppy_files
    virtualbox-iso: Copying file: ./answer_files/10/Autounattend.xml
    virtualbox-iso: Copying file: ./floppy/WindowsPowershell.lnk
    virtualbox-iso: Copying file: ./floppy/PinTo10.exe
    virtualbox-iso: Copying file: ./scripts/fixnetwork.ps1
    virtualbox-iso: Copying file: ./scripts/disable-screensaver.ps1
    virtualbox-iso: Copying file: ./scripts/disable-winrm.ps1
    virtualbox-iso: Copying file: ./scripts/enable-winrm.ps1
    virtualbox-iso: Copying file: ./scripts/microsoft-updates.bat
    virtualbox-iso: Copying file: ./scripts/win-updates.ps1
    virtualbox-iso: Done copying files from floppy_files
    virtualbox-iso: Collecting paths from floppy_dirs
    virtualbox-iso: Resulting paths from floppy_dirs : []
    virtualbox-iso: Done copying paths from floppy_dirs
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Attaching floppy disk...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2236)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm windows_10 --memory 2048
    virtualbox-iso: Executing: modifyvm windows_10 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 6m0s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for WinRM to become available...
    virtualbox-iso: WinRM connected.
    virtualbox-iso: #< CLIXML
    virtualbox-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> virtualbox-iso: Connected to WinRM!
==> virtualbox-iso: Uploading VirtualBox version info (5.1.30)
==> virtualbox-iso: Provisioning with windows-shell...
==> virtualbox-iso: Provisioning with shell script: ./scripts/vm-guest-tools.bat
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if not exist "C:\Windows\Temp\7z920-x64.msi" (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')"  0<NUL )
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if "virtualbox-iso" EQU "vmware-iso" goto :vmware
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if "virtualbox-iso" EQU "virtualbox-iso" goto :virtualbox
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp )
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.1.30/VBoxGuestAdditions_5.1.30.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')"  0<NUL )
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
    virtualbox-iso:
    virtualbox-iso: 7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
    virtualbox-iso:
    virtualbox-iso: Processing archive: C:\Windows\Temp\VBoxGuestAdditions.iso
    virtualbox-iso:
    virtualbox-iso: Extracting  32Bit
    virtualbox-iso: Extracting  32Bit\Readme.txt
    virtualbox-iso: Extracting  64Bit
    virtualbox-iso: Extracting  64Bit\Readme.txt
    virtualbox-iso: Extracting  AUTORUN.INF
    virtualbox-iso: Extracting  OS2
    virtualbox-iso: Extracting  OS2\VBoxControl.exe
    virtualbox-iso: Extracting  OS2\VBoxGuest.sys
    virtualbox-iso: Extracting  OS2\VBoxReplaceDll.exe
    virtualbox-iso: Extracting  OS2\VBoxService.exe
    virtualbox-iso: Extracting  OS2\gengradd.dll
    virtualbox-iso: Extracting  OS2\libc06.dll
    virtualbox-iso: Extracting  OS2\libc061.dll
    virtualbox-iso: Extracting  OS2\libc062.dll
    virtualbox-iso: Extracting  OS2\libc063.dll
    virtualbox-iso: Extracting  OS2\libc064.dll
    virtualbox-iso: Extracting  OS2\libc065.dll
    virtualbox-iso: Extracting  OS2\libc066.dll
    virtualbox-iso: Extracting  OS2\readme.txt
    virtualbox-iso: Extracting  OS2\vboxmouse.sys
    virtualbox-iso: Extracting  VBoxLinuxAdditions.run
    virtualbox-iso: Extracting  VBoxSolarisAdditions.pkg
    virtualbox-iso: Extracting  VBoxWindowsAdditions-amd64.exe
    virtualbox-iso: Extracting  VBoxWindowsAdditions-x86.exe
    virtualbox-iso: Extracting  VBoxWindowsAdditions.exe
    virtualbox-iso: Extracting  autorun.sh
    virtualbox-iso: Extracting  cert
    virtualbox-iso: Extracting  cert\VBoxCertUtil.exe
    virtualbox-iso: Extracting  cert\vbox-sha1.cer
    virtualbox-iso: Extracting  cert\vbox-sha256-r3.cer
    virtualbox-iso: Extracting  cert\vbox-sha256.cer
    virtualbox-iso: Extracting  runasroot.sh
    virtualbox-iso:
    virtualbox-iso: Everything is Ok
    virtualbox-iso:
    virtualbox-iso: Folders: 4
    virtualbox-iso: Files: 28
    virtualbox-iso: Size:       59079687
    virtualbox-iso: Compressed: 59494400
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256-r3.cer
    virtualbox-iso: TrustedPublisher "Trusted Publishers"
    virtualbox-iso: Certificate "Oracle Corporation" added to store.
    virtualbox-iso: CertUtil: -addstore command completed successfully.
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256.cer
    virtualbox-iso: TrustedPublisher "Trusted Publishers"
    virtualbox-iso: Certificate "Oracle America, Inc." added to store.
    virtualbox-iso: CertUtil: -addstore command completed successfully.
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
    virtualbox-iso: TrustedPublisher "Trusted Publishers"
    virtualbox-iso: Certificate "Oracle Corporation" added to store.
    virtualbox-iso: CertUtil: -addstore command completed successfully.
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>rd /S /Q "C:\Windows\Temp\virtualbox"
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>goto :done
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
==> virtualbox-iso: Provisioning with shell script: ./scripts/enable-rdp.bat
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389
    virtualbox-iso: Ok.
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
    virtualbox-iso: The operation completed successfully.
==> virtualbox-iso: Provisioning with Powershell...
==> virtualbox-iso: Provisioning with powershell script: ./scripts/debloat-windows.ps1
    virtualbox-iso: Downloading debloat zip
    virtualbox-iso: Disable Windows Defender
    virtualbox-iso: Optimize Windows Update
    virtualbox-iso: Disable automatic download and installation of Windows updates
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso:     Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\WindowsUpdate
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: Name                           Property
    virtualbox-iso: ----                           --------
    virtualbox-iso: AU
    virtualbox-iso: Disable seeding of updates to other computers via Group Policies
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso:     Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: Name                           Property
    virtualbox-iso: ----                           --------
    virtualbox-iso: DeliveryOptimization
    virtualbox-iso: Disable 'Updates are available' message
    virtualbox-iso:
    virtualbox-iso: SUCCESS: The file (or folder): "C:\Windows\System32\MusNotification.exe" now owned by user "VAGRANT-10\vagrant".
    virtualbox-iso: processed file: C:\Windows\System32\MusNotification.exe
    virtualbox-iso: Successfully processed 1 files; Failed processing 0 files
    virtualbox-iso:
    virtualbox-iso: SUCCESS: The file (or folder): "C:\Windows\System32\MusNotificationUx.exe" now owned by user "VAGRANT-10\vagrant".
    virtualbox-iso: processed file: C:\Windows\System32\MusNotificationUx.exe
    virtualbox-iso: Successfully processed 1 files; Failed processing 0 files
    virtualbox-iso: Uninstall-WindowsFeature : The term 'Uninstall-WindowsFeature' is not recognized as the name of a cmdlet, function,
    virtualbox-iso: script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
    virtualbox-iso: correct and try again.
    virtualbox-iso: At C:\Windows\Temp\script-5a093eee-8d5b-cc00-e371-055023d184ba.ps1:17 char:3
    virtualbox-iso: +   Uninstall-WindowsFeature Windows-Defender-Features
    virtualbox-iso: +   ~~~~~~~~~~~~~~~~~~~~~~~~
    virtualbox-iso:     + CategoryInfo          : ObjectNotFound: (Uninstall-WindowsFeature:String) [], CommandNotFoundException
    virtualbox-iso:     + FullyQualifiedErrorId : CommandNotFoundException
    virtualbox-iso:
==> virtualbox-iso: Restarting Machine
==> virtualbox-iso: Waiting for machine to restart...
    virtualbox-iso: A system shutdown is in progress.(1115)
    virtualbox-iso: VAGRANT-10 restarted.
    virtualbox-iso: #< CLIXML
    virtualbox-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> virtualbox-iso: Machine successfully restarted, moving on
==> virtualbox-iso: Provisioning with Powershell...
==> virtualbox-iso: Provisioning with powershell script: ./scripts/set-powerplan.ps1
    virtualbox-iso: Invalid Parameters -- try "/?" for help
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

instal-docker.ps1 failed

host: win8.1
packer v 0.10.1
virtualbox 5.0.20

I run:
packer.exe build -only=virtualbox-iso windows_2016_docker.json
And after some time got error (whole log in gist )

2016/05/14 22:08:01 packer.exe: 2016/05/14 22:08:01 [INFO] command 'set "PACKER_BUILDER_TYPE=virtualbox-iso" && set "PA
CKER_BUILD_NAME=virtualbox-iso" &&  cmd /c "c:/Windows/Temp/script.bat"' exited with code: 1

I wanted to check what's wrong in the script so I removed powershell provisioner with the ./scripts/docker/install-docker.ps1, and build box.

And then I started the VM, and run script manually. During the script I saw some 'permission' problems.
image
That's strange, because vagrant user is in Administrators group, and scheduled task is run as vagrant.
So I 'googled' and found:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383085(v=vs.85).aspx

If a task is registered using the Administrators group for the security context of the task, then you must also set the RunLevel property to "HighestAvailable" to run the task.

But in the install-docker.ps1:

<Principals>
    <Principal id="Author">
      <UserId>vagrant</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>

When I changed that to HighestAvailable - error was gone.

Did you have such problem? Maybe I'm doing something else wrong?

If not - maybe we can change that to HighestAvailable? I can make a PR.

windows_2019.json vmware build No images available

First time trying to build insider build using windows_2019.json

I boot .iso via packer, Fusion comes up with this "No images are available".

packer build -only=vmware-iso -var 'disk_size=65536' --force  -var-file=/Users/tanner/.packer.d/my_windows_2019.json windows_2019.json

my_windows_2019.json contents

{
    "iso_url": "/Users/tanner/Downloads/Windows_InsiderPreview_Server_17639.iso",
    "iso_checksum": "12cb8497a70234403c280adc1d79311fbcbb81e4",
    "iso_checksum_type": "sha1",
    "vhv_enable": "true",

    "winrm_timeout": "24h",
    "shutdown_timeout": "1h",
    "restart_timeout": "40h",
}

Packer has sat here for 4 hours

==> vmware-iso: Connecting to VM via VNC (127.0.0.1:5966)
==> vmware-iso: Typing the boot command over VNC...
==> vmware-iso: Waiting for WinRM to become available...

Windows update boot loop with windows_10 template

The latest cumulative update 2018-09 on Windows 10 seems to make a problem with the current win-updates.ps1 script.

The win-updates.ps1 script runs into a boot loop.

bildschirmfoto 2018-09-13 um 07 24 53

I had to manually stop the win-updates.ps1 script and open the "Check for updates" dialog and install the update from there. After the reboot the win-updates.ps1 script found out that it should finish and opens WinRM port.

bildschirmfoto 2018-09-13 um 07 25 27

The win-updates.ps1 and the closed WinRM port until all updates are finished are the pain point of this packer templates. Once again I think of moving to another way to install the updates.

rdp failing

finding that rdp/powershell fail out of the box using the default configuration. i just reset my machine this weekend so my windows setup is very vanilla. apologies if i should be altering my firewall as part of getting in to using this. also fyi, finding that powershell doesnt work out of the box as well. here's my pretty bare vagrant file that allows for both powershell and rdp to work:

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANT_COMMAND = ARGV[0]

Vagrant.configure("2") do |config|
  config.vm.box = "StefanScherer/windows_2016" # https://github.com/StefanScherer/packer-windows/blob/my/vagrantfile-windows_10.template

  # this flipping is to handle where the shell provisioner
  # cannot execute elevated commands without the prefix,
  # but running `vagrant powershell` doesn't work with it
  # `vagrant` is the default value out of the box
  # todo: investigate if needed: VAGRANT_COMMAND != "rdp"
  if VAGRANT_COMMAND != "powershell"
    config.winrm.username = 'vagrant\vagrant'
  end

  config.vm.provider "virtualbox" do |vb|
    vb.memory = "8192"
  end

  config.vm.network :forwarded_port, guest: 3389, host: 5389, id: "rdp", auto_correct: true

end

thoughts? am i missing a step?

also, fwiw:

vagrant box list
StefanScherer/windows_2016 (virtualbox, 2019.01.09)

Build errored: Timeout while waiting for machine to shut down

I'm trying to use a volume license .iso of Windows Server 2016 and packer is throwing an error: "Build errored: Timeout while waiting for machine to shut down". The only thing I changed is the name and location of the .iso image.

I'm trying to use file:///Users/tanner/Downloads/SW_DVD9_Win_Server_STD_CORE_2016_64Bit_English_-4_DC_STD_MLF_X21-70526.ISO๏ฟฝ and not the 180 days licensed image.

I assume the volume licensed Windows Server 2016 images should work with packer?

Snipped from the logs:

==> vmware-iso: Gracefully halting virtual machine..
==> vmware-iso: Timeout while waiting for machine to shut down
==> vmware-iso: Stopping virtual machine..
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Timeout while waiting for machine to shut down.

packer.log

Changed the restart_timeout

    "restart_timeout": "1h",

Does not change things.

WinRM timing out

For some reason having an issue connecting with WinRM. I have changed the credentials to a different account, but I think that is all I have done differently on my repo. Any insight would be appreciated.

2018/06/22 10:45:06 packer.exe: 2018/06/22 10:45:06 [INFO] Attempting WinRM connection...
2018/06/22 10:45:06 packer.exe: 2018/06/22 10:45:06 [DEBUG] connecting to remote shell using WinRM
2018/06/22 10:46:25 packer.exe: 2018/06/22 10:46:25 [ERROR] connection error: unknown error Post http://127.0.0.1:3667/wsman: read tcp 12
7.0.0.1:52507->127.0.0.1:3667: wsarecv: An existing connection was forcibly closed by the remote host.
2018/06/22 10:46:25 packer.exe: 2018/06/22 10:46:25 [ERROR] WinRM connection err: unknown error Post http://127.0.0.1:3667/wsman: read tc
p 127.0.0.1:52507->127.0.0.1:3667: wsarecv: An existing connection was forcibly closed by the remote host.
2018/06/22 10:46:30 packer.exe: 2018/06/22 10:46:30 [INFO] Attempting WinRM connection...
2018/06/22 10:46:30 packer.exe: 2018/06/22 10:46:30 [DEBUG] connecting to remote shell using WinRM
2018/06/22 10:47:47 packer.exe: 2018/06/22 10:47:47 [ERROR] connection error: unknown error Post http://127.0.0.1:3667/wsman: read tcp 12
7.0.0.1:52523->127.0.0.1:3667: wsarecv: An existing connection was forcibly closed by the remote host.
2018/06/22 10:47:47 packer.exe: 2018/06/22 10:47:47 [ERROR] WinRM connection err: unknown error Post http://127.0.0.1:3667/wsman: read tc
p 127.0.0.1:52523->127.0.0.1:3667: wsarecv: An existing connection was forcibly closed by the remote host.
2018/06/22 10:47:52 packer.exe: 2018/06/22 10:47:52 [INFO] Attempting WinRM connection...
2018/06/22 10:47:52 packer.exe: 2018/06/22 10:47:52 [DEBUG] connecting to remote shell using WinRM
2018/06/22 10:48:36 packer.exe: 2018/06/22 10:48:36 [ERROR] connection error: http response error: 401 - invalid content type
2018/06/22 10:48:36 packer.exe: 2018/06/22 10:48:36 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2018/06/22 10:48:41 packer.exe: 2018/06/22 10:48:41 [INFO] Attempting WinRM connection...
2018/06/22 10:48:41 packer.exe: 2018/06/22 10:48:41 [DEBUG] connecting to remote shell using WinRM
2018/06/22 10:48:41 packer.exe: 2018/06/22 10:48:41 [ERROR] connection error: http response error: 401 - invalid content type
2018/06/22 10:48:41 packer.exe: 2018/06/22 10:48:41 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2018/06/22 10:48:46 packer.exe: 2018/06/22 10:48:46 [INFO] Attempting WinRM connection...
2018/06/22 10:48:46 packer.exe: 2018/06/22 10:48:46 [DEBUG] connecting to remote shell using WinRM
2018/06/22 10:48:46 packer.exe: 2018/06/22 10:48:46 [ERROR] connection error: http response error: 401 - invalid content type
2018/06/22 10:48:46 packer.exe: 2018/06/22 10:48:46 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2018/06/22 10:48:51 packer.exe: 2018/06/22 10:48:51 [INFO] Attempting WinRM connection...
2018/06/22 10:48:51 packer.exe: 2018/06/22 10:48:51 [DEBUG] connecting to remote shell using WinRM

packer build hangs: Shutdown Event Tracker popup

During the win-updates.ps1 script Windows Server 2016 (after the CU in October 2017?) the VM hangs with an popup "Shutdown Event Tracker".

bildschirmfoto 2017-10-13 um 06 33 45

I tried that twice.

The win-updates.ps1 script started

bildschirmfoto 2017-10-13 um 06 40 46

The machine crashed

bildschirmfoto 2017-10-13 um 06 44 38

EOF-Error when build windows_2016_docker.json

Hi.

I try to build windows_2016_docker.json on a macOS host with packer 0.12.1 using the following command: packer build windows_2016_docker.json

But I get the following error:

localhost:packer-windows tichel$ packer build windows_2016_docker.json
hyperv-iso output will be in this color.
virtualbox-iso output will be in this color.
vmware-iso output will be in this color.

unexpected EOF
localhost:packer-windows tichel$

Building windows_2016.json works just fine.

Dirk

`post_shutdown_delay` not found

OS: Debian GNU/Linux 9 (stretch)
Packer: 0.10.2
Command: packer build --only=virtualbox-iso windows_2016_docker.json

Removing the post_shutdown_delay in windows_2016_docker.json worked just fine.

Autologon

Having a difficult time where autologon is disabled in the registry before post-processing. Or is it at all? I am a Packer noob and I have altered your windows_10.json a bit to work with MDT capturing the image.

Problem I am having is that when I change the autounattend.xml to install updates that seems to stop autologon. If I disable installing updates in autounattend it works.

Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 4294967295

I worked around #49 now hitting another problem.

virtualbox-iso: 1>    Compiling assembly TaskScheduler, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=msil (CLR v4.0.30319) ...
    virtualbox-iso: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 4294967295

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Script exited with non-zero exit status: 4294967295

Cleanup VMware provider names

The Workstation and Fusion specific plugins required the explicit provider name (vmware_workstation or vmware_fusion) when configuring VMware. The Desktop plugin still supports the old provider names but also adds a common provider name that is not specific to Workstation or Fusion: vmware_desktop.

https://www.hashicorp.com/blog/introducing-the-vagrant-vmware-desktop-plugin

Update the packer template to vmware_desktop only as every Vagrant + VMware user is urged to upgrade to the new vagrant-vmware-desktop plugin.

Installation of Powershell 5.0 on Windows212R2 Boxes

Added new template based on your repository. Trying to build a vagrant windows box with ps5 on it.

The following a is a ps5.bat file that installs the PS5 from a local chocolatey server.

choco install powershell --version 5.0.10586 -y --source http://mynugetserver/chocopacks/nuget

It seems to me that wusa.exe breaks when using the WinRM connection.

virtualbox-iso: powershell v5.0.10586
    virtualbox-iso: Downloading PowerShell.5.0 64 bit
    virtualbox-iso: from 'https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu'
    virtualbox-iso: Installing PowerShell.5.0...
    virtualbox-iso: [ERROR] Running wusa.exe with C:\Users\vagrant\AppData\Local\Temp\chocolatey\Po
    virtualbox-iso: werShell.5.0\5.0.10586\PowerShell.5.0Install.msu /quiet /norestart
    virtualbox-iso: /log:"C:\Users\vagrant\AppData\Local\Temp\PowerShell.Install.evtx"  was not
    virtualbox-iso: successful. Exit code was '5' Error Message:
    virtualbox-iso: .
    virtualbox-iso: At C:\ProgramData\chocolatey\lib\powershell\tools\chocolateyInstall.ps1:124
    virtualbox-iso: char:3
    virtualbox-iso: +   Throw $_.Exception
    virtualbox-iso: +   ~~~~~~~~~~~~~~~~~~
    virtualbox-iso: + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE
    virtualbox-iso: xception
    virtualbox-iso: + FullyQualifiedErrorId : RuntimeException
    virtualbox-iso: The install of powershell was NOT successful.
    virtualbox-iso: Error while running 'C:\ProgramData\chocolatey\lib\powershell\tools\chocolateyInstall.ps1'.
    virtualbox-iso: See log for details.

Windows Server 2016 guest_os_type?

In windows_2016.json the guest_os_type is Windows2012_64

      "vm_name":"WindowsServer2016",
      "type": "virtualbox-iso",
      "communicator": "winrm",
      "iso_url": "{{user `iso_url`}}",
      "iso_checksum_type": "{{user `iso_checksum_type`}}",
      "iso_checksum": "{{user `iso_checksum`}}",
      "headless": "{{user `headless`}}",
      "boot_wait": "2m",
      "winrm_username": "vagrant",
      "winrm_password": "vagrant",
      "winrm_timeout" : "{{user `winrm_timeout`}}",
      "shutdown_command": "a:/sysprep.bat",
      "guest_os_type": "Windows2012_64",
      "guest_additions_mode": "disable",
      "disk_size": "{{user `disk_size`}}",

$ vboxmanage list ostypes

ID: Windows2016_64
Description: Windows 2016 (64-bit)
Family ID: Windows
Family Desc: Microsoft Windows
64 bit: true

Windows 2019 Error downloading

$ packer build -only=vmware-iso windows_2019.json
vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
    vmware-iso: Downloading or copying: https://software-download.microsoft.com/db/Windows_InsiderPreview_Server_vNext_en-us_17639.iso
    vmware-iso: Error downloading: checksums didn't match expected: ab5a4980d4a7b8e9028124aef7b2a01ed85b3e32762d8bf15ed21b991f63db6f
==> vmware-iso: ISO download failed.
Build 'vmware-iso' errored: ISO download failed.

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: ISO download failed.

==> Builds finished but no artifacts were created.

Wrong url?

$ wget  https://software-download.microsoft.com/db/Windows_InsiderPreview_Server_vNext_en-us_17639.iso
--2018-04-12 10:55:32--  https://software-download.microsoft.com/db/Windows_InsiderPreview_Server_vNext_en-us_17639.iso
Resolving software-download.microsoft.com (software-download.microsoft.com)... 72.21.81.200, 2606:2800:11f:17a5:191a:18d5:537:22f9
Connecting to software-download.microsoft.com (software-download.microsoft.com)|72.21.81.200|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2018-04-12 10:55:32 ERROR 403: Forbidden.

windows_2016_docker.json: unknown configuration key: "vmx_remove_ethernet_interfaces"

the key vmx_remove_ethernet_interfaces needs to be in the vmx_data section
else it will say:

1 error(s) occurred:

* unknown configuration key: "vmx_remove_ethernet_interfaces"

if I move it into the vmx_data section the error goes away

diff --git a/windows_2016_docker.json b/windows_2016_docker.json
index 1a70bd5..d23badb 100644
--- a/windows_2016_docker.json
+++ b/windows_2016_docker.json
@@ -57,14 +57,14 @@
         "./scripts/microsoft-updates.bat",
         "./scripts/win-updates.ps1"
       ],
-      "vmx_remove_ethernet_interfaces": true,
       "vmx_data": {
         "RemoteDisplay.vnc.enabled": "false",
         "RemoteDisplay.vnc.port": "5900",
         "memsize": "2048",
         "numvcpus": "2",
         "scsi0.virtualDev": "lsisas1068",
-        "vhv.enable": "{{user `vhv_enable`}}"
+        "vhv.enable": "{{user `vhv_enable`}}",
+        "vmx_remove_ethernet_interfaces": true
       }
     },
     {

windows_2016_docker.json produces 0 byte vmdk

I'm trying to get Octopus Deploy run in Docker (version 18.03.0-ce-rc1, build c160c73) on my macOS 10.12.6. I've installed VirtualBox (version 5.2.8r121009), downloaded the Windows 2016 ISO and seemingly successfully executed the following command:

packer build --only=virtualbox-iso -var 'iso_url=/Users/bitbear/Downloads/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO' windows_2016_docker.json

After a few hours, this command finishes with the following:

Build 'virtualbox-iso' finished.

==> Builds finished. The artifacts of successful builds are:
--> virtualbox-iso: 'virtualbox' provider box: windows_2016_docker_virtualbox.box

However, when I execute the following command, a .box file is created with a WindowsServer2016Docker-disk001.vmdk file in it that is 0 bytes in size:

vagrant box add windows_2016_docker windows_2016_docker_virtualbox.box

After copying vagrantfile-windows_2016.template to Vagrantfile and modifying it according to work with my setup, vagrant up fails with the following:

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "/Users/bitbear/.vagrant.d/boxes/windows_2016_docker/0/virtualbox/box.ovf", "--vsys", "0", "--vmname", "WindowsServer2016Docker_1519934437898_19158", "--vsys", "0", "--unit", "8", "--disk", "/Users/bitbear/VirtualBox VMs/WindowsServer2016Docker_1519934437898_19158/WindowsServer2016Docker-disk001.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /Users/bitbear/.vagrant.d/boxes/windows_2016_docker/0/virtualbox/box.ovf...
OK.
0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Appliance import failed
VBoxManage: error: Could not open the medium storage unit '/Users/bitbear/.vagrant.d/boxes/windows_2016_docker/0/virtualbox/WindowsServer2016Docker-disk001.vmdk'.
VBoxManage: error: VMDK: error reading the magic number in '/Users/bitbear/.vagrant.d/boxes/windows_2016_docker/0/virtualbox/WindowsServer2016Docker-disk001.vmdk' (VERR_EOF).
VBoxManage: error: VD: error VERR_VD_VMDK_INVALID_HEADER opening image file '/Users/bitbear/.vagrant.d/boxes/windows_2016_docker/0/virtualbox/WindowsServer2016Docker-disk001.vmdk' (VERR_VD_VMDK_INVALID_HEADER)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component ApplianceWrap, interface IAppliance
VBoxManage: error: Context: "RTEXITCODE handleImportAppliance(HandlerArg *)" at line 886 of file VBoxManageAppliance.cpp

When I inspect the file /Users/bitbear/.vagrant.d/boxes/windows_2016_docker/0/virtualbox/WindowsServer2016Docker-disk001.vmdk, it is indeed an empty file of 0 bytes in size. Any ideas what might be causing this and how I can fix it?

Improve preparation of windows_10 box to reduce CPU load after vagrant up

I have a fresh windows_10 box created this week to have latest updates for Meltdown + Spectre installed.

But after a vagrant up my fan turns on and I can see high CPU usage in the Windows 10 VM.
I have spotted the process mscorsvw.exe which is doing some .NET runtime optimizations.
We should do that during the Packer build to have this "cached" in the Vagrant basebox.

For some windows_2016_docker.json template I also added a helper script wait-for-tiworker.ps1 as the win-updates.ps1 doesn't seem to wait for all the updates installed.

windows_10.json gets stuck on install screen

I am trying to work it out, but when I run the build_windows10.ps1, it gets stuck on the first screen. Where the user selects the language. If you just click continue, the rest of it runs fine.

You having this issue? Thinking of putting in some keystrokes in there, such as "< enter >"

win-updates.ps1 disappeared during windows_10 build

I'm trying to automate the packer builds with Jenkins. In one packer build --only hyperv-iso windows_10.json I looked into the VM and no win-updates.ps1 script was running. So I started a:\win-updates.ps1 again.

[windows_10]     hyperv-iso: 02/01/2018  09:31 AM            10,625 win-updates.log
[windows_10]     hyperv-iso:                1 File(s)         10,625 bytes
[windows_10]     hyperv-iso:                0 Dir(s)  49,802,006,528 bytes free
[windows_10]     hyperv-iso: 2018-02-01T05:55:25 Checking For Windows Updates
[windows_10]     hyperv-iso: 2018-02-01T05:55:26 Script: A:\win-updates.ps1
[windows_10]     hyperv-iso: Script User: VAGRANT-10\vagrant
[windows_10]     hyperv-iso: Started: 2/1/2018 5:55:26 AM
[windows_10]     hyperv-iso: 2018-02-01T05:55:55 There are 6 more updates.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 True
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Microsoft Silverlight (KB4023307)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Microsoft Silverlight is a Web browser plug-in for Windows and Mac OS X that delivers high quality video/audio, animation, and richer Website experiences in popular Web browsers.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Update for Windows 10 Version 1709 for x64-based Systems (KB4058043)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 True
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 2018-01 Security Update for Adobe Flash Player for Windows 10 Version 1709 for x64-based Systems (KB4056887)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 True
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2, 2016 x64 Edition - January 2018 (KB890830)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 After the download, this tool runs one time to check your computer for infection by specific, prevalent malicious software (including Blaster, Sasser, and Mydoom) and helps remove any infection that is found. If an infection is found, the tool will display a status report the next time that you start your computer. A new version of the tool will be offered every month. If you want to manually run the tool on your computer, you can download a copy from the Microsoft Download Center, or you can run an online version from microsoft.com. This tool is not a replacement for an antivirus product. To help protect your computer, you should use an antivirus product.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 True
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.610.0)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Install this update to revise the definition files that are used to detect viruses, spyware, and other potentially unwanted software. Once you have installed this item, it cannot be removed.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 False
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 True
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Evaluating Available Updates with limit of 500:
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Adding: 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 > Note: Microsoft Silverlight (KB4023307) has a license agreement that must be accepted. Accepting the license.
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Adding: Microsoft Silverlight (KB4023307)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Adding: Update for Windows 10 Version 1709 for x64-based Systems (KB4058043)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Adding: 2018-01 Security Update for Adobe Flash Player for Windows 10 Version 1709 for x64-based Systems (KB4056887)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Adding: Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2, 2016 x64 Edition - January 2018 (KB890830)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Adding: Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.610.0)
[windows_10]     hyperv-iso: 2018-02-01T05:55:56 Downloading Updates...
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 The following updates are downloaded and ready to be installed:
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 > 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 > Microsoft Silverlight (KB4023307)
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 > Update for Windows 10 Version 1709 for x64-based Systems (KB4058043)
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 > 2018-01 Security Update for Adobe Flash Player for Windows 10 Version 1709 for x64-based Systems (KB4056887)
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 > Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2, 2016 x64 Edition - January 2018 (KB890830)
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 > Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.610.0)
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 These updates may require a reboot
[windows_10]     hyperv-iso: 2018-02-01T05:59:12 Installing updates...
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Installation Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Reboot Required: True
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Listing of updates installed and individual installation results:
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Item: 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Item: Microsoft Silverlight (KB4023307)
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Item: Update for Windows 10 Version 1709 for x64-based Systems (KB4058043)
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Item: 2018-01 Security Update for Adobe Flash Player for Windows 10 Version 1709 for x64-based Systems (KB4056887)
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Item: Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2, 2016 x64 Edition - January 2018 (KB890830)
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Item: Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.610.0)
[windows_10]     hyperv-iso: 2018-02-01T06:09:53 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T06:09:55 Restart Registry Entry Does Not Exist - Creating It
[windows_10]     hyperv-iso: 2018-02-01T06:09:55 Restart Required - Restarting...

After a while I RDP'ed into my Jenkins build agent and opened the Hyper-V Manager to look into the Windows 10 VM and no win-updates.ps1 script was running. So I started a:\win-updates.ps1 again.

[windows_10]     hyperv-iso: 2018-02-01T09:08:55 Checking For Windows Updates
[windows_10]     hyperv-iso: 2018-02-01T09:08:55 Script: A:\win-updates.ps1
[windows_10]     hyperv-iso: Script User: VAGRANT-10\vagrant
[windows_10]     hyperv-iso: Started: 2/1/2018 9:08:55 AM
[windows_10]     hyperv-iso: 2018-02-01T09:09:13 There are 2 more updates.
[windows_10]     hyperv-iso: 2018-02-01T09:09:13 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T09:09:13 Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.
[windows_10]     hyperv-iso: 2018-02-01T09:09:13 True
[windows_10]     hyperv-iso: 2018-02-01T09:09:14 True
[windows_10]     hyperv-iso: 2018-02-01T09:09:14 Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.632.0)
[windows_10]     hyperv-iso: 2018-02-01T09:09:14 Install this update to revise the definition files that are used to detect viruses, spyware, and other potentially unwanted software. Once you have installed this item, it cannot be removed.
[windows_10]     hyperv-iso: 2018-02-01T09:09:14 False
[windows_10]     hyperv-iso: 2018-02-01T09:09:14 True
[windows_10]     hyperv-iso: 2018-02-01T09:09:15 Evaluating Available Updates with limit of 500:
[windows_10]     hyperv-iso: 2018-02-01T09:09:15 Adding: Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.632.0)
[windows_10]     hyperv-iso: 2018-02-01T09:09:15 Downloading Updates...
[windows_10]     hyperv-iso: 2018-02-01T09:09:35 The following updates are downloaded and ready to be installed:
[windows_10]     hyperv-iso: 2018-02-01T09:09:35 > 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T09:09:35 > Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.632.0)
[windows_10]     hyperv-iso: 2018-02-01T09:09:35 These updates may require a reboot
[windows_10]     hyperv-iso: 2018-02-01T09:09:35 Installing updates...
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Installation Result: 2
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Reboot Required: True
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Listing of updates installed and individual installation results:
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Item: 2017-12 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4054517)
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Item: Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.261.632.0)
[windows_10]     hyperv-iso: 2018-02-01T09:10:14 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T09:10:15 Restart Registry Entry Exists Already
[windows_10]     hyperv-iso: 2018-02-01T09:10:15 Restart Required - Restarting...
[windows_10]     hyperv-iso: 2018-02-01T09:16:10 Checking For Windows Updates
[windows_10]     hyperv-iso: 2018-02-01T09:16:11 Script: A:\win-updates.ps1
[windows_10]     hyperv-iso: Script User: VAGRANT-10\vagrant
[windows_10]     hyperv-iso: Started: 2/1/2018 9:16:11 AM
[windows_10]     hyperv-iso: 2018-02-01T09:16:24 There are 1 more updates.
[windows_10]     hyperv-iso: 2018-02-01T09:16:24 2018-01 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4056892)
[windows_10]     hyperv-iso: 2018-02-01T09:16:24 Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.
[windows_10]     hyperv-iso: 2018-02-01T09:16:24 False
[windows_10]     hyperv-iso: 2018-02-01T09:16:24 True
[windows_10]     hyperv-iso: 2018-02-01T09:16:25 Evaluating Available Updates with limit of 500:
[windows_10]     hyperv-iso: 2018-02-01T09:16:25 Adding: 2018-01 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4056892)
[windows_10]     hyperv-iso: 2018-02-01T09:16:25 Downloading Updates...
[windows_10]     hyperv-iso: 2018-02-01T09:20:07 The following updates are downloaded and ready to be installed:
[windows_10]     hyperv-iso: 2018-02-01T09:20:10 > 2018-01 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4056892)
[windows_10]     hyperv-iso: 2018-02-01T09:20:10 These updates may require a reboot
[windows_10]     hyperv-iso: 2018-02-01T09:20:10 Installing updates...
[windows_10]     hyperv-iso: 2018-02-01T09:26:26 Installation Result: 2
[windows_10]     hyperv-iso: 2018-02-01T09:26:26 Reboot Required: True
[windows_10]     hyperv-iso: 2018-02-01T09:26:26 Listing of updates installed and individual installation results:
[windows_10]     hyperv-iso: 2018-02-01T09:26:26 Item: 2018-01 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4056892)
[windows_10]     hyperv-iso: 2018-02-01T09:26:26 Result: 2
[windows_10]     hyperv-iso: 2018-02-01T09:26:27 Restart Registry Entry Exists Already
[windows_10]     hyperv-iso: 2018-02-01T09:26:27 Restart Required - Restarting...
[windows_10]     hyperv-iso: 2018-02-01T09:31:29 Checking For Windows Updates
[windows_10]     hyperv-iso: 2018-02-01T09:31:30 Script: A:\win-updates.ps1
[windows_10]     hyperv-iso: Script User: VAGRANT-10\vagrant
[windows_10]     hyperv-iso: Started: 2/1/2018 9:31:30 AM
[windows_10]     hyperv-iso: 2018-02-01T09:31:41 There are no applicable updates
[windows_10]     hyperv-iso: 2018-02-01T09:31:42 Restart Registry Entry Exists - Removing It
[windows_10]     hyperv-iso: 2018-02-01T09:31:42 No Restart Required
[windows_10]     hyperv-iso: 2018-02-01T09:31:42 Checking For Windows Updates
[windows_10]     hyperv-iso: 2018-02-01T09:31:42 Script: A:\win-updates.ps1
[windows_10]     hyperv-iso: Script User: VAGRANT-10\vagrant
[windows_10]     hyperv-iso: Started: 2/1/2018 9:31:42 AM
[windows_10]     hyperv-iso: 2018-02-01T09:31:47 There are no applicable updates
[windows_10]     hyperv-iso: 2018-02-01T09:31:47 Done Installing Windows Updates
[windows_10]     hyperv-iso: End of Windows Updates log file C:\Windows\Temp\win-updates.log

I have to check what went wrong in the script and why it didn't start again after the reboot.

Reintroduce SSH to Windows boxes?

With the problem in #83 to mount the shared folder for some Serverspec tests in a Jenkins build agent environment I also tried another option.

I changed the default shared folder to an rsync synced folder

config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"

But then the next Jenkins build aborts with an error. Oh man, of course, the Windows VM does not have SSH and rsync installed. ๐Ÿ˜…

[windows_2016_docker]     tst: Setting VM Integration Services
[windows_2016_docker]     tst: Successfully imported a VM with name: WindowsServer2016Docker
[windows_2016_docker] ==> tst: Starting the machine...
[windows_2016_docker] ==> tst: Waiting for the machine to report its IP address...
[windows_2016_docker]     tst: Timeout: 120 seconds
[windows_2016_docker]     tst: IP: 192.168.0.11
[windows_2016_docker] ==> tst: Waiting for machine to boot. This may take a few minutes...
[windows_2016_docker]     tst: WinRM address: 192.168.0.11:5985
[windows_2016_docker]     tst: WinRM username: vagrant
[windows_2016_docker]     tst: WinRM execution_time_limit: PT2H
[windows_2016_docker]     tst: WinRM transport: negotiate
[windows_2016_docker] ==> tst: Machine booted and ready!
[windows_2016_docker] ==> tst: Rsyncing folder: /cygdrive/c/Windows/workspace/packer-windows_my-PH7VQTN6RDUL23PJXSNDIGZXF5YME4XP2R3GVKXGJIWL7LIVCX5A/boxtest/ => /vagrant
[windows_2016_docker] ==> tst:   - Exclude: [".vagrant/", ".git/"]
[windows_2016_docker] There was an error when attempting to rsync a synced folder.
[windows_2016_docker] Please inspect the error message below for more info.
[windows_2016_docker] 
[windows_2016_docker] Host path: /cygdrive/c/Windows/workspace/packer-windows_my-PH7VQTN6RDUL23PJXSNDIGZXF5YME4XP2R3GVKXGJIWL7LIVCX5A/boxtest/
[windows_2016_docker] Guest path: /vagrant
[windows_2016_docker] Command: "rsync" "--verbose" "--archive" "--delete" "-z" "--copy-links" "--chmod=ugo=rwX" "--no-perms" "--no-owner" "--no-group" "-e" "ssh -p 22 -o LogLevel=FATAL   -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/demo/.vagrant.d/insecure_private_key'" "--exclude" ".vagrant/" "--exclude" ".git/" "/cygdrive/c/Windows/workspace/packer-windows_my-PH7VQTN6RDUL23PJXSNDIGZXF5YME4XP2R3GVKXGJIWL7LIVCX5A/boxtest/" "[email protected]:/vagrant"
[windows_2016_docker] Error: This rsync lacks old-style --compress due to its external zlib.  Try -zz.
[windows_2016_docker] Continuing without compression.
[windows_2016_docker] 
[windows_2016_docker] rsync: connection unexpectedly closed (0 bytes received so far) [sender]
[windows_2016_docker] rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
[windows_2016_docker] 

Well, the upstream repo still has the (non-Microsoft) OpenSSH as communicator and you also can install an rsync binary. Microsoft's OpenSSH native port has reached 1.0.0 (still not production ready).

2018 - the return of SSH in packer-windows boxes? ๐Ÿ˜‚

Issues during 7zip download on hyperv

Trying to build the Windows 2019 with hyperv, I was getting messages about the connection being forceably closed and the file would not be there run install. I added ' | out-null' inside the " at the end of the second line in vm-guest-tools.bat and that got me past the issue. It successfully created the box after that. It may have just been a local network issue and coincidence that it started working after the change.
Hope this helps someone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.