github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/website/source/docs/builders/hyperv-iso.html.md (about)

     1  ---
     2  description: |
     3      The Hyper-V Packer builder is able to create Hyper-V virtual machines and
     4      export them.
     5  layout: docs
     6  page_title: 'Hyper-V ISO - Builders'
     7  sidebar_current: 'docs-builders-hyperv-iso'
     8  ---
     9  
    10  # Hyper-V Builder (from an ISO)
    11  
    12  Type: `hyperv-iso`
    13  
    14  The Hyper-V Packer builder is able to create [Hyper-V](https://www.microsoft.com/en-us/server-cloud/solutions/virtualization.aspx)
    15  virtual machines and export them, starting from an ISO image.
    16  
    17  The builder builds a virtual machine by creating a new virtual machine
    18  from scratch, booting it, installing an OS, provisioning software within
    19  the OS, then shutting it down. The result of the Hyper-V builder is a directory
    20  containing all the files necessary to run the virtual machine portably.
    21  
    22  ## Basic Example
    23  
    24  Here is a basic example. This example is not functional. It will start the
    25  OS installer but then fail because we don't provide the preseed file for
    26  Ubuntu to self-install. Still, the example serves to show the basic configuration:
    27  
    28  ``` json
    29  {
    30    "type": "hyperv-iso",
    31    "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso",
    32    "iso_checksum": "769474248a3897f4865817446f9a4a53",
    33    "iso_checksum_type": "md5",
    34    "ssh_username": "packer",
    35    "ssh_password": "packer",
    36    "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
    37  }
    38  ```
    39  
    40  It is important to add a `shutdown_command`. By default Packer halts the
    41  virtual machine and the file system may not be sync'd. Thus, changes made in a
    42  provisioner might not be saved.
    43  
    44  ## Configuration Reference
    45  
    46  There are many configuration options available for the Hyper-V builder.
    47  They are organized below into two categories: required and optional. Within
    48  each category, the available options are alphabetized and described.
    49  
    50  In addition to the options listed here, a
    51  [communicator](/docs/templates/communicator.html)
    52  can be configured for this builder.
    53  
    54  ### Required:
    55  
    56  -   `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO
    57      files are so large, this is required and Packer will verify it prior
    58      to booting a virtual machine with the ISO attached. The type of the
    59      checksum is specified with `iso_checksum_type`, documented below.
    60  
    61  -   `iso_checksum_type` (string) - The type of the checksum specified in
    62      `iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or
    63      "sha512" currently. While "none" will skip checksumming, this is not
    64      recommended since ISO files are generally large and corruption does happen
    65      from time to time.
    66  
    67  -   `iso_url` (string) - A URL to the ISO containing the installation image.
    68      This URL can be either an HTTP URL or a file URL (or path to a file).
    69      If this is an HTTP URL, Packer will download iso and cache it between
    70      runs.
    71  
    72  ### Optional:
    73  
    74  -   `boot_command` (array of strings) - This is an array of commands to type
    75      when the virtual machine is first booted. The goal of these commands should
    76      be to type just enough to initialize the operating system installer. Special
    77      keys can be typed as well, and are covered in the section below on the boot
    78      command. If this is not specified, it is assumed the installer will start
    79      itself.
    80  
    81  -   `boot_wait` (string) - The time to wait after booting the initial virtual
    82      machine before typing the `boot_command`. The value of this should be
    83      a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
    84      five seconds and one minute 30 seconds, respectively. If this isn't specified,
    85      the default is 10 seconds.
    86  
    87  -   `cpu` (integer) - The number of cpus the virtual machine should use. If this isn't specified,
    88      the default is 1 cpu.
    89  
    90  -   `disk_size` (integer) - The size, in megabytes, of the hard disk to create
    91      for the VM. By default, this is 40 GB.
    92  
    93  -   `enable_dynamic_memory` (bool) - If true enable dynamic memory for virtual machine.
    94      This defaults to false.
    95  
    96  -   `enable_mac_spoofing` (bool) - If true enable mac spoofing for virtual machine.
    97      This defaults to false.
    98  
    99  -   `enable_secure_boot` (bool) - If true enable secure boot for virtual machine.
   100      This defaults to false.
   101  
   102  -   `enable_virtualization_extensions` (bool) - If true enable virtualization extensions for virtual machine.
   103      This defaults to false. For nested virtualization you need to enable mac spoofing, disable dynamic memory
   104      and have at least 4GB of RAM for virtual machine.
   105  
   106  -   `floppy_files` (array of strings) - A list of files to place onto a floppy
   107      disk that is attached when the VM is booted. This is most useful
   108      for unattended Windows installs, which look for an `Autounattend.xml` file
   109      on removable media. By default, no floppy will be attached. All files
   110      listed in this setting get placed into the root directory of the floppy
   111      and the floppy is attached as the first floppy device. Currently, no
   112      support exists for creating sub-directories on the floppy. Wildcard
   113      characters (`*`, `?`, and `[]`) are allowed. Directory names are also allowed,
   114      which will add all the files found in the directory to the floppy.
   115  
   116  - `floppy_dirs` (array of strings) - A list of directories to place onto
   117      the floppy disk recursively. This is similar to the `floppy_files` option
   118      except that the directory structure is preserved. This is useful for when
   119      your floppy disk includes drivers or if you just want to organize it's
   120      contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
   121      The maximum summary size of all files in the listed directories are the
   122      same as in `floppy_files`.
   123  
   124  -   `generation` (integer) - The Hyper-V generation for the virtual machine. By
   125      default, this is 1. Generation 2 Hyper-V virtual machines do not support
   126      floppy drives. In this scenario use `secondary_iso_images` instead. Hard
   127      drives and dvd drives will also be scsi and not ide.
   128  
   129  -   `guest_additions_mode` (string) - How should guest additions be installed.
   130      If value `attach` then attach iso image with by specified by `guest_additions_path`.
   131      Otherwise guest additions is not installed.
   132  
   133  -   `guest_additions_path` (string) - The path to the iso image for guest additions.
   134  
   135  -   `http_directory` (string) - Path to a directory to serve using an HTTP
   136      server. The files in this directory will be available over HTTP that will
   137      be requestable from the virtual machine. This is useful for hosting
   138      kickstart files and so on. By default this is "", which means no HTTP
   139      server will be started. The address and port of the HTTP server will be
   140      available as variables in `boot_command`. This is covered in more detail
   141      below.
   142  
   143  -   `http_port_min` and `http_port_max` (integer) - These are the minimum and
   144      maximum port to use for the HTTP server started to serve the `http_directory`.
   145      Because Packer often runs in parallel, Packer will choose a randomly available
   146      port in this range to run the HTTP server. If you want to force the HTTP
   147      server to be on one port, make this minimum and maximum port the same.
   148      By default the values are 8000 and 9000, respectively.
   149  
   150  -   `iso_urls` (array of strings) - Multiple URLs for the ISO to download.
   151      Packer will try these in order. If anything goes wrong attempting to download
   152      or while downloading a single URL, it will move on to the next. All URLs
   153      must point to the same file (same checksum). By default this is empty
   154      and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified.
   155  
   156  -   `iso_target_extension` (string) - The extension of the iso file after
   157      download. This defaults to "iso".
   158  
   159  -   `iso_target_path` (string) - The path where the iso should be saved after
   160      download. By default will go in the packer cache, with a hash of the
   161      original filename as its name.
   162  
   163  -   `output_directory` (string) - This is the path to the directory where the
   164      resulting virtual machine will be created. This may be relative or absolute.
   165      If relative, the path is relative to the working directory when `packer`
   166      is executed. This directory must not exist or be empty prior to running the builder.
   167      By default this is "output-BUILDNAME" where "BUILDNAME" is the name
   168      of the build.
   169  
   170  -   `ram_size` (integer) - The size, in megabytes, of the ram to create
   171      for the VM. By default, this is 1 GB.
   172  
   173  -   `secondary_iso_images` (array of strings) - A list of iso paths to attached to a
   174      VM when it is booted. This is most useful for unattended Windows installs, which
   175      look for an `Autounattend.xml` file on removable media. By default, no
   176      secondary iso will be attached.
   177  
   178  -   `shutdown_command` (string) - The command to use to gracefully shut down the machine once all
   179      the provisioning is done. By default this is an empty string, which tells Packer to just
   180      forcefully shut down the machine unless a shutdown command takes place inside script so this may
   181      safely be omitted. If one or more scripts require a reboot it is suggested to leave this blank
   182      since reboots may fail and specify the final shutdown command in your last script.
   183  
   184  -   `shutdown_timeout` (string) - The amount of time to wait after executing
   185      the `shutdown_command` for the virtual machine to actually shut down.
   186      If it doesn't shut down in this time, it is an error. By default, the timeout
   187      is "5m", or five minutes.
   188  
   189  -   `skip_compaction` (bool) - If true skip compacting the hard disk for virtual machine when
   190      exporting. This defaults to false.
   191  
   192  -   `switch_name` (string) - The name of the switch to connect the virtual machine to. Be defaulting
   193      this to an empty string, Packer will try to determine the switch to use by looking for
   194      external switch that is up and running.
   195  
   196  -   `switch_vlan_id` (string) - This is the vlan of the virtual switch's network card.
   197      By default none is set. If none is set then a vlan is not set on the switch's network card.
   198      If this value is set it should match the vlan specified in by `vlan_id`.
   199  
   200  *   `vhd_temp_path` (string) - A separate path to be used for storing the VM's
   201      disk image. The purpose is to enable reading and writing to take place on
   202      different physical disks (read from VHD temp path, write to regular temp
   203      path while exporting the VM) to eliminate a single-disk bottleneck.
   204  
   205  -   `vlan_id` (string) - This is the vlan of the virtual machine's network card
   206      for the new virtual machine. By default none is set. If none is set then
   207      vlans are not set on the virtual machine's network card.
   208  
   209  -   `vm_name` (string) - This is the name of the virtual machine for the new virtual
   210      machine, without the file extension. By default this is "packer-BUILDNAME",
   211      where "BUILDNAME" is the name of the build.
   212  
   213  -   `temp_path` (string) - This is the temporary path in which Packer will create the virtual
   214      machine. Default value is system `%temp%`
   215  
   216  ## Boot Command
   217  
   218  The `boot_command` configuration is very important: it specifies the keys
   219  to type when the virtual machine is first booted in order to start the
   220  OS installer. This command is typed after `boot_wait`, which gives the
   221  virtual machine some time to actually load the ISO.
   222  
   223  As documented above, the `boot_command` is an array of strings. The
   224  strings are all typed in sequence. It is an array only to improve readability
   225  within the template.
   226  
   227  The boot command is "typed" character for character over the virtual keyboard
   228  to the machine, simulating a human actually typing the keyboard. There are
   229  a set of special keys available. If these are in your boot command, they
   230  will be replaced by the proper key:
   231  
   232  -   `<bs>` - Backspace
   233  
   234  -   `<del>` - Delete
   235  
   236  -   `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress.
   237  
   238  -   `<esc>` - Simulates pressing the escape key.
   239  
   240  -   `<tab>` - Simulates pressing the tab key.
   241  
   242  -   `<f1>` - `<f12>` - Simulates pressing a function key.
   243  
   244  -   `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key.
   245  
   246  -   `<spacebar>` - Simulates pressing the spacebar.
   247  
   248  -   `<insert>` - Simulates pressing the insert key.
   249  
   250  -   `<home>` `<end>` - Simulates pressing the home and end keys.
   251  
   252  -   `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
   253  
   254  -   `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
   255  
   256  -   `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
   257  
   258  -   `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
   259  
   260  -   `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
   261  
   262  -   `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
   263  
   264  -   `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
   265  
   266  -   `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
   267  
   268  -   `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
   269  
   270  -   `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
   271  
   272  -   `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
   273      sending any additional keys. This is useful if you have to generally wait
   274      for the UI to update before typing more.
   275  
   276  When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `<leftCtrlOn>c<leftCtrlOff>`.
   277  
   278  In addition to the special keys, each command to type is treated as a
   279  [template engine](/docs/templates/engine.html).
   280  The available variables are:
   281  
   282  -   `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server
   283      that is started serving the directory specified by the `http_directory`
   284      configuration parameter. If `http_directory` isn't specified, these will
   285      be blank!
   286  
   287  Example boot command. This is actually a working boot command used to start
   288  an Ubuntu 12.04 installer:
   289  
   290  ``` json
   291  [
   292    "<esc><esc><enter><wait>",
   293    "/install/vmlinuz noapic ",
   294    "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
   295    "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
   296    "hostname={{ .Name }} ",
   297    "fb=false debconf/frontend=noninteractive ",
   298    "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
   299    "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
   300    "initrd=/install/initrd.gz -- <enter>"
   301  ]
   302  ```
   303  
   304  ## Integration Services
   305  
   306  Packer will automatically attach the integration services iso as a dvd drive
   307  for the version of Hyper-V that is running.
   308  
   309  ## Generation 1 vs Generation 2
   310  
   311  Floppy drives are no longer supported by generation 2 machines. This requires you to
   312  take another approach when dealing with preseed or answer files. Two possible options
   313  are using virtual dvd drives or using the built in web server.
   314  
   315  When dealing with Windows you need to enable UEFI drives for generation 2 virtual machines.
   316  
   317  ## Creating iso from directory
   318  
   319  Programs like mkisofs can be used to create an iso from a directory.
   320  There is a [windows version of mkisofs](http://opensourcepack.blogspot.co.uk/p/cdrtools.html).
   321  
   322  Example powershell script. This is an actually working powershell script used to create a Windows answer iso:
   323  
   324  ``` powershell
   325  $isoFolder = "answer-iso"
   326  if (test-path $isoFolder){
   327    remove-item $isoFolder -Force -Recurse
   328  }
   329  
   330  if (test-path windows\windows-2012R2-serverdatacenter-amd64\answer.iso){
   331    remove-item windows\windows-2012R2-serverdatacenter-amd64\answer.iso -Force
   332  }
   333  
   334  mkdir $isoFolder
   335  
   336  copy windows\windows-2012R2-serverdatacenter-amd64\Autounattend.xml $isoFolder\
   337  copy windows\windows-2012R2-serverdatacenter-amd64\sysprep-unattend.xml $isoFolder\
   338  copy windows\common\set-power-config.ps1 $isoFolder\
   339  copy windows\common\microsoft-updates.ps1 $isoFolder\
   340  copy windows\common\win-updates.ps1 $isoFolder\
   341  copy windows\common\run-sysprep.ps1 $isoFolder\
   342  copy windows\common\run-sysprep.cmd $isoFolder\
   343  
   344  $textFile = "$isoFolder\Autounattend.xml"
   345  
   346  $c = Get-Content -Encoding UTF8 $textFile
   347  
   348  # Enable UEFI and disable Non EUFI
   349  $c | % { $_ -replace '<!-- Start Non UEFI -->','<!-- Start Non UEFI' } | % { $_ -replace '<!-- Finish Non UEFI -->','Finish Non UEFI -->' } | % { $_ -replace '<!-- Start UEFI compatible','<!-- Start UEFI compatible -->' } | % { $_ -replace 'Finish UEFI compatible -->','<!-- Finish UEFI compatible -->' } | sc -Path $textFile
   350  
   351  & .\mkisofs.exe -r -iso-level 4 -UDF -o windows\windows-2012R2-serverdatacenter-amd64\answer.iso $isoFolder
   352  
   353  if (test-path $isoFolder){
   354    remove-item $isoFolder -Force -Recurse
   355  }
   356  ```
   357  
   358  ## Example For Windows Server 2012 R2 Generation 2
   359  
   360  Packer config:
   361  
   362  ``` json
   363  {
   364    "builders": [
   365      {
   366        "vm_name":"windows2012r2",
   367        "type": "hyperv-iso",
   368        "disk_size": 61440,
   369        "floppy_files": [],
   370        "secondary_iso_images": [
   371          "./windows/windows-2012R2-serverdatacenter-amd64/answer.iso"
   372        ],
   373        "http_directory": "./windows/common/http/",
   374        "boot_wait": "0s",
   375        "boot_command": [
   376          "a<wait>a<wait>a"
   377        ],
   378        "iso_url": "http://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO",
   379        "iso_checksum_type": "md5",
   380        "iso_checksum": "458ff91f8abc21b75cb544744bf92e6a",
   381        "communicator":"winrm",
   382        "winrm_username": "vagrant",
   383        "winrm_password": "vagrant",
   384        "winrm_timeout" : "4h",
   385        "shutdown_command": "f:\\run-sysprep.cmd",
   386        "ram_size": 4096,
   387        "cpu": 4,
   388        "generation": 2,
   389        "switch_name":"LAN",
   390        "enable_secure_boot":true
   391      }
   392    ],
   393    "provisioners": [
   394      {
   395        "type": "powershell",
   396        "elevated_user":"vagrant",
   397        "elevated_password":"vagrant",
   398        "scripts": [
   399          "./windows/common/install-7zip.ps1",
   400          "./windows/common/install-chef.ps1",
   401          "./windows/common/compile-dotnet-assemblies.ps1",
   402          "./windows/common/cleanup.ps1",
   403          "./windows/common/ultradefrag.ps1",
   404          "./windows/common/sdelete.ps1"
   405        ]
   406      }
   407    ],
   408    "post-processors": [
   409      {
   410        "type": "vagrant",
   411        "keep_input_artifact": false,
   412        "output": "{{.Provider}}_windows-2012r2_chef.box"
   413      }
   414    ]
   415  }
   416  ```
   417  
   418  autounattend.xml:
   419  
   420  ``` xml
   421  <?xml version="1.0" encoding="utf-8"?>
   422  <unattend xmlns="urn:schemas-microsoft-com:unattend">
   423      <settings pass="windowsPE">
   424          <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   425              <SetupUILanguage>
   426                  <UILanguage>en-US</UILanguage>
   427              </SetupUILanguage>
   428              <InputLocale>en-US</InputLocale>
   429              <SystemLocale>en-US</SystemLocale>
   430              <UILanguage>en-US</UILanguage>
   431              <UILanguageFallback>en-US</UILanguageFallback>
   432              <UserLocale>en-US</UserLocale>
   433          </component>
   434          <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   435              <!-- Start Non UEFI -->
   436              <DiskConfiguration>
   437                  <Disk wcm:action="add">
   438                      <CreatePartitions>
   439                          <CreatePartition wcm:action="add">
   440                              <Type>Primary</Type>
   441                              <Order>1</Order>
   442                              <Size>350</Size>
   443                          </CreatePartition>
   444                          <CreatePartition wcm:action="add">
   445                              <Order>2</Order>
   446                              <Type>Primary</Type>
   447                              <Extend>true</Extend>
   448                          </CreatePartition>
   449                      </CreatePartitions>
   450                      <ModifyPartitions>
   451                          <ModifyPartition wcm:action="add">
   452                              <Active>true</Active>
   453                              <Format>NTFS</Format>
   454                              <Label>boot</Label>
   455                              <Order>1</Order>
   456                              <PartitionID>1</PartitionID>
   457                          </ModifyPartition>
   458                          <ModifyPartition wcm:action="add">
   459                              <Format>NTFS</Format>
   460                              <Label>Windows 2012 R2</Label>
   461                              <Letter>C</Letter>
   462                              <Order>2</Order>
   463                              <PartitionID>2</PartitionID>
   464                          </ModifyPartition>
   465                      </ModifyPartitions>
   466                      <DiskID>0</DiskID>
   467                      <WillWipeDisk>true</WillWipeDisk>
   468                  </Disk>
   469              </DiskConfiguration>
   470              <ImageInstall>
   471                  <OSImage>
   472                      <InstallFrom>
   473                          <MetaData wcm:action="add">
   474                              <Key>/IMAGE/NAME </Key>
   475                              <Value>Windows Server 2012 R2 SERVERSTANDARD</Value>
   476                          </MetaData>
   477                      </InstallFrom>
   478                      <InstallTo>
   479                          <DiskID>0</DiskID>
   480                          <PartitionID>2</PartitionID>
   481                      </InstallTo>
   482                  </OSImage>
   483              </ImageInstall>
   484              <!-- Finish Non UEFI -->
   485              <!-- Start UEFI compatible
   486              <DiskConfiguration>
   487                  <Disk wcm:action="add">
   488                      <CreatePartitions>
   489                          <CreatePartition wcm:action="add">
   490                              <Order>1</Order>
   491                              <Size>300</Size>
   492                              <Type>Primary</Type>
   493                          </CreatePartition>
   494                          <CreatePartition wcm:action="add">
   495                              <Order>2</Order>
   496                              <Size>100</Size>
   497                              <Type>EFI</Type>
   498                          </CreatePartition>
   499                          <CreatePartition wcm:action="add">
   500                              <Order>3</Order>
   501                              <Size>128</Size>
   502                              <Type>MSR</Type>
   503                          </CreatePartition>
   504                          <CreatePartition wcm:action="add">
   505                              <Order>4</Order>
   506                              <Extend>true</Extend>
   507                              <Type>Primary</Type>
   508                          </CreatePartition>
   509                      </CreatePartitions>
   510                      <ModifyPartitions>
   511                          <ModifyPartition wcm:action="add">
   512                              <Order>1</Order>
   513                              <PartitionID>1</PartitionID>
   514                              <Label>WINRE</Label>
   515                              <Format>NTFS</Format>
   516                              <TypeID>de94bba4-06d1-4d40-a16a-bfd50179d6ac</TypeID>
   517                          </ModifyPartition>
   518                          <ModifyPartition wcm:action="add">
   519                              <Order>2</Order>
   520                              <PartitionID>2</PartitionID>
   521                              <Label>System</Label>
   522                              <Format>FAT32</Format>
   523                          </ModifyPartition>
   524                          <ModifyPartition wcm:action="add">
   525                              <Order>3</Order>
   526                              <PartitionID>3</PartitionID>
   527                          </ModifyPartition>
   528                          <ModifyPartition wcm:action="add">
   529                              <Order>4</Order>
   530                              <PartitionID>4</PartitionID>
   531                              <Label>Windows</Label>
   532                              <Format>NTFS</Format>
   533                          </ModifyPartition>
   534                      </ModifyPartitions>
   535                      <DiskID>0</DiskID>
   536                      <WillWipeDisk>true</WillWipeDisk>
   537                  </Disk>
   538                  <WillShowUI>OnError</WillShowUI>
   539              </DiskConfiguration>
   540              <ImageInstall>
   541                  <OSImage>
   542                      <InstallFrom>
   543                          <MetaData wcm:action="add">
   544                              <Key>/IMAGE/NAME </Key>
   545                              <Value>Windows Server 2012 R2 SERVERSTANDARD</Value>
   546                          </MetaData>
   547                      </InstallFrom>
   548                      <InstallTo>
   549                          <DiskID>0</DiskID>
   550                          <PartitionID>4</PartitionID>
   551                      </InstallTo>
   552                  </OSImage>
   553              </ImageInstall>
   554              Finish UEFI compatible -->
   555              <UserData>
   556                  <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
   557                  <ProductKey>
   558                      <!-- Do not uncomment the Key element if you are using trial ISOs -->
   559                      <!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs -->
   560                      <!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>-->
   561                      <WillShowUI>OnError</WillShowUI>
   562                  </ProductKey>
   563                  <AcceptEula>true</AcceptEula>
   564                  <FullName>Vagrant</FullName>
   565                  <Organization>Vagrant</Organization>
   566              </UserData>
   567          </component>
   568      </settings>
   569      <settings pass="specialize">
   570          <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   571              <OEMInformation>
   572                  <HelpCustomized>false</HelpCustomized>
   573              </OEMInformation>
   574              <ComputerName>vagrant-2012r2</ComputerName>
   575              <TimeZone>Coordinated Universal Time</TimeZone>
   576              <RegisteredOwner />
   577          </component>
   578          <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   579              <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
   580          </component>
   581          <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   582              <IEHardenAdmin>false</IEHardenAdmin>
   583              <IEHardenUser>false</IEHardenUser>
   584          </component>
   585          <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   586              <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
   587          </component>
   588          <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   589              <SkipAutoActivation>true</SkipAutoActivation>
   590          </component>
   591      </settings>
   592      <settings pass="oobeSystem">
   593  <!-- Start Setup cache proxy during installation
   594          <component name="Microsoft-Windows-IE-ClientNetworkProtocolImplementation" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   595              <POLICYProxySettingsPerUser>0</POLICYProxySettingsPerUser>
   596              <HKLMProxyEnable>true</HKLMProxyEnable>
   597              <HKLMProxyServer>cache-proxy:3142</HKLMProxyServer>
   598          </component>
   599  Finish Setup cache proxy during installation -->
   600          <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   601              <AutoLogon>
   602                  <Password>
   603                      <Value>vagrant</Value>
   604                      <PlainText>true</PlainText>
   605                  </Password>
   606                  <Enabled>true</Enabled>
   607                  <Username>vagrant</Username>
   608              </AutoLogon>
   609              <FirstLogonCommands>
   610                  <SynchronousCommand wcm:action="add">
   611                      <CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
   612                      <Description>Set Execution Policy 64 Bit</Description>
   613                      <Order>1</Order>
   614                      <RequiresUserInput>true</RequiresUserInput>
   615                  </SynchronousCommand>
   616                  <SynchronousCommand wcm:action="add">
   617                      <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
   618                      <Description>Set Execution Policy 32 Bit</Description>
   619                      <Order>2</Order>
   620                      <RequiresUserInput>true</RequiresUserInput>
   621                  </SynchronousCommand>
   622                  <SynchronousCommand wcm:action="add">
   623                      <CommandLine>cmd.exe /c winrm quickconfig -q</CommandLine>
   624                      <Description>winrm quickconfig -q</Description>
   625                      <Order>3</Order>
   626                      <RequiresUserInput>true</RequiresUserInput>
   627                  </SynchronousCommand>
   628                  <SynchronousCommand wcm:action="add">
   629                      <CommandLine>cmd.exe /c winrm quickconfig -transport:http</CommandLine>
   630                      <Description>winrm quickconfig -transport:http</Description>
   631                      <Order>4</Order>
   632                      <RequiresUserInput>true</RequiresUserInput>
   633                  </SynchronousCommand>
   634                  <SynchronousCommand wcm:action="add">
   635                      <CommandLine>cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}</CommandLine>
   636                      <Description>Win RM MaxTimoutms</Description>
   637                      <Order>5</Order>
   638                      <RequiresUserInput>true</RequiresUserInput>
   639                  </SynchronousCommand>
   640                  <SynchronousCommand wcm:action="add">
   641                      <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}</CommandLine>
   642                      <Description>Win RM MaxMemoryPerShellMB</Description>
   643                      <Order>6</Order>
   644                      <RequiresUserInput>true</RequiresUserInput>
   645                  </SynchronousCommand>
   646                  <SynchronousCommand wcm:action="add">
   647                      <CommandLine>cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}</CommandLine>
   648                      <Description>Win RM AllowUnencrypted</Description>
   649                      <Order>7</Order>
   650                      <RequiresUserInput>true</RequiresUserInput>
   651                  </SynchronousCommand>
   652                  <SynchronousCommand wcm:action="add">
   653                      <CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}</CommandLine>
   654                      <Description>Win RM auth Basic</Description>
   655                      <Order>8</Order>
   656                      <RequiresUserInput>true</RequiresUserInput>
   657                  </SynchronousCommand>
   658                  <SynchronousCommand wcm:action="add">
   659                      <CommandLine>cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}</CommandLine>
   660                      <Description>Win RM client auth Basic</Description>
   661                      <Order>9</Order>
   662                      <RequiresUserInput>true</RequiresUserInput>
   663                  </SynchronousCommand>
   664                  <SynchronousCommand wcm:action="add">
   665                      <CommandLine>cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} </CommandLine>
   666                      <Description>Win RM listener Address/Port</Description>
   667                      <Order>10</Order>
   668                      <RequiresUserInput>true</RequiresUserInput>
   669                  </SynchronousCommand>
   670                  <SynchronousCommand wcm:action="add">
   671                      <CommandLine>cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes </CommandLine>
   672                      <Description>Win RM adv firewall enable</Description>
   673                      <Order>11</Order>
   674                      <RequiresUserInput>true</RequiresUserInput>
   675                  </SynchronousCommand>
   676                  <SynchronousCommand wcm:action="add">
   677                      <CommandLine>cmd.exe /c netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow</CommandLine>
   678                      <Description>Win RM port open</Description>
   679                      <Order>12</Order>
   680                      <RequiresUserInput>true</RequiresUserInput>
   681                  </SynchronousCommand>
   682                  <SynchronousCommand wcm:action="add">
   683                      <CommandLine>cmd.exe /c netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow</CommandLine>
   684                      <Description>Win RM port open</Description>
   685                      <Order>13</Order>
   686                      <RequiresUserInput>true</RequiresUserInput>
   687                  </SynchronousCommand>
   688                  <SynchronousCommand wcm:action="add">
   689                      <CommandLine>cmd.exe /c net stop winrm </CommandLine>
   690                      <Description>Stop Win RM Service </Description>
   691                      <Order>14</Order>
   692                      <RequiresUserInput>true</RequiresUserInput>
   693                  </SynchronousCommand>
   694                  <SynchronousCommand wcm:action="add">
   695                      <CommandLine>cmd.exe /c sc config winrm start= disabled</CommandLine>
   696                      <Description>Win RM Autostart</Description>
   697                      <Order>15</Order>
   698                      <RequiresUserInput>true</RequiresUserInput>
   699                  </SynchronousCommand>
   700                  <SynchronousCommand wcm:action="add">
   701                      <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine>
   702                      <Order>16</Order>
   703                      <Description>Show file extensions in Explorer</Description>
   704                  </SynchronousCommand>
   705                  <SynchronousCommand wcm:action="add">
   706                      <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine>
   707                      <Order>17</Order>
   708                      <Description>Enable QuickEdit mode</Description>
   709                  </SynchronousCommand>
   710                  <SynchronousCommand wcm:action="add">
   711                      <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine>
   712                      <Order>18</Order>
   713                      <Description>Show Run command in Start Menu</Description>
   714                  </SynchronousCommand>
   715                  <SynchronousCommand wcm:action="add">
   716                      <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine>
   717                      <Order>19</Order>
   718                      <Description>Show Administrative Tools in Start Menu</Description>
   719                  </SynchronousCommand>
   720                  <SynchronousCommand wcm:action="add">
   721                      <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine>
   722                      <Order>20</Order>
   723                      <Description>Zero Hibernation File</Description>
   724                  </SynchronousCommand>
   725                  <SynchronousCommand wcm:action="add">
   726                      <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine>
   727                      <Order>21</Order>
   728                      <Description>Disable Hibernation Mode</Description>
   729                  </SynchronousCommand>
   730                  <SynchronousCommand wcm:action="add">
   731                      <CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine>
   732                      <Order>22</Order>
   733                      <Description>Disable password expiration for vagrant user</Description>
   734                  </SynchronousCommand>
   735                  <SynchronousCommand wcm:action="add">
   736                      <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxShellsPerUser="30"}</CommandLine>
   737                      <Description>Win RM MaxShellsPerUser</Description>
   738                      <Order>23</Order>
   739                      <RequiresUserInput>true</RequiresUserInput>
   740                  </SynchronousCommand>
   741                  <SynchronousCommand wcm:action="add">
   742                      <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxProcessesPerShell="25"}</CommandLine>
   743                      <Description>Win RM MaxProcessesPerShell</Description>
   744                      <Order>24</Order>
   745                      <RequiresUserInput>true</RequiresUserInput>
   746                  </SynchronousCommand>
   747                  <SynchronousCommand wcm:action="add">
   748                      <CommandLine>%SystemRoot%\System32\reg.exe ADD "HKLM\System\CurrentControlSet\Services\Netlogon\Parameters" /v DisablePasswordChange /t REG_DWORD /d 1 /f</CommandLine>
   749                      <Description>Turn off computer password</Description>
   750                      <Order>25</Order>
   751                  </SynchronousCommand>
   752                  <SynchronousCommand wcm:action="add">
   753                      <CommandLine>cmd.exe /c netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow</CommandLine>
   754                      <Description>ICMP open for ping</Description>
   755                      <Order>26</Order>
   756                      <RequiresUserInput>true</RequiresUserInput>
   757                  </SynchronousCommand>
   758                  <!-- WITH WINDOWS UPDATES -->
   759                  <SynchronousCommand wcm:action="add">
   760                      <CommandLine>cmd.exe /c IF EXIST a:\set-power-config.ps1 (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\set-power-config.ps1) ELSE (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File f:\set-power-config.ps1)</CommandLine>
   761                      <Order>97</Order>
   762                      <Description>Turn off all power saving and timeouts</Description>
   763                      <RequiresUserInput>true</RequiresUserInput>
   764                  </SynchronousCommand>
   765                  <SynchronousCommand wcm:action="add">
   766                      <CommandLine>cmd.exe /c IF EXIST a:\microsoft-updates.ps1 (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\microsoft-updates.ps1) ELSE (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File f:\microsoft-updates.ps1)</CommandLine>
   767                      <Order>98</Order>
   768                      <Description>Enable Microsoft Updates</Description>
   769                      <RequiresUserInput>true</RequiresUserInput>
   770                  </SynchronousCommand>
   771                  <SynchronousCommand wcm:action="add">
   772                      <CommandLine>cmd.exe /c IF EXIST a:\win-updates.ps1 (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1) ELSE (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File f:\win-updates.ps1)</CommandLine>
   773                      <Description>Install Windows Updates</Description>
   774                      <Order>100</Order>
   775                      <RequiresUserInput>true</RequiresUserInput>
   776                  </SynchronousCommand>
   777                  <!-- END WITH WINDOWS UPDATES -->
   778              </FirstLogonCommands>
   779              <OOBE>
   780                  <HideEULAPage>true</HideEULAPage>
   781                  <HideLocalAccountScreen>true</HideLocalAccountScreen>
   782                  <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
   783                  <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
   784                  <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
   785                  <NetworkLocation>Work</NetworkLocation>
   786                  <ProtectYourPC>1</ProtectYourPC>
   787              </OOBE>
   788              <UserAccounts>
   789                  <AdministratorPassword>
   790                      <Value>vagrant</Value>
   791                      <PlainText>true</PlainText>
   792                  </AdministratorPassword>
   793                  <LocalAccounts>
   794                      <LocalAccount wcm:action="add">
   795                          <Password>
   796                              <Value>vagrant</Value>
   797                              <PlainText>true</PlainText>
   798                          </Password>
   799                          <Group>administrators</Group>
   800                          <DisplayName>Vagrant</DisplayName>
   801                          <Name>vagrant</Name>
   802                          <Description>Vagrant User</Description>
   803                      </LocalAccount>
   804                  </LocalAccounts>
   805              </UserAccounts>
   806              <RegisteredOwner />
   807              <TimeZone>Coordinated Universal Time</TimeZone>
   808          </component>
   809      </settings>
   810      <settings pass="offlineServicing">
   811          <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   812              <EnableLUA>false</EnableLUA>
   813          </component>
   814      </settings>
   815      <cpi:offlineImage cpi:source="wim:c:/projects/baseboxes/9600.16384.winblue_rtm.130821-1623_x64fre_server_eval_en-us-irm_sss_x64free_en-us_dv5_slipstream/sources/install.wim#Windows Server 2012 R2 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
   816  </unattend>
   817  ```
   818  
   819  sysprep-unattend.xml:
   820  
   821  ``` text
   822  <?xml version="1.0" encoding="utf-8"?>
   823  <unattend xmlns="urn:schemas-microsoft-com:unattend">
   824      <settings pass="generalize">
   825          <component language="neutral" name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   826              <SkipRearm>1</SkipRearm>
   827          </component>
   828      </settings>
   829      <settings pass="oobeSystem">
   830  <!-- Setup proxy after sysprep
   831         <component name="Microsoft-Windows-IE-ClientNetworkProtocolImplementation" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   832              <POLICYProxySettingsPerUser>1</POLICYProxySettingsPerUser>
   833              <HKLMProxyEnable>false</HKLMProxyEnable>
   834              <HKLMProxyServer>cache-proxy:3142</HKLMProxyServer>
   835          </component>
   836  Finish proxy after sysprep -->
   837          <component language="neutral" name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   838              <InputLocale>0809:00000809</InputLocale>
   839              <SystemLocale>en-GB</SystemLocale>
   840              <UILanguage>en-US</UILanguage>
   841              <UILanguageFallback>en-US</UILanguageFallback>
   842              <UserLocale>en-GB</UserLocale>
   843          </component>
   844          <component language="neutral" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   845              <OOBE>
   846                  <HideEULAPage>true</HideEULAPage>
   847                  <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
   848                  <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
   849                  <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
   850                  <NetworkLocation>Work</NetworkLocation>
   851                  <ProtectYourPC>1</ProtectYourPC>
   852                  <SkipUserOOBE>true</SkipUserOOBE>
   853                  <SkipMachineOOBE>true</SkipMachineOOBE>
   854              </OOBE>
   855              <UserAccounts>
   856                  <AdministratorPassword>
   857                      <Value>vagrant</Value>
   858                      <PlainText>true</PlainText>
   859                  </AdministratorPassword>
   860                  <LocalAccounts>
   861                      <LocalAccount wcm:action="add">
   862                          <Password>
   863                              <Value>vagrant</Value>
   864                              <PlainText>true</PlainText>
   865                          </Password>
   866                          <Group>administrators</Group>
   867                          <DisplayName>Vagrant</DisplayName>
   868                          <Name>vagrant</Name>
   869                          <Description>Vagrant User</Description>
   870                      </LocalAccount>
   871                  </LocalAccounts>
   872              </UserAccounts>
   873              <DisableAutoDaylightTimeSet>true</DisableAutoDaylightTimeSet>
   874              <TimeZone>Coordinated Universal Time</TimeZone>
   875              <VisualEffects>
   876                  <SystemDefaultBackgroundColor>2</SystemDefaultBackgroundColor>
   877              </VisualEffects>
   878          </component>
   879      </settings>
   880  </unattend>
   881  ```
   882  
   883  ## Example For Ubuntu Vivid Generation 2
   884  
   885  If you are running Windows under virtualization, you may need to create
   886  a virtual switch with an `External` connection type.
   887  
   888  ### Packer config:
   889  
   890  ``` json
   891  {
   892    "variables": {
   893      "vm_name": "ubuntu-xenial",
   894      "cpu": "2",
   895      "ram_size": "1024",
   896      "disk_size": "21440",
   897      "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.1-server-amd64.iso",
   898      "iso_checksum_type": "sha1",
   899      "iso_checksum": "DE5EE8665048F009577763EFBF4A6F0558833E59"
   900    },
   901    "builders": [
   902      {
   903        "vm_name":"{{user `vm_name`}}",
   904        "type": "hyperv-iso",
   905        "disk_size": "{{user `disk_size`}}",
   906        "guest_additions_mode": "disable",
   907        "iso_url": "{{user `iso_url`}}",
   908        "iso_checksum_type": "{{user `iso_checksum_type`}}",
   909        "iso_checksum": "{{user `iso_checksum`}}",
   910        "communicator":"ssh",
   911        "ssh_username": "packer",
   912        "ssh_password": "packer",
   913        "ssh_timeout" : "4h",
   914        "http_directory": "./",
   915        "boot_wait": "5s",
   916        "boot_command": [
   917          "<esc><wait10><esc><esc><enter><wait>",
   918          "set gfxpayload=1024x768<enter>",
   919          "linux /install/vmlinuz ",
   920          "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/hyperv-taliesins.cfg ",
   921          "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
   922          "hostname={{.Name}} ",
   923          "fb=false debconf/frontend=noninteractive ",
   924          "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
   925          "keyboard-configuration/variant=USA console-setup/ask_detect=false <enter>",
   926          "initrd /install/initrd.gz<enter>",
   927          "boot<enter>"
   928        ],
   929        "shutdown_command": "echo 'packer' | sudo -S -E shutdown -P now",
   930        "ram_size": "{{user `ram_size`}}",
   931        "cpu": "{{user `cpu`}}",
   932        "generation": 2,
   933        "enable_secure_boot": false
   934      }
   935  ]
   936  }
   937  ```
   938  
   939  ### preseed.cfg:
   940  
   941  ``` text
   942  ## Options to set on the command line
   943  d-i debian-installer/locale string en_US.utf8
   944  d-i console-setup/ask_detect boolean false
   945  d-i console-setup/layout string us
   946  
   947  d-i netcfg/get_hostname string nl-ams-basebox3
   948  d-i netcfg/get_domain string unassigned-domain
   949  
   950  d-i time/zone string UTC
   951  d-i clock-setup/utc-auto boolean true
   952  d-i clock-setup/utc boolean true
   953  
   954  d-i kbd-chooser/method select American English
   955  
   956  d-i netcfg/wireless_wep string
   957  
   958  d-i base-installer/kernel/override-image string linux-server
   959  
   960  d-i debconf debconf/frontend select Noninteractive
   961  
   962  d-i pkgsel/install-language-support boolean false
   963  tasksel tasksel/first multiselect standard, ubuntu-server
   964  
   965  ## Partitioning
   966  d-i partman-auto/method string lvm
   967  
   968  d-i partman-lvm/confirm boolean true
   969  d-i partman-lvm/device_remove_lvm boolean true
   970  d-i partman-lvm/confirm boolean true
   971  
   972  d-i partman-auto-lvm/guided_size string max
   973  d-i partman-auto/choose_recipe select atomic
   974  
   975  d-i partman/confirm_write_new_label boolean true
   976  d-i partman/choose_partition select finish
   977  d-i partman/confirm boolean true
   978  d-i partman/confirm_nooverwrite boolean true
   979  
   980  # Write the changes to disks and configure LVM?
   981  d-i partman-lvm/confirm boolean true
   982  d-i partman-lvm/confirm_nooverwrite boolean true
   983  
   984  d-i partman-partitioning/no_bootable_gpt_biosgrub boolean false
   985  d-i partman-partitioning/no_bootable_gpt_efi boolean false
   986  d-i partman-efi/non_efi_system boolean true
   987  
   988  # Default user
   989  d-i passwd/user-fullname string packer
   990  d-i passwd/username string packer
   991  d-i passwd/user-password password packer
   992  d-i passwd/user-password-again password packer
   993  d-i user-setup/encrypt-home boolean false
   994  d-i user-setup/allow-password-weak boolean true
   995  
   996  # Minimum packages
   997  d-i pkgsel/include string openssh-server ntp linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) linux-cloud-tools-common
   998  
   999  # Upgrade packages after debootstrap? (none, safe-upgrade, full-upgrade)
  1000  # (note: set to none for speed)
  1001  d-i pkgsel/upgrade select none
  1002  
  1003  d-i grub-installer/only_debian boolean true
  1004  d-i grub-installer/with_other_os boolean true
  1005  d-i finish-install/reboot_in_progress note
  1006  
  1007  d-i pkgsel/update-policy select none
  1008  
  1009  choose-mirror-bin mirror/http/proxy string
  1010  ```