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