Skip to content

Instantly share code, notes, and snippets.

@simon-wenmouth
Last active January 12, 2017 03:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simon-wenmouth/5338708 to your computer and use it in GitHub Desktop.
Save simon-wenmouth/5338708 to your computer and use it in GitHub Desktop.
Windows 7 AIK / veewee / Vagrant

This collection of documents moves forward in three steps

  1. Create Autounattend.xml file(s)
  2. Create base box with veewee
  3. Create box with vagrant

Read the documents in that order, i.e.

  1. WindowsAIK.md
  2. Veewee.md
  3. Vagrant.md

Introduction

These are the steps needed to create a working vagrant environment (windows and ubuntu).

Appendix

Repositories

Vagrant Host Master

This plugin

allows finer control of the /etc/hosts file in linux and is useful for servers with multiple network interfaces.

Introduction

These are the steps needed to create a working vagrant box (basebox) for a windows host.

Introduction

This document is intended to guide you in the creation of an Autounattend.xml file suitable for creation of base box images.

Steps

Step 1: Create a Technician VM

Create a Windows 7 virtual machine

  • 1024 MB RAM
  • 36 GB HDD
  • 64 MB Video Memory
  • 2D Video Acceleration

I named my host w7-aik-61. Run all the windows updates (2 or three restarts).

Duration: 1+ hour (predominately windows updates).

Step 2: Download & Install Virtual Clone Drive

Virtual Clone Drive is an application that provides the capability to mount an ISO file in Windows.

Download and install the program.

Duration: 15 minutes.

Step 3: Download & Install AIK

Use a search engine for

  • The Windows® Automated Installation Kit (AIK) for Windows® 7

The URL at the time of authoring is

The file is called KB3AIK_EN.iso and is 1.7GB in size.

Mount the ISO with Virtual Clone Drive and run StartCD.exe if auto-run does not do so.

In the UI select Windows AIK Setup to install the AIK.

Step 4: Download ISOs

Go to MSDN Subscriber Downloads, currently

and download

  • Windows 7 Ultimate with SP1 x64
    • en_windows_7_ultimate_with_sp1_x64_dvd_618240.iso
  • Windows Server 2012 x64
    • en_windows_server_2012_x64_dvd_915478.iso

Generate and store the product keys in text files with the same name (but different extension) as the related ISO (for future ease of access).

Step 5: Extract WIM file from ISO

The AIK needs a file from each of the ISOs.

  1. Create a folder on the desktop called AIK
  2. Create a sub folder of AIK called Windows 7 Ultimate AMD64
  3. Mount the Windows 7 ISO
  4. Copy D:\sources\install.wim into the AIK\Windows 7 Ultimate AMD64

Repeat for the Windows Server 2012 image with a subfolder name of Windows Server 2012 AMD64.

Step 6: Generate Autounattend.xml

The general outline comes from this article on MSDN

Here are the general steps

Configuration passComponentValue

1 WindowsPE

Microsoft-Windows-International-Core-WinPE

InputLocale = <Input Locale> For example, en-US

SystemLocale = <System Locale> For example, en-US

UILanguage = <UI Language> For example, en-US

UserLocale = <User Locale> For example, en-US

1 WindowsPE

Microsoft-Windows-International-Core-WinPE\SetupUILanguage

UILanguage = <UI Language> For example, en-US

1 WindowsPE

Microsoft-Windows-Setup\DiskConfiguration

WillShowUI = OnError

1 WindowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk

DiskID = 0

WillWipeDisk = true

1 WindowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

Order = 1

Size = 300

Type = Primary

1 WindowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

Extend = true

Order = 2

Type = Primary

1 WindowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

Active = true

Format = NTFS

Label = System

Order = 1

PartitionID = 1

1 WindowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

Format = NTFS

Label = Windows

Order = 2

PartitionID = 2

1 WindowsPE

Microsoft-Windows-Setup\ImageInstall\OSImage

InstallToAvailablePartition = false

WillShowUI = OnError

1 WindowsPE

Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo

DiskID = 0

PartitionID = 2

1 WindowsPE

Microsoft-Windows-Setup\UserData

AcceptEula = true

1 WindowsPE

Microsoft-Windows-Setup\UserData\ProductKey

Key = <product key>

WillShowUI = OnError

4 Specialize

Optional: Microsoft-Windows-IE-InternetExplorer

Home_Page = <Company Home Page>

7 oobeSystem

Microsoft-Windows-Deployment\Reseal

ForceShutdownNow = false

Mode = Audit

7 oobeSystem

Microsoft-Windows-Shell-Setup\OOBE

HideEULAPage = true

ProtectYourPC = 3

I personally find it easier to create/modify the partitions one at a time (completing the information as I go) as changing the order property moves elements in the UI in a somewhat confusing (to myself at least) manner.

The settings needed for an unattended installation are documented here

Additional settings

Configuration Pass Component Value
7 oobeSystem Microsoft-Windows-Shell-Setup/UserAccounts/AdministratorPassword Value = vagrant
7 oobeSystem Microsoft-Windows-Shell-Setup/UserAccounts/LocalAccount Description = Vagrant System Account
DisplayName = Vagrant
Group = administrators
Name = vagrant
7 oobeSystem Microsoft-Windows-Shell-Setup/UserAccounts/LocalAccount[name="vagrant"] Value = vagrant
7 oobeSystem Microsoft-Windows-Shell-Setup/OOBE HideWirelessSetupInOOBE = true
NetworkLocation = work
7 oobeSystem Microsoft-Windows-Shell-Setup/AutoLogon Enabled = true
Username = vagrant
7 oobeSystem Microsoft-Windows-Shell-Setup/AutoLogon/Password Value = vagrant
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm quickconfig -q
Description = winrm quickconfig -q
Order = 1
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm quickconfig -transport:http
Description = winrm quickconfig -transport:http
Order = 2
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
Description = Win RM MaxTimoutms
Order = 3
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
Description = Win RM MaxMemoryPerShellMB
Order = 4
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}
Description = Win RM AllowUnencrypted
Order = 5
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}
Description = Win RM auth Basic
Order = 6
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}
Description = Win RM auth Basic
Order = 7
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
Description = Win RM listener Address/Port
Order = 8
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
Description = Win RM adv firewall enable
Order = 9
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985"
Description = Win RM port open
Order = 10
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c net stop winrm
Description = Stop Win RM Service
Order = 11
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c sc config winrm start= auto
Description = Win RM Autostart
Order = 12
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = cmd.exe /c net start winrm
Description = Start Win RM Service
Order = 13
RequiresUserInput = true
7 oobeSystem Microsoft-Windows-Shell-Setup/FirstLogonCommands/SynchronousCommand CommandLine = powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"
Description = Start Win RM Service
Order = 14
RequiresUserInput = true
4 specialize Microsoft-Windows-Shell-Setup ComputerName = win-7-ult-amd64
RegisteredOwner = Vagrant
TimeZone = Central Standard Time
4 specialize Microsoft-Windows-Shell-Setup/OEMInformation HelpCustomized = false
4 specialize Microsoft-Windows-Security-UX SkipAutoActivation = true
4 specialize Security-Malware-Windows-Defender DisableAntiSpyware = true
3 generalize Microsoft-Windows-Security-SPP SkipRearm = 1
2 offlineServicing Microsoft-Windows-LUA-Settings EnableLUA = false

Appendix

AIK

WinRM

Notes

Location of sysprep is

C:\windows\system32\sysprep\sysprep.exe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment