├── 2012r2-parallels.json ├── 2012r2-virtualbox.json ├── LICENSE ├── README.md ├── amazon-sysprep.json ├── answer_files ├── 2008_r2 │ └── Autounattend.xml └── 2012_r2 │ ├── Autounattend.xml │ ├── Autounattend_sysprep.xml │ ├── parallels │ └── Autounattend.xml │ └── updates │ └── Autounattend.xml ├── scripts ├── BundleConfig.ps1 ├── Ec2Config.ps1 ├── cleanup.ps1 ├── cleanup2.ps1 ├── disable-password-complexity.ps1 ├── ec2-bootstrap.ps1 ├── ec2-user-data.ps1 ├── microsoft-updates.bat ├── openssh.ps1 ├── oracle-cert.cer ├── parallels-guest-tools.ps1 ├── provision.ps1 ├── rsync.bat ├── virtualbox-guest-tools.ps1 ├── win-updates.ps1 └── winrmconfig.bat └── vagrantfile-windows_2012_r2.template /2012r2-parallels.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "parallels-windows-iso", 5 | "vm_name": "vagrant-rsync", 6 | "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", 7 | "iso_checksum_type": "md5", 8 | "iso_checksum": "458ff91f8abc21b75cb544744bf92e6a", 9 | "winrm_username": "vagrant", 10 | "winrm_password": "vagrant", 11 | "winrm_wait_timeout": "60m", 12 | "winrm_port":5985, 13 | "headless": false, 14 | "boot_wait": "2m", 15 | "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", 16 | "guest_os_type": "win-8.1", 17 | "parallels_tools_flavor": "win", 18 | "disk_size": 61440, 19 | "floppy_files": [ 20 | "./answer_files/2012_r2/parallels/Autounattend.xml", 21 | "./scripts/microsoft-updates.bat", 22 | "./scripts/win-updates.ps1", 23 | "./scripts/oracle-cert.cer", 24 | "./scripts/disable-password-complexity.ps1" 25 | ], 26 | "prlctl": [ 27 | ["set", "{{.Name}}", "--memsize", "2048"], 28 | ["set", "{{.Name}}", "--cpus", "2"], 29 | ["set", "{{.Name}}", "--winsystray-in-macmenu", "off"], 30 | ["set", "{{.Name}}", "--startup-view", "window"] 31 | ] 32 | }, 33 | { 34 | "type": "parallels-windows-pvm", 35 | "source_path": "./output-parallels-windows-iso/vagrant-rsync.pvm", 36 | "headless": false, 37 | "boot_wait": "30s", 38 | "winrm_username": "vagrant", 39 | "winrm_password": "vagrant", 40 | "winrm_wait_timeout": "5m", 41 | "winrm_port":5985, 42 | "winrm_host":"localhost", 43 | "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", 44 | "shutdown_timeout": "10m", 45 | "parallels_tools_mode": "disable", 46 | "prlctl": [ 47 | ["set", "{{.Name}}", "--memsize", "2048"], 48 | ["set", "{{.Name}}", "--cpus", "2"], 49 | ["set", "{{.Name}}", "--winsystray-in-macmenu", "off"], 50 | ["set", "{{.Name}}", "--startup-view", "window"] 51 | ] 52 | } 53 | ], 54 | "provisioners": [ 55 | { 56 | "type": "powershell", 57 | "scripts": [ 58 | "./scripts/parallels-guest-tools.ps1", 59 | "./scripts/disable-password-complexity.ps1" 60 | ], 61 | "only":["basebox-parallels"] 62 | }, 63 | { 64 | "type": "powershell", 65 | "scripts": [ 66 | "./scripts/openssh.ps1" 67 | ], 68 | "only":["parallels-windows-ovf"] 69 | }, 70 | { 71 | "type":"windows-shell", 72 | "scripts": [ 73 | "./scripts/rsync.bat" 74 | ], 75 | "only":["parallels-windows-ovf"] 76 | }, 77 | { 78 | "type":"powershell", 79 | "inline": [ 80 | "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))", 81 | "choco install seek-dsc" 82 | ], 83 | "only":["parallels-windows-ovf"] 84 | }, 85 | { 86 | "type": "powershell", 87 | "scripts": [ 88 | "./scripts/cleanup.ps1" 89 | ], 90 | "only":["parallels-windows-ovf"] 91 | }, 92 | { 93 | "type": "restart-windows", 94 | "only":["parallels-windows-ovf"] 95 | }, 96 | { 97 | "type": "powershell", 98 | "scripts": [ 99 | "./scripts/cleanup2.ps1" 100 | ], 101 | "only":["parallels-windows-ovf"] 102 | }, 103 | { 104 | "type": "file", 105 | "source": "./answer_files/2012_r2/Autounattend_sysprep.xml", 106 | "destination": "c:/Windows/Temp/Autounattend_sysprep.xml", 107 | "only":["parallels-windows-ovf"] 108 | } 109 | ], 110 | "post-processors": [ 111 | { 112 | "type": "vagrant", 113 | "keep_input_artifact": true, 114 | "output": "windows2012r2-{{.Provider}}.box", 115 | "vagrantfile_template": "vagrantfile-windows_2012_r2.template", 116 | "only":["parallels-windows-ovf"] 117 | } 118 | ] 119 | } 120 | -------------------------------------------------------------------------------- /2012r2-virtualbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "virtualbox-windows-iso", 5 | "vm_name": "vagrant-rsync", 6 | "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", 7 | "iso_checksum_type": "md5", 8 | "iso_checksum": "458ff91f8abc21b75cb544744bf92e6a", 9 | "winrm_username": "vagrant", 10 | "winrm_password": "vagrant", 11 | "winrm_wait_timeout": "8h", 12 | "winrm_port":5985, 13 | "headless": false, 14 | "boot_wait": "1m", 15 | "guest_additions_mode": "upload", 16 | "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", 17 | "guest_os_type": "Windows2012_64", 18 | "disk_size": 61440, 19 | "floppy_files": [ 20 | "./answer_files/2012_r2/Autounattend.xml", 21 | "./scripts/microsoft-updates.bat", 22 | "./scripts/win-updates.ps1", 23 | "./scripts/oracle-cert.cer", 24 | "./scripts/disable-password-complexity.ps1" 25 | ], 26 | "vboxmanage": [ 27 | [ 28 | "modifyvm", 29 | "{{.Name}}", 30 | "--memory", 31 | "2048" 32 | ], 33 | [ 34 | "modifyvm", 35 | "{{.Name}}", 36 | "--cpus", 37 | "2" 38 | ], 39 | [ 40 | "modifyvm", 41 | "{{.Name}}", 42 | "--natpf1", 43 | "guestwinrm,tcp,127.0.0.1,5985,,5985" 44 | ] 45 | ] 46 | }, 47 | { 48 | "type": "virtualbox-windows-ovf", 49 | "source_path": "./output-virtualbox-windows-iso/vagrant-rsync.ovf", 50 | "headless": false, 51 | "guest_additions_mode": "disable", 52 | "boot_wait": "30s", 53 | "winrm_username": "vagrant", 54 | "winrm_password": "vagrant", 55 | "winrm_wait_timeout": "5m", 56 | "winrm_port":5985, 57 | "winrm_host":"localhost", 58 | "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", 59 | "shutdown_timeout": "10m", 60 | "http_directory":"/tmp", 61 | "vboxmanage": [ 62 | [ 63 | "modifyvm", 64 | "{{.Name}}", 65 | "--memory", 66 | "2048" 67 | ], 68 | [ 69 | "modifyvm", 70 | "{{.Name}}", 71 | "--vram", 72 | "64" 73 | ], 74 | [ 75 | "modifyvm", 76 | "{{.Name}}", 77 | "--cpus", 78 | "2" 79 | ] 80 | ] 81 | } 82 | ], 83 | "provisioners": [ 84 | { 85 | "type":"powershell", 86 | "inline": [ 87 | "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')))>$null 2>&1", 88 | "choco install 7zip -y" 89 | ], 90 | "only":["virtualbox-windows-iso"] 91 | }, 92 | { 93 | "type": "file", 94 | "source": "./answer_files/2012_r2/Autounattend_sysprep.xml", 95 | "destination": "c:/Windows/Temp/Autounattend_sysprep.xml", 96 | "only":["virtualbox-windows-iso"] 97 | }, 98 | { 99 | "type": "powershell", 100 | "scripts": [ 101 | "./scripts/virtualbox-guest-tools.ps1", 102 | "./scripts/disable-password-complexity.ps1" 103 | ], 104 | "only":["virtualbox-windows-iso"] 105 | }, 106 | { 107 | "type": "powershell", 108 | "scripts": [ 109 | "./scripts/openssh.ps1" 110 | ], 111 | "only":["virtualbox-windows-ovf"] 112 | }, 113 | { 114 | "type":"windows-shell", 115 | "scripts": [ 116 | "./scripts/rsync.bat" 117 | ], 118 | "only":["virtualbox-windows-ovf"] 119 | }, 120 | { 121 | "type": "powershell", 122 | "elevated_user": "vagrant", 123 | "elevated_password": "vagrant", 124 | "scripts": [ 125 | "./scripts/provision.ps1" 126 | ], 127 | "only":["virtualbox-windows-ovf"] 128 | }, 129 | { 130 | "type": "powershell", 131 | "scripts": [ 132 | "./scripts/cleanup.ps1" 133 | ], 134 | "only":["virtualbox-windows-ovf"] 135 | }, 136 | { 137 | "type": "restart-windows", 138 | "only":["virtualbox-windows-ovf"] 139 | }, 140 | { 141 | "type": "powershell", 142 | "scripts": [ 143 | "./scripts/cleanup2.ps1" 144 | ], 145 | "only":["virtualbox-windows-ovf"] 146 | } 147 | ], 148 | "post-processors": [ 149 | { 150 | "type": "vagrant", 151 | "keep_input_artifact": true, 152 | "output": "windows2012r2-{{.Provider}}.box", 153 | "vagrantfile_template": "vagrantfile-windows_2012_r2.template", 154 | "only":["virtualbox-windows-ovf"] 155 | } 156 | ] 157 | } 158 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Matt Fellows 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Packer Community Example Templates 2 | 3 | [Packer Community](https://github.com/packer-community/packer-windows-plugins/) Templates for Windows environments to test/showcase many of the Windows-specific Builders and Provisioners. 4 | 5 | ## Running 6 | 7 | * Install [Packer](https://github.com/mitchellh/packer/) and [Packer Community](https://github.com/packer-community/packer-windows-plugins/) 8 | * Clone this repo: 9 | 10 | ``` 11 | git clone git@github.com:mefellows/packer-windows-templates.git && cd packer-community-templates 12 | ``` 13 | 14 | * Run Packer 15 | 16 | Common practice is to create intermediate boxes in [machine image pipelines](http://www.onegeek.com.au/articles/machine-factories-part1-vagrant), such as a 'Base' and 'Application' images. The examples below follow this pattern. 17 | 18 | ### Vagrant Boxes 19 | 20 | Run the ISO builder to produce a simple Base box with VirtualBox guest additions and optionally Windows updates (Uncomment the [relevant](/blob/master/answer_files/2012_r2/Autounattend.xml#L242-L265) lines in the Autounattend.xml files to enable this): 21 | 22 | ``` 23 | packer build -only=virtualbox-windows-iso 2012r2-virtualbox.json 24 | ``` 25 | 26 | Run the OVF builder to produce a simple base box with rsync and Seek DSC resources installed: 27 | 28 | 29 | ``` 30 | packer build -only=virtualbox-windows-ovf 2012r2-virtualbox.json 31 | ``` 32 | 33 | ### AWS Machines 34 | 35 | ``` 36 | packer build --var base_ami=ami-ac3a1cc4 --var subnet_id=subnet-1234abcd--var vpc_id=vpc-4567defg ./amazon-sysprep.json 37 | ``` 38 | 39 | 40 | ## Windows Updates 41 | 42 | Use the `/answer_files/2012_r2/updates/Autounattend.xml` file as a replacement in the `floppy_files` configuration item. 43 | 44 | ## Sysprep 45 | 46 | An example unattended sysprep file is automatically uploaded to `c:/Windows/Temp/Autounattend_sysprep.xml` which can be used in a provisioner to sysprep the machine. For example, you may replace the default `shutdown_command` in the OVF builder with the following: 47 | 48 | ``` 49 | "shutdown_command": "c:/windows/system32/sysprep/sysprep.exe /generalize /oobe /quiet /shutdown /unattend:c:/Windows/Temp/Autounattend_sysprep.xml", 50 | "shutdown_timeout": "15m" 51 | ``` 52 | 53 | NOTE: This currently impacts the rsync (SSH) capability due to SIDs and such. 54 | 55 | ## Credits 56 | 57 | Thanks to Joe's [joefitzgerald/packer-windows](https://github.com/joefitzgerald/packer-windows) templates for the inspiration and basis for much of this work. -------------------------------------------------------------------------------- /amazon-sysprep.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "build_version": "1.0.1", 4 | "base_ami":"ami-3a3b1d52", 5 | "user":"vagrant", 6 | "password":"FooBar@123", 7 | "instance_type":"t2.small", 8 | "vpc_id":"", 9 | "subnet_id":"" 10 | }, 11 | "builders": [ 12 | { 13 | "type": "amazon-windows-ebs", 14 | "name": "base-ami", 15 | "region": "us-east-1", 16 | "source_ami": "{{user `base_ami`}}", 17 | "instance_type": "{{user `instance_type`}}", 18 | "ami_name": "sysprep-windows-{{user `build_version`}}", 19 | "user_data_file":"./scripts/ec2-bootstrap.ps1", 20 | "associate_public_ip_address":true, 21 | "winrm_username": "{{user `user`}}", 22 | "winrm_password": "{{user `password`}}", 23 | "winrm_wait_timeout": "20m", 24 | "winrm_private_ip": false, 25 | "winrm_port":5985, 26 | "vpc_id": "{{user `vpc_id`}}", 27 | "subnet_id": "{{user `subnet_id`}}" 28 | } 29 | ], 30 | "provisioners": [ 31 | { 32 | "type":"powershell", 33 | "scripts": [ 34 | "./scripts/Ec2Config.ps1", 35 | "./scripts/BundleConfig.ps1" 36 | ] 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /answer_files/2008_r2/Autounattend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 1 11 | Primary 12 | 60000 13 | 14 | 15 | 16 | 17 | false 18 | NTFS 19 | C 20 | 1 21 | 1 22 | 23 | 24 | 25 | 0 26 | true 27 | 28 | 51 | OnError 52 | 53 | 54 | true 55 | Vagrant Administrator 56 | Vagrant Inc. 57 | 58 | 59 | 60 | 61 | 62 | Never 63 | 64 | 65 | 66 | 67 | 68 | 0 69 | 1 70 | 71 | OnError 72 | false 73 | 74 | 75 | /IMAGE/NAME 76 | Windows Server 2008 R2 SERVERSTANDARD 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | en-US 85 | 86 | en-US 87 | en-US 88 | en-US 89 | en-US 90 | en-US 91 | 92 | 93 | 94 | 95 | false 96 | 97 | 98 | 99 | 100 | 101 | 102 | vagrant 103 | true</PlainText> 104 | </AdministratorPassword> 105 | <LocalAccounts> 106 | <LocalAccount wcm:action="add"> 107 | <Password> 108 | <Value>vagrant</Value> 109 | <PlainText>true</PlainText> 110 | </Password> 111 | <Description>Vagrant User</Description> 112 | <DisplayName>vagrant</DisplayName> 113 | <Group>administrators</Group> 114 | <Name>vagrant</Name> 115 | </LocalAccount> 116 | </LocalAccounts> 117 | </UserAccounts> 118 | <OOBE> 119 | <HideEULAPage>true</HideEULAPage> 120 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 121 | <NetworkLocation>Home</NetworkLocation> 122 | </OOBE> 123 | <AutoLogon> 124 | <Password> 125 | <Value>vagrant</Value> 126 | <PlainText>true</PlainText> 127 | </Password> 128 | <Username>vagrant</Username> 129 | <Enabled>true</Enabled> 130 | </AutoLogon> 131 | <FirstLogonCommands> 132 | <SynchronousCommand wcm:action="add"> 133 | <CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy bypass -Force"</CommandLine> 134 | <Description>Set Execution Policy 64 Bit</Description> 135 | <Order>1</Order> 136 | <RequiresUserInput>true</RequiresUserInput> 137 | </SynchronousCommand> 138 | <SynchronousCommand wcm:action="add"> 139 | <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy bypass -Force"</CommandLine> 140 | <Description>Set Execution Policy 32 Bit</Description> 141 | <Order>2</Order> 142 | <RequiresUserInput>true</RequiresUserInput> 143 | </SynchronousCommand> 144 | <SynchronousCommand wcm:action="add"> 145 | <CommandLine>cmd.exe /c winrm quickconfig -q</CommandLine> 146 | <Description>winrm quickconfig -q</Description> 147 | <Order>3</Order> 148 | <RequiresUserInput>true</RequiresUserInput> 149 | </SynchronousCommand> 150 | 151 | // Re order the numbers and possibly update descriptions 152 | <SynchronousCommand wcm:action="add"> 153 | <CommandLine>cmd.exe /c winrm quickconfig -transport:http</CommandLine> 154 | <Description>winrm quickconfig -transport:http</Description> 155 | <Order>4</Order> 156 | <RequiresUserInput>true</RequiresUserInput> 157 | </SynchronousCommand> 158 | <SynchronousCommand wcm:action="add"> 159 | <CommandLine>cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}</CommandLine> 160 | <Description>Win RM MaxTimoutms</Description> 161 | <Order>5</Order> 162 | <RequiresUserInput>true</RequiresUserInput> 163 | </SynchronousCommand> 164 | <SynchronousCommand wcm:action="add"> 165 | <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}</CommandLine> 166 | <Description>Win RM MaxMemoryPerShellMB</Description> 167 | <Order>6</Order> 168 | <RequiresUserInput>true</RequiresUserInput> 169 | </SynchronousCommand> 170 | <SynchronousCommand wcm:action="add"> 171 | <CommandLine>cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}</CommandLine> 172 | <Description>Win RM AllowUnencrypted</Description> 173 | <Order>7</Order> 174 | <RequiresUserInput>true</RequiresUserInput> 175 | </SynchronousCommand> 176 | <SynchronousCommand wcm:action="add"> 177 | <CommandLine>cmd.exe /c winrm set winrm/config/client @{AllowUnencrypted="true"}</CommandLine> 178 | <Description>Win RM AllowUnencrypted</Description> 179 | <Order>7</Order> 180 | <RequiresUserInput>true</RequiresUserInput> 181 | </SynchronousCommand> 182 | <SynchronousCommand wcm:action="add"> 183 | <CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}</CommandLine> 184 | <Description>Win RM auth Basic</Description> 185 | <Order>8</Order> 186 | <RequiresUserInput>true</RequiresUserInput> 187 | </SynchronousCommand> 188 | <SynchronousCommand wcm:action="add"> 189 | <CommandLine>cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}</CommandLine> 190 | <Description>Win RM client auth Basic</Description> 191 | <Order>9</Order> 192 | <RequiresUserInput>true</RequiresUserInput> 193 | </SynchronousCommand> 194 | <SynchronousCommand wcm:action="add"> 195 | <CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{CredSSP="true"}</CommandLine> 196 | <Description>Win RM client auth Basic</Description> 197 | <Order>9</Order> 198 | <RequiresUserInput>true</RequiresUserInput> 199 | </SynchronousCommand> 200 | <SynchronousCommand wcm:action="add"> 201 | <CommandLine>cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} </CommandLine> 202 | <Description>Win RM listener Address/Port</Description> 203 | <Order>10</Order> 204 | <RequiresUserInput>true</RequiresUserInput> 205 | </SynchronousCommand> 206 | <SynchronousCommand wcm:action="add"> 207 | <CommandLine>cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes </CommandLine> 208 | <Description>Win RM adv firewall enable</Description> 209 | <Order>11</Order> 210 | <RequiresUserInput>true</RequiresUserInput> 211 | </SynchronousCommand> 212 | <SynchronousCommand wcm:action="add"> 213 | <CommandLine>cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" </CommandLine> 214 | <Description>Win RM port open</Description> 215 | <Order>12</Order> 216 | <RequiresUserInput>true</RequiresUserInput> 217 | </SynchronousCommand> 218 | <SynchronousCommand wcm:action="add"> 219 | <CommandLine>cmd.exe /c net stop winrm </CommandLine> 220 | <Description>Stop Win RM Service </Description> 221 | <Order>13</Order> 222 | <RequiresUserInput>true</RequiresUserInput> 223 | </SynchronousCommand> 224 | <SynchronousCommand wcm:action="add"> 225 | <CommandLine>cmd.exe /c sc config winrm start= auto</CommandLine> 226 | <Description>Win RM Autostart</Description> 227 | <Order>14</Order> 228 | <RequiresUserInput>true</RequiresUserInput> 229 | </SynchronousCommand> 230 | <SynchronousCommand wcm:action="add"> 231 | <CommandLine>cmd.exe /c net start winrm</CommandLine> 232 | <Description>Start Win RM Service</Description> 233 | <Order>15</Order> 234 | <RequiresUserInput>true</RequiresUserInput> 235 | </SynchronousCommand> 236 | <SynchronousCommand wcm:action="add"> 237 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> 238 | <Order>16</Order> 239 | <Description>Show file extensions in Explorer</Description> 240 | </SynchronousCommand> 241 | <SynchronousCommand wcm:action="add"> 242 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine> 243 | <Order>17</Order> 244 | <Description>Enable QuickEdit mode</Description> 245 | </SynchronousCommand> 246 | <SynchronousCommand wcm:action="add"> 247 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine> 248 | <Order>18</Order> 249 | <Description>Show Run command in Start Menu</Description> 250 | </SynchronousCommand> 251 | <SynchronousCommand wcm:action="add"> 252 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine> 253 | <Order>19</Order> 254 | <Description>Show Administrative Tools in Start Menu</Description> 255 | </SynchronousCommand> 256 | <SynchronousCommand wcm:action="add"> 257 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine> 258 | <Order>20</Order> 259 | <Description>Zero Hibernation File</Description> 260 | </SynchronousCommand> 261 | <SynchronousCommand wcm:action="add"> 262 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine> 263 | <Order>21</Order> 264 | <Description>Disable Hibernation Mode</Description> 265 | </SynchronousCommand> 266 | <SynchronousCommand wcm:action="add"> 267 | <CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine> 268 | <Order>22</Order> 269 | <Description>Disable password expiration for vagrant user</Description> 270 | </SynchronousCommand> 271 | 272 | Set-Item WSMan:\localhost\Client\TrustedHosts -Value * -Force 273 | 274 | Enable-WSManCredSSP -role client -delegatecomputer * -force 275 | Enable-WSManCredSSP -role client -delegatecomputer *.seek.int -force 276 | Enable-WSManCredSSP -role server -force 277 | 278 | 279 | 280 | <!-- Custom on boot 281 | <SynchronousCommand wcm:action="add"> 282 | <CommandLine>cmd.exe /c a:\chocolatey.bat</CommandLine> 283 | <Order>97</Order> 284 | <Description>Install Chocolatey</Description> 285 | </SynchronousCommand> 286 | <SynchronousCommand wcm:action="add"> 287 | <CommandLine>cmd.exe /c a:\chocopacks.bat</CommandLine> 288 | <Order>98</Order> 289 | <Description>Install Chocolatey packs</Description> 290 | </SynchronousCommand> 291 | --> 292 | <!-- End Custom --> 293 | 294 | <!-- WITHOUT WINDOWS UPDATES --> 295 | <SynchronousCommand wcm:action="add"> 296 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine> 297 | <Description>Install OpenSSH</Description> 298 | <Order>99</Order> 299 | <RequiresUserInput>true</RequiresUserInput> 300 | </SynchronousCommand> 301 | 302 | <!-- END WITHOUT WINDOWS UPDATES --> 303 | <!-- WITH WINDOWS UPDATES 304 | <SynchronousCommand wcm:action="add"> 305 | <CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine> 306 | <Order>98</Order> 307 | <Description>Enable Microsoft Updates</Description> 308 | </SynchronousCommand> 309 | <SynchronousCommand wcm:action="add"> 310 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine> 311 | <Description>Install Windows Updates</Description> 312 | <Order>100</Order> 313 | <RequiresUserInput>true</RequiresUserInput> 314 | </SynchronousCommand>--> 315 | <!-- END WITH WINDOWS UPDATES --> 316 | </FirstLogonCommands> 317 | <ShowWindowsLive>false</ShowWindowsLive> 318 | </component> 319 | </settings> 320 | <settings pass="specialize"> 321 | <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 322 | <OEMInformation> 323 | <HelpCustomized>false</HelpCustomized> 324 | </OEMInformation> 325 | <!-- Rename computer here. --> 326 | <ComputerName>vagrant-2008R2</ComputerName> 327 | <TimeZone>Pacific Standard Time</TimeZone> 328 | <RegisteredOwner/> 329 | </component> 330 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 331 | <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> 332 | </component> 333 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 334 | <!-- Disable IE ESC. --> 335 | <IEHardenAdmin>false</IEHardenAdmin> 336 | <IEHardenUser>false</IEHardenUser> 337 | </component> 338 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 339 | <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> 340 | </component> 341 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 342 | <SkipAutoActivation>true</SkipAutoActivation> 343 | </component> 344 | </settings> 345 | <cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="catalog:d:/sources/install_windows server 2008 r2 serverdatacenter.clg"/> 346 | </unattend> 347 | -------------------------------------------------------------------------------- /answer_files/2012_r2/Autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <settings pass="windowsPE"> 4 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 5 | <SetupUILanguage> 6 | <UILanguage>en-US</UILanguage> 7 | </SetupUILanguage> 8 | <InputLocale>en-US</InputLocale> 9 | <SystemLocale>en-US</SystemLocale> 10 | <UILanguage>en-US</UILanguage> 11 | <UILanguageFallback>en-US</UILanguageFallback> 12 | <UserLocale>en-US</UserLocale> 13 | </component> 14 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 15 | <DiskConfiguration> 16 | <Disk wcm:action="add"> 17 | <CreatePartitions> 18 | <CreatePartition wcm:action="add"> 19 | <Type>Primary</Type> 20 | <Order>1</Order> 21 | <Size>350</Size> 22 | </CreatePartition> 23 | <CreatePartition wcm:action="add"> 24 | <Order>2</Order> 25 | <Type>Primary</Type> 26 | <Extend>true</Extend> 27 | </CreatePartition> 28 | </CreatePartitions> 29 | <ModifyPartitions> 30 | <ModifyPartition wcm:action="add"> 31 | <Active>true</Active> 32 | <Format>NTFS</Format> 33 | <Label>boot</Label> 34 | <Order>1</Order> 35 | <PartitionID>1</PartitionID> 36 | </ModifyPartition> 37 | <ModifyPartition wcm:action="add"> 38 | <Format>NTFS</Format> 39 | <Label>Windows 2012 R2</Label> 40 | <Letter>C</Letter> 41 | <Order>2</Order> 42 | <PartitionID>2</PartitionID> 43 | </ModifyPartition> 44 | </ModifyPartitions> 45 | <DiskID>0</DiskID> 46 | <WillWipeDisk>true</WillWipeDisk> 47 | </Disk> 48 | </DiskConfiguration> 49 | <ImageInstall> 50 | <OSImage> 51 | <InstallFrom> 52 | <MetaData wcm:action="add"> 53 | <Key>/IMAGE/NAME </Key> 54 | <Value>Windows Server 2012 R2 SERVERSTANDARD</Value> 55 | </MetaData> 56 | </InstallFrom> 57 | <InstallTo> 58 | <DiskID>0</DiskID> 59 | <PartitionID>2</PartitionID> 60 | </InstallTo> 61 | </OSImage> 62 | </ImageInstall> 63 | <UserData> 64 | <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx --> 65 | <ProductKey> 66 | <!-- Do not uncomment the Key element if you are using trial ISOs --> 67 | <!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs --> 68 | <!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>--> 69 | <WillShowUI>OnError</WillShowUI> 70 | </ProductKey> 71 | <AcceptEula>true</AcceptEula> 72 | <FullName>Vagrant</FullName> 73 | <Organization>Vagrant</Organization> 74 | </UserData> 75 | </component> 76 | </settings> 77 | <settings pass="specialize"> 78 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 79 | <OEMInformation> 80 | <HelpCustomized>false</HelpCustomized> 81 | </OEMInformation> 82 | <ComputerName>vagrant-2012-r2</ComputerName> 83 | <TimeZone>Pacific Standard Time</TimeZone> 84 | <RegisteredOwner/> 85 | </component> 86 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 87 | <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> 88 | </component> 89 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 90 | <IEHardenAdmin>false</IEHardenAdmin> 91 | <IEHardenUser>false</IEHardenUser> 92 | </component> 93 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 94 | <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> 95 | </component> 96 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 97 | <SkipAutoActivation>true</SkipAutoActivation> 98 | </component> 99 | </settings> 100 | <settings pass="oobeSystem"> 101 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 102 | <AutoLogon> 103 | <Password> 104 | <Value>vagrant</Value> 105 | <PlainText>true</PlainText> 106 | </Password> 107 | <Enabled>true</Enabled> 108 | <Username>vagrant</Username> 109 | </AutoLogon> 110 | <FirstLogonCommands> 111 | <SynchronousCommand wcm:action="add"> 112 | <CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Force"</CommandLine> 113 | <Description>Set Execution Policy 64 Bit</Description> 114 | <Order>1</Order> 115 | <RequiresUserInput>true</RequiresUserInput> 116 | </SynchronousCommand> 117 | <SynchronousCommand wcm:action="add"> 118 | <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Force"</CommandLine> 119 | <Description>Set Execution Policy 32 Bit</Description> 120 | <Order>2</Order> 121 | <RequiresUserInput>true</RequiresUserInput> 122 | </SynchronousCommand> 123 | <SynchronousCommand wcm:action="add"> 124 | <CommandLine>cmd.exe /c winrm quickconfig -q</CommandLine> 125 | <Description>winrm quickconfig -q</Description> 126 | <Order>3</Order> 127 | <RequiresUserInput>true</RequiresUserInput> 128 | </SynchronousCommand> 129 | <SynchronousCommand wcm:action="add"> 130 | <CommandLine>cmd.exe /c winrm quickconfig -transport:http</CommandLine> 131 | <Description>winrm quickconfig -transport:http</Description> 132 | <Order>4</Order> 133 | <RequiresUserInput>true</RequiresUserInput> 134 | </SynchronousCommand> 135 | <SynchronousCommand wcm:action="add"> 136 | <CommandLine>cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}</CommandLine> 137 | <Description>Win RM MaxTimoutms</Description> 138 | <Order>5</Order> 139 | <RequiresUserInput>true</RequiresUserInput> 140 | </SynchronousCommand> 141 | <SynchronousCommand wcm:action="add"> 142 | <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}</CommandLine> 143 | <Description>Win RM MaxMemoryPerShellMB</Description> 144 | <Order>6</Order> 145 | <RequiresUserInput>true</RequiresUserInput> 146 | </SynchronousCommand> 147 | <SynchronousCommand wcm:action="add"> 148 | <CommandLine>cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}</CommandLine> 149 | <Description>Win RM AllowUnencrypted</Description> 150 | <Order>7</Order> 151 | <RequiresUserInput>true</RequiresUserInput> 152 | </SynchronousCommand> 153 | <SynchronousCommand wcm:action="add"> 154 | <CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}</CommandLine> 155 | <Description>Win RM auth Basic</Description> 156 | <Order>8</Order> 157 | <RequiresUserInput>true</RequiresUserInput> 158 | </SynchronousCommand> 159 | <SynchronousCommand wcm:action="add"> 160 | <CommandLine>cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}</CommandLine> 161 | <Description>Win RM client auth Basic</Description> 162 | <Order>9</Order> 163 | <RequiresUserInput>true</RequiresUserInput> 164 | </SynchronousCommand> 165 | <SynchronousCommand wcm:action="add"> 166 | <CommandLine>cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} </CommandLine> 167 | <Description>Win RM listener Address/Port</Description> 168 | <Order>10</Order> 169 | <RequiresUserInput>true</RequiresUserInput> 170 | </SynchronousCommand> 171 | <SynchronousCommand wcm:action="add"> 172 | <CommandLine>cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes </CommandLine> 173 | <Description>Win RM adv firewall enable</Description> 174 | <Order>11</Order> 175 | <RequiresUserInput>true</RequiresUserInput> 176 | </SynchronousCommand> 177 | <SynchronousCommand wcm:action="add"> 178 | <CommandLine>cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" </CommandLine> 179 | <Description>Win RM port open</Description> 180 | <Order>12</Order> 181 | <RequiresUserInput>true</RequiresUserInput> 182 | </SynchronousCommand> 183 | <SynchronousCommand wcm:action="add"> 184 | <CommandLine>cmd.exe /c net stop winrm </CommandLine> 185 | <Description>Stop Win RM Service </Description> 186 | <Order>13</Order> 187 | <RequiresUserInput>true</RequiresUserInput> 188 | </SynchronousCommand> 189 | <SynchronousCommand wcm:action="add"> 190 | <CommandLine>cmd.exe /c sc config winrm start= auto</CommandLine> 191 | <Description>Win RM Autostart</Description> 192 | <Order>14</Order> 193 | <RequiresUserInput>true</RequiresUserInput> 194 | </SynchronousCommand> 195 | <SynchronousCommand wcm:action="add"> 196 | <CommandLine>cmd.exe /c net start winrm</CommandLine> 197 | <Description>Start Win RM Service</Description> 198 | <Order>15</Order> 199 | <RequiresUserInput>true</RequiresUserInput> 200 | </SynchronousCommand> 201 | <SynchronousCommand wcm:action="add"> 202 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> 203 | <Order>16</Order> 204 | <Description>Show file extensions in Explorer</Description> 205 | </SynchronousCommand> 206 | <SynchronousCommand wcm:action="add"> 207 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine> 208 | <Order>17</Order> 209 | <Description>Enable QuickEdit mode</Description> 210 | </SynchronousCommand> 211 | <SynchronousCommand wcm:action="add"> 212 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine> 213 | <Order>18</Order> 214 | <Description>Show Run command in Start Menu</Description> 215 | </SynchronousCommand> 216 | <SynchronousCommand wcm:action="add"> 217 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine> 218 | <Order>19</Order> 219 | <Description>Show Administrative Tools in Start Menu</Description> 220 | </SynchronousCommand> 221 | <SynchronousCommand wcm:action="add"> 222 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine> 223 | <Order>20</Order> 224 | <Description>Zero Hibernation File</Description> 225 | </SynchronousCommand> 226 | <SynchronousCommand wcm:action="add"> 227 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine> 228 | <Order>21</Order> 229 | <Description>Disable Hibernation Mode</Description> 230 | </SynchronousCommand> 231 | <SynchronousCommand wcm:action="add"> 232 | <CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine> 233 | <Order>22</Order> 234 | <Description>Disable password expiration for vagrant user</Description> 235 | </SynchronousCommand> 236 | <SynchronousCommand wcm:action="add"> 237 | <CommandLine>cmd.exe /c powershell -File a:\disable-password-complexity.ps1</CommandLine> 238 | <Description>Disable password complexity</Description> 239 | <Order>23</Order> 240 | <RequiresUserInput>true</RequiresUserInput> 241 | </SynchronousCommand> 242 | <!-- WITHOUT WINDOWS UPDATES 243 | 244 | <SynchronousCommand wcm:action="add"> 245 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine> 246 | <Description>Install OpenSSH</Description> 247 | <Order>99</Order> 248 | <RequiresUserInput>true</RequiresUserInput> 249 | </SynchronousCommand> 250 | --> 251 | 252 | <!-- END WITHOUT WINDOWS UPDATES --> 253 | <!-- WITH WINDOWS UPDATES 254 | <SynchronousCommand wcm:action="add"> 255 | <CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine> 256 | <Order>98</Order> 257 | <Description>Enable Microsoft Updates</Description> 258 | </SynchronousCommand> 259 | <SynchronousCommand wcm:action="add"> 260 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine> 261 | <Description>Install Windows Updates</Description> 262 | <Order>100</Order> 263 | <RequiresUserInput>true</RequiresUserInput> 264 | </SynchronousCommand> 265 | --> 266 | <!-- END WITH WINDOWS UPDATES --> 267 | </FirstLogonCommands> 268 | <OOBE> 269 | <HideEULAPage>true</HideEULAPage> 270 | <HideLocalAccountScreen>true</HideLocalAccountScreen> 271 | <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> 272 | <HideOnlineAccountScreens>true</HideOnlineAccountScreens> 273 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 274 | <NetworkLocation>Home</NetworkLocation> 275 | <ProtectYourPC>1</ProtectYourPC> 276 | </OOBE> 277 | <UserAccounts> 278 | <AdministratorPassword> 279 | <Value>vagrant</Value> 280 | <PlainText>true</PlainText> 281 | </AdministratorPassword> 282 | <LocalAccounts> 283 | <LocalAccount wcm:action="add"> 284 | <Password> 285 | <Value>vagrant</Value> 286 | <PlainText>true</PlainText> 287 | </Password> 288 | <Group>administrators</Group> 289 | <DisplayName>Vagrant</DisplayName> 290 | <Name>vagrant</Name> 291 | <Description>Vagrant User</Description> 292 | </LocalAccount> 293 | </LocalAccounts> 294 | </UserAccounts> 295 | <RegisteredOwner/> 296 | </component> 297 | </settings> 298 | <settings pass="offlineServicing"> 299 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 300 | <EnableLUA>false</EnableLUA> 301 | </component> 302 | </settings> 303 | <cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="wim:c:/wim/install.wim#Windows Server 2012 R2 SERVERSTANDARD"/> 304 | </unattend> 305 | -------------------------------------------------------------------------------- /answer_files/2012_r2/Autounattend_sysprep.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <settings pass="generalize"> 4 | <component name="Microsoft-Windows-Security-SPP" 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"> 5 | <SkipRearm>1</SkipRearm> 6 | </component> 7 | <component name="Microsoft-Windows-PnpSysprep" 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"> 8 | <PersistAllDeviceInstalls>false</PersistAllDeviceInstalls> 9 | <DoNotCleanUpNonPresentDevices>false</DoNotCleanUpNonPresentDevices> 10 | </component> 11 | </settings> 12 | <settings pass="oobeSystem"> 13 | <component name="Microsoft-Windows-International-Core" 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"> 14 | <InputLocale>en-US</InputLocale> 15 | <SystemLocale>en-US</SystemLocale> 16 | <UILanguage>en-US</UILanguage> 17 | <UserLocale>en-US</UserLocale> 18 | </component> 19 | <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"> 20 | <OOBE> 21 | <HideEULAPage>true</HideEULAPage> 22 | <ProtectYourPC>1</ProtectYourPC> 23 | <NetworkLocation>Work</NetworkLocation> 24 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 25 | </OOBE> 26 | <TimeZone>UTC</TimeZone> 27 | <!--<FirstLogonCommands> 28 | <SynchronousCommand wcm:action="add"> 29 | <CommandLine>cmd /c c:\"Program Files"\OpenSSH\uninstall.exe /S</CommandLine> 30 | <Description>Uninstall OpenSSH</Description> 31 | <Order>99</Order> 32 | <RequiresUserInput>true</RequiresUserInput> 33 | </SynchronousCommand> 34 | </FirstLogonCommands>--> 35 | </component> 36 | </settings> 37 | <settings pass="specialize"> 38 | <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"> 39 | <!--<ComputerName>windows2012r2-vagrant</ComputerName> 40 | <CopyProfile>false</CopyProfile>--> 41 | <UserAccounts> 42 | <AdministratorPassword> 43 | <Value>vagrant</Value> 44 | <PlainText>true</PlainText> 45 | </AdministratorPassword> 46 | <LocalAccounts> 47 | <LocalAccount wcm:action="add"> 48 | <Password> 49 | <Value>vagrant</Value> 50 | <PlainText>true</PlainText> 51 | </Password> 52 | <Group>administrators</Group> 53 | <DisplayName>Vagrant</DisplayName> 54 | <Name>vagrant</Name> 55 | <Description>Vagrant User</Description> 56 | </LocalAccount> 57 | </LocalAccounts> 58 | </UserAccounts> 59 | </component> 60 | </settings> 61 | </unattend> -------------------------------------------------------------------------------- /answer_files/2012_r2/parallels/Autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <servicing/> 4 | <settings pass="windowsPE"> 5 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 6 | <DiskConfiguration> 7 | <Disk wcm:action="add"> 8 | <CreatePartitions> 9 | <CreatePartition wcm:action="add"> 10 | <Order>1</Order> 11 | <Type>Primary</Type> 12 | <Size>60000</Size> 13 | </CreatePartition> 14 | </CreatePartitions> 15 | <ModifyPartitions> 16 | <ModifyPartition wcm:action="add"> 17 | <Extend>false</Extend> 18 | <Format>NTFS</Format> 19 | <Letter>C</Letter> 20 | <Order>1</Order> 21 | <PartitionID>1</PartitionID> 22 | <Label>Windows</Label> 23 | </ModifyPartition> 24 | </ModifyPartitions> 25 | <DiskID>0</DiskID> 26 | <WillWipeDisk>true</WillWipeDisk> 27 | </Disk> 28 | <WillShowUI>OnError</WillShowUI> 29 | </DiskConfiguration> 30 | <UserData> 31 | <AcceptEula>true</AcceptEula> 32 | <FullName>Vagrant Administrator</FullName> 33 | <Organization>Vagrant Inc.</Organization> 34 | <!-- Product Key from http://technet.microsoft.com/en-us/library/ff793406.aspx --> 35 | <ProductKey>XC9B7-NBPP2-83J2H-RHMBY-92BT4 36 | <WillShowUI>Never</WillShowUI> 37 | </ProductKey> 38 | </UserData> 39 | <ImageInstall> 40 | <OSImage> 41 | <InstallTo> 42 | <DiskID>0</DiskID> 43 | <PartitionID>1</PartitionID> 44 | </InstallTo> 45 | <WillShowUI>OnError</WillShowUI> 46 | <InstallToAvailablePartition>false</InstallToAvailablePartition> 47 | <InstallFrom> 48 | <MetaData wcm:action="add"> 49 | <Key>/IMAGE/NAME </Key> 50 | <Value>Windows Server 2012 R2 SERVERSTANDARD</Value> 51 | </MetaData> 52 | </InstallFrom> 53 | </OSImage> 54 | </ImageInstall> 55 | </component> 56 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 57 | <SetupUILanguage> 58 | <UILanguage>en-US</UILanguage> 59 | </SetupUILanguage> 60 | <InputLocale>en-US</InputLocale> 61 | <SystemLocale>en-US</SystemLocale> 62 | <UILanguage>en-US</UILanguage> 63 | <UILanguageFallback>en-US</UILanguageFallback> 64 | <UserLocale>en-US</UserLocale> 65 | </component> 66 | </settings> 67 | <settings pass="offlineServicing"> 68 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 69 | <EnableLUA>false</EnableLUA> 70 | </component> 71 | </settings> 72 | <settings pass="oobeSystem"> 73 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 74 | <UserAccounts> 75 | <AdministratorPassword> 76 | <Value>vagrant</Value> 77 | <PlainText>true</PlainText> 78 | </AdministratorPassword> 79 | <LocalAccounts> 80 | <LocalAccount wcm:action="add"> 81 | <Password> 82 | <Value>vagrant</Value> 83 | <PlainText>true</PlainText> 84 | </Password> 85 | <Description>Vagrant User</Description> 86 | <DisplayName>vagrant</DisplayName> 87 | <Group>administrators</Group> 88 | <Name>vagrant</Name> 89 | </LocalAccount> 90 | </LocalAccounts> 91 | </UserAccounts> 92 | <OOBE> 93 | <HideEULAPage>true</HideEULAPage> 94 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 95 | <NetworkLocation>Home</NetworkLocation> 96 | <ProtectYourPC>1</ProtectYourPC> 97 | </OOBE> 98 | <AutoLogon> 99 | <Password> 100 | <Value>vagrant</Value> 101 | <PlainText>true</PlainText> 102 | </Password> 103 | <Username>vagrant</Username> 104 | <Enabled>true</Enabled> 105 | </AutoLogon> 106 | <FirstLogonCommands> 107 | <SynchronousCommand wcm:action="add"> 108 | <CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Force"</CommandLine> 109 | <Description>Set Execution Policy 64 Bit</Description> 110 | <Order>1</Order> 111 | <RequiresUserInput>true</RequiresUserInput> 112 | </SynchronousCommand> 113 | <SynchronousCommand wcm:action="add"> 114 | <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Force"</CommandLine> 115 | <Description>Set Execution Policy 32 Bit</Description> 116 | <Order>2</Order> 117 | <RequiresUserInput>true</RequiresUserInput> 118 | </SynchronousCommand> 119 | <SynchronousCommand wcm:action="add"> 120 | <CommandLine>cmd.exe /c winrm quickconfig -q</CommandLine> 121 | <Description>winrm quickconfig -q</Description> 122 | <Order>3</Order> 123 | <RequiresUserInput>true</RequiresUserInput> 124 | </SynchronousCommand> 125 | <SynchronousCommand wcm:action="add"> 126 | <CommandLine>cmd.exe /c winrm quickconfig -transport:http</CommandLine> 127 | <Description>winrm quickconfig -transport:http</Description> 128 | <Order>4</Order> 129 | <RequiresUserInput>true</RequiresUserInput> 130 | </SynchronousCommand> 131 | <SynchronousCommand wcm:action="add"> 132 | <CommandLine>cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}</CommandLine> 133 | <Description>Win RM MaxTimoutms</Description> 134 | <Order>5</Order> 135 | <RequiresUserInput>true</RequiresUserInput> 136 | </SynchronousCommand> 137 | <SynchronousCommand wcm:action="add"> 138 | <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}</CommandLine> 139 | <Description>Win RM MaxMemoryPerShellMB</Description> 140 | <Order>6</Order> 141 | <RequiresUserInput>true</RequiresUserInput> 142 | </SynchronousCommand> 143 | <SynchronousCommand wcm:action="add"> 144 | <CommandLine>cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}</CommandLine> 145 | <Description>Win RM AllowUnencrypted</Description> 146 | <Order>7</Order> 147 | <RequiresUserInput>true</RequiresUserInput> 148 | </SynchronousCommand> 149 | <SynchronousCommand wcm:action="add"> 150 | <CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}</CommandLine> 151 | <Description>Win RM auth Basic</Description> 152 | <Order>8</Order> 153 | <RequiresUserInput>true</RequiresUserInput> 154 | </SynchronousCommand> 155 | <SynchronousCommand wcm:action="add"> 156 | <CommandLine>cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}</CommandLine> 157 | <Description>Win RM client auth Basic</Description> 158 | <Order>9</Order> 159 | <RequiresUserInput>true</RequiresUserInput> 160 | </SynchronousCommand> 161 | <SynchronousCommand wcm:action="add"> 162 | <CommandLine>cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} </CommandLine> 163 | <Description>Win RM listener Address/Port</Description> 164 | <Order>10</Order> 165 | <RequiresUserInput>true</RequiresUserInput> 166 | </SynchronousCommand> 167 | <SynchronousCommand wcm:action="add"> 168 | <CommandLine>cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes </CommandLine> 169 | <Description>Win RM adv firewall enable</Description> 170 | <Order>11</Order> 171 | <RequiresUserInput>true</RequiresUserInput> 172 | </SynchronousCommand> 173 | <SynchronousCommand wcm:action="add"> 174 | <CommandLine>cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" </CommandLine> 175 | <Description>Win RM port open</Description> 176 | <Order>12</Order> 177 | <RequiresUserInput>true</RequiresUserInput> 178 | </SynchronousCommand> 179 | <SynchronousCommand wcm:action="add"> 180 | <CommandLine>cmd.exe /c net stop winrm </CommandLine> 181 | <Description>Stop Win RM Service </Description> 182 | <Order>13</Order> 183 | <RequiresUserInput>true</RequiresUserInput> 184 | </SynchronousCommand> 185 | <SynchronousCommand wcm:action="add"> 186 | <CommandLine>cmd.exe /c sc config winrm start= auto</CommandLine> 187 | <Description>Win RM Autostart</Description> 188 | <Order>14</Order> 189 | <RequiresUserInput>true</RequiresUserInput> 190 | </SynchronousCommand> 191 | <SynchronousCommand wcm:action="add"> 192 | <CommandLine>cmd.exe /c net start winrm</CommandLine> 193 | <Description>Start Win RM Service</Description> 194 | <Order>15</Order> 195 | <RequiresUserInput>true</RequiresUserInput> 196 | </SynchronousCommand> 197 | <SynchronousCommand wcm:action="add"> 198 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> 199 | <Order>16</Order> 200 | <Description>Show file extensions in Explorer</Description> 201 | </SynchronousCommand> 202 | <SynchronousCommand wcm:action="add"> 203 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine> 204 | <Order>17</Order> 205 | <Description>Enable QuickEdit mode</Description> 206 | </SynchronousCommand> 207 | <SynchronousCommand wcm:action="add"> 208 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine> 209 | <Order>18</Order> 210 | <Description>Show Run command in Start Menu</Description> 211 | </SynchronousCommand> 212 | <SynchronousCommand wcm:action="add"> 213 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine> 214 | <Order>19</Order> 215 | <Description>Show Administrative Tools in Start Menu</Description> 216 | </SynchronousCommand> 217 | <SynchronousCommand wcm:action="add"> 218 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine> 219 | <Order>20</Order> 220 | <Description>Zero Hibernation File</Description> 221 | </SynchronousCommand> 222 | <SynchronousCommand wcm:action="add"> 223 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine> 224 | <Order>21</Order> 225 | <Description>Disable Hibernation Mode</Description> 226 | </SynchronousCommand> 227 | <SynchronousCommand wcm:action="add"> 228 | <CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine> 229 | <Order>22</Order> 230 | <Description>Disable password expiration for vagrant user</Description> 231 | </SynchronousCommand> 232 | <SynchronousCommand wcm:action="add"> 233 | <CommandLine>cmd.exe /c powershell -File a:\disable-password-complexity.ps1</CommandLine> 234 | <Description>Disable password complexity</Description> 235 | <Order>23</Order> 236 | <RequiresUserInput>true</RequiresUserInput> 237 | </SynchronousCommand> 238 | <!-- WITHOUT WINDOWS UPDATES --> 239 | <!-- 240 | <SynchronousCommand wcm:action="add"> 241 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine> 242 | <Description>Install OpenSSH</Description> 243 | <Order>99</Order> 244 | <RequiresUserInput>true</RequiresUserInput> 245 | </SynchronousCommand> 246 | --> 247 | <!-- END WITHOUT WINDOWS UPDATES --> 248 | <!-- WITH WINDOWS UPDATES 249 | <SynchronousCommand wcm:action="add"> 250 | <CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine> 251 | <Order>98</Order> 252 | <Description>Enable Microsoft Updates</Description> 253 | </SynchronousCommand> 254 | <SynchronousCommand wcm:action="add"> 255 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine> 256 | <Description>Install Windows Updates</Description> 257 | <Order>100</Order> 258 | <RequiresUserInput>true</RequiresUserInput> 259 | </SynchronousCommand> 260 | --> 261 | <!-- END WITH WINDOWS UPDATES --> 262 | </FirstLogonCommands> 263 | <ShowWindowsLive>false</ShowWindowsLive> 264 | </component> 265 | </settings> 266 | <settings pass="specialize"> 267 | <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 268 | <OEMInformation> 269 | <HelpCustomized>false</HelpCustomized> 270 | </OEMInformation> 271 | <ComputerName>talentsearchapi</ComputerName> 272 | <TimeZone>AUS Eastern Standard Time</TimeZone> 273 | <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet> 274 | <RegisteredOwner/> 275 | </component> 276 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 277 | <SkipAutoActivation>true</SkipAutoActivation> 278 | </component> 279 | </settings> 280 | <cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="catalog:d:/sources/install_windows 7 ENTERPRISE.clg"/> 281 | </unattend> 282 | -------------------------------------------------------------------------------- /answer_files/2012_r2/updates/Autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <settings pass="windowsPE"> 4 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 5 | <SetupUILanguage> 6 | <UILanguage>en-US</UILanguage> 7 | </SetupUILanguage> 8 | <InputLocale>en-US</InputLocale> 9 | <SystemLocale>en-US</SystemLocale> 10 | <UILanguage>en-US</UILanguage> 11 | <UILanguageFallback>en-US</UILanguageFallback> 12 | <UserLocale>en-US</UserLocale> 13 | </component> 14 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 15 | <DiskConfiguration> 16 | <Disk wcm:action="add"> 17 | <CreatePartitions> 18 | <CreatePartition wcm:action="add"> 19 | <Type>Primary</Type> 20 | <Order>1</Order> 21 | <Size>350</Size> 22 | </CreatePartition> 23 | <CreatePartition wcm:action="add"> 24 | <Order>2</Order> 25 | <Type>Primary</Type> 26 | <Extend>true</Extend> 27 | </CreatePartition> 28 | </CreatePartitions> 29 | <ModifyPartitions> 30 | <ModifyPartition wcm:action="add"> 31 | <Active>true</Active> 32 | <Format>NTFS</Format> 33 | <Label>boot</Label> 34 | <Order>1</Order> 35 | <PartitionID>1</PartitionID> 36 | </ModifyPartition> 37 | <ModifyPartition wcm:action="add"> 38 | <Format>NTFS</Format> 39 | <Label>Windows 2012 R2</Label> 40 | <Letter>C</Letter> 41 | <Order>2</Order> 42 | <PartitionID>2</PartitionID> 43 | </ModifyPartition> 44 | </ModifyPartitions> 45 | <DiskID>0</DiskID> 46 | <WillWipeDisk>true</WillWipeDisk> 47 | </Disk> 48 | </DiskConfiguration> 49 | <ImageInstall> 50 | <OSImage> 51 | <InstallFrom> 52 | <MetaData wcm:action="add"> 53 | <Key>/IMAGE/NAME </Key> 54 | <Value>Windows Server 2012 R2 SERVERSTANDARD</Value> 55 | </MetaData> 56 | </InstallFrom> 57 | <InstallTo> 58 | <DiskID>0</DiskID> 59 | <PartitionID>2</PartitionID> 60 | </InstallTo> 61 | </OSImage> 62 | </ImageInstall> 63 | <UserData> 64 | <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx --> 65 | <ProductKey> 66 | <!-- Do not uncomment the Key element if you are using trial ISOs --> 67 | <!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs --> 68 | <!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>--> 69 | <WillShowUI>OnError</WillShowUI> 70 | </ProductKey> 71 | <AcceptEula>true</AcceptEula> 72 | <FullName>Vagrant</FullName> 73 | <Organization>Vagrant</Organization> 74 | </UserData> 75 | </component> 76 | </settings> 77 | <settings pass="specialize"> 78 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 79 | <OEMInformation> 80 | <HelpCustomized>false</HelpCustomized> 81 | </OEMInformation> 82 | <ComputerName>vagrant-2012-r2</ComputerName> 83 | <TimeZone>Pacific Standard Time</TimeZone> 84 | <RegisteredOwner/> 85 | </component> 86 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 87 | <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> 88 | </component> 89 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 90 | <IEHardenAdmin>false</IEHardenAdmin> 91 | <IEHardenUser>false</IEHardenUser> 92 | </component> 93 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 94 | <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> 95 | </component> 96 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 97 | <SkipAutoActivation>true</SkipAutoActivation> 98 | </component> 99 | </settings> 100 | <settings pass="oobeSystem"> 101 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 102 | <AutoLogon> 103 | <Password> 104 | <Value>vagrant</Value> 105 | <PlainText>true</PlainText> 106 | </Password> 107 | <Enabled>true</Enabled> 108 | <Username>vagrant</Username> 109 | </AutoLogon> 110 | <FirstLogonCommands> 111 | <SynchronousCommand wcm:action="add"> 112 | <CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Force"</CommandLine> 113 | <Description>Set Execution Policy 64 Bit</Description> 114 | <Order>1</Order> 115 | <RequiresUserInput>true</RequiresUserInput> 116 | </SynchronousCommand> 117 | <SynchronousCommand wcm:action="add"> 118 | <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Force"</CommandLine> 119 | <Description>Set Execution Policy 32 Bit</Description> 120 | <Order>2</Order> 121 | <RequiresUserInput>true</RequiresUserInput> 122 | </SynchronousCommand> 123 | <SynchronousCommand wcm:action="add"> 124 | <CommandLine>cmd.exe /c winrm quickconfig -q</CommandLine> 125 | <Description>winrm quickconfig -q</Description> 126 | <Order>3</Order> 127 | <RequiresUserInput>true</RequiresUserInput> 128 | </SynchronousCommand> 129 | <SynchronousCommand wcm:action="add"> 130 | <CommandLine>cmd.exe /c winrm quickconfig -transport:http</CommandLine> 131 | <Description>winrm quickconfig -transport:http</Description> 132 | <Order>4</Order> 133 | <RequiresUserInput>true</RequiresUserInput> 134 | </SynchronousCommand> 135 | <SynchronousCommand wcm:action="add"> 136 | <CommandLine>cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}</CommandLine> 137 | <Description>Win RM MaxTimoutms</Description> 138 | <Order>5</Order> 139 | <RequiresUserInput>true</RequiresUserInput> 140 | </SynchronousCommand> 141 | <SynchronousCommand wcm:action="add"> 142 | <CommandLine>cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}</CommandLine> 143 | <Description>Win RM MaxMemoryPerShellMB</Description> 144 | <Order>6</Order> 145 | <RequiresUserInput>true</RequiresUserInput> 146 | </SynchronousCommand> 147 | <SynchronousCommand wcm:action="add"> 148 | <CommandLine>cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}</CommandLine> 149 | <Description>Win RM AllowUnencrypted</Description> 150 | <Order>7</Order> 151 | <RequiresUserInput>true</RequiresUserInput> 152 | </SynchronousCommand> 153 | <SynchronousCommand wcm:action="add"> 154 | <CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}</CommandLine> 155 | <Description>Win RM auth Basic</Description> 156 | <Order>8</Order> 157 | <RequiresUserInput>true</RequiresUserInput> 158 | </SynchronousCommand> 159 | <SynchronousCommand wcm:action="add"> 160 | <CommandLine>cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}</CommandLine> 161 | <Description>Win RM client auth Basic</Description> 162 | <Order>9</Order> 163 | <RequiresUserInput>true</RequiresUserInput> 164 | </SynchronousCommand> 165 | <SynchronousCommand wcm:action="add"> 166 | <CommandLine>cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} </CommandLine> 167 | <Description>Win RM listener Address/Port</Description> 168 | <Order>10</Order> 169 | <RequiresUserInput>true</RequiresUserInput> 170 | </SynchronousCommand> 171 | <SynchronousCommand wcm:action="add"> 172 | <CommandLine>cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes </CommandLine> 173 | <Description>Win RM adv firewall enable</Description> 174 | <Order>11</Order> 175 | <RequiresUserInput>true</RequiresUserInput> 176 | </SynchronousCommand> 177 | <SynchronousCommand wcm:action="add"> 178 | <CommandLine>cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" </CommandLine> 179 | <Description>Win RM port open</Description> 180 | <Order>12</Order> 181 | <RequiresUserInput>true</RequiresUserInput> 182 | </SynchronousCommand> 183 | <SynchronousCommand wcm:action="add"> 184 | <CommandLine>cmd.exe /c net stop winrm </CommandLine> 185 | <Description>Stop Win RM Service </Description> 186 | <Order>13</Order> 187 | <RequiresUserInput>true</RequiresUserInput> 188 | </SynchronousCommand> 189 | <SynchronousCommand wcm:action="add"> 190 | <CommandLine>cmd.exe /c sc config winrm start= auto</CommandLine> 191 | <Description>Win RM Autostart</Description> 192 | <Order>14</Order> 193 | <RequiresUserInput>true</RequiresUserInput> 194 | </SynchronousCommand> 195 | <SynchronousCommand wcm:action="add"> 196 | <CommandLine>cmd.exe /c net start winrm</CommandLine> 197 | <Description>Start Win RM Service</Description> 198 | <Order>15</Order> 199 | <RequiresUserInput>true</RequiresUserInput> 200 | </SynchronousCommand> 201 | <SynchronousCommand wcm:action="add"> 202 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> 203 | <Order>16</Order> 204 | <Description>Show file extensions in Explorer</Description> 205 | </SynchronousCommand> 206 | <SynchronousCommand wcm:action="add"> 207 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine> 208 | <Order>17</Order> 209 | <Description>Enable QuickEdit mode</Description> 210 | </SynchronousCommand> 211 | <SynchronousCommand wcm:action="add"> 212 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine> 213 | <Order>18</Order> 214 | <Description>Show Run command in Start Menu</Description> 215 | </SynchronousCommand> 216 | <SynchronousCommand wcm:action="add"> 217 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine> 218 | <Order>19</Order> 219 | <Description>Show Administrative Tools in Start Menu</Description> 220 | </SynchronousCommand> 221 | <SynchronousCommand wcm:action="add"> 222 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine> 223 | <Order>20</Order> 224 | <Description>Zero Hibernation File</Description> 225 | </SynchronousCommand> 226 | <SynchronousCommand wcm:action="add"> 227 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine> 228 | <Order>21</Order> 229 | <Description>Disable Hibernation Mode</Description> 230 | </SynchronousCommand> 231 | <SynchronousCommand wcm:action="add"> 232 | <CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine> 233 | <Order>22</Order> 234 | <Description>Disable password expiration for vagrant user</Description> 235 | </SynchronousCommand> 236 | <SynchronousCommand wcm:action="add"> 237 | <CommandLine>cmd.exe /c powershell -File a:\disable-password-complexity.ps1</CommandLine> 238 | <Description>Disable password complexity</Description> 239 | <Order>23</Order> 240 | <RequiresUserInput>true</RequiresUserInput> 241 | </SynchronousCommand> 242 | <!-- WITHOUT WINDOWS UPDATES 243 | 244 | <SynchronousCommand wcm:action="add"> 245 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine> 246 | <Description>Install OpenSSH</Description> 247 | <Order>99</Order> 248 | <RequiresUserInput>true</RequiresUserInput> 249 | </SynchronousCommand> 250 | --> 251 | 252 | <!-- END WITHOUT WINDOWS UPDATES --> 253 | <!-- WITH WINDOWS UPDATES --> 254 | <SynchronousCommand wcm:action="add"> 255 | <CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine> 256 | <Order>98</Order> 257 | <Description>Enable Microsoft Updates</Description> 258 | </SynchronousCommand> 259 | <SynchronousCommand wcm:action="add"> 260 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine> 261 | <Description>Install Windows Updates</Description> 262 | <Order>100</Order> 263 | <RequiresUserInput>true</RequiresUserInput> 264 | </SynchronousCommand> 265 | <SynchronousCommand wcm:action="add"> 266 | <CommandLine>cmd.exe /c net user vagrant vagrant</CommandLine> 267 | <Description>Set correct vagrant user/pass so Packer can start</Description> 268 | <Order>101</Order> 269 | </SynchronousCommand> 270 | 271 | <!-- END WITH WINDOWS UPDATES --> 272 | </FirstLogonCommands> 273 | <OOBE> 274 | <HideEULAPage>true</HideEULAPage> 275 | <HideLocalAccountScreen>true</HideLocalAccountScreen> 276 | <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> 277 | <HideOnlineAccountScreens>true</HideOnlineAccountScreens> 278 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 279 | <NetworkLocation>Home</NetworkLocation> 280 | <ProtectYourPC>1</ProtectYourPC> 281 | </OOBE> 282 | <UserAccounts> 283 | <AdministratorPassword> 284 | <Value>vagrantnotyet</Value> 285 | <PlainText>true</PlainText> 286 | </AdministratorPassword> 287 | <LocalAccounts> 288 | <LocalAccount wcm:action="add"> 289 | <Password> 290 | <Value>vagrantnotyet</Value> 291 | <PlainText>true</PlainText> 292 | </Password> 293 | <Group>administrators</Group> 294 | <DisplayName>Vagrant</DisplayName> 295 | <Name>vagrant</Name> 296 | <Description>Vagrant User</Description> 297 | </LocalAccount> 298 | </LocalAccounts> 299 | </UserAccounts> 300 | <RegisteredOwner/> 301 | </component> 302 | </settings> 303 | <settings pass="offlineServicing"> 304 | <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> 305 | <EnableLUA>false</EnableLUA> 306 | </component> 307 | </settings> 308 | <cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="wim:c:/wim/install.wim#Windows Server 2012 R2 SERVERSTANDARD"/> 309 | </unattend> 310 | -------------------------------------------------------------------------------- /scripts/BundleConfig.ps1: -------------------------------------------------------------------------------- 1 | $EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\BundleConfig.xml" 2 | $xml = [xml](get-content $EC2SettingsFile) 3 | $xmlElement = $xml.get_DocumentElement() 4 | 5 | foreach ($element in $xmlElement.Property) 6 | { 7 | if ($element.Name -eq "AutoSysprep") 8 | { 9 | $element.Value="Yes" 10 | } 11 | } 12 | $xml.Save($EC2SettingsFile) 13 | -------------------------------------------------------------------------------- /scripts/Ec2Config.ps1: -------------------------------------------------------------------------------- 1 | $EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\Config.xml" 2 | $xml = [xml](get-content $EC2SettingsFile) 3 | $xmlElement = $xml.get_DocumentElement() 4 | $xmlElementToModify = $xmlElement.Plugins 5 | 6 | foreach ($element in $xmlElementToModify.Plugin) 7 | { 8 | if ($element.name -eq "Ec2SetPassword") 9 | { 10 | $element.State="Enabled" 11 | } 12 | elseif ($element.name -eq "Ec2SetComputerName") 13 | { 14 | $element.State="Enabled" 15 | } 16 | elseif ($element.name -eq "Ec2HandleUserData") 17 | { 18 | $element.State="Enabled" 19 | } 20 | } 21 | $xml.Save($EC2SettingsFile) 22 | -------------------------------------------------------------------------------- /scripts/cleanup.ps1: -------------------------------------------------------------------------------- 1 | # Let's cleanup! 2 | # 3 | # See http://www.hurryupandwait.io/blog/in-search-of-a-light-weight-windows-vagrant-box 4 | # for details! 5 | 6 | # Reduce PageFile size 7 | $System = GWMI Win32_ComputerSystem -EnableAllPrivileges 8 | $System.AutomaticManagedPagefile = $False 9 | $System.Put() 10 | 11 | $CurrentPageFile = gwmi -query "select * from Win32_PageFileSetting where name='c:\\pagefile.sys'" 12 | $CurrentPageFile.InitialSize = 512 13 | $CurrentPageFile.MaximumSize = 512 14 | $CurrentPageFile.Put() 15 | 16 | # Cleanup update uninstallers 17 | Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase 18 | 19 | # Run disk cleanup - need to install following and restart 20 | Add-WindowsFeature -Name Desktop-Experience -------------------------------------------------------------------------------- /scripts/cleanup2.ps1: -------------------------------------------------------------------------------- 1 | 2 | # Disk Cleanup - doesn't get rid of anything at this early stage 3 | # Write-Host "cleaning disk..." 4 | # C:\Windows\System32\cleanmgr.exe /d c: /verylowdisk 5 | 6 | # Remove unnecessary features 7 | @('Desktop-Experience', 8 | 'InkAndHandwritingServices', 9 | 'Server-Media-Foundation', 10 | 'Powershell-ISE') | Remove-WindowsFeature 11 | 12 | Get-WindowsFeature | 13 | ? { $_.InstallState -eq 'Available' } | 14 | Uninstall-WindowsFeature -Remove 15 | 16 | # Defrag C 17 | Optimize-Volume -DriveLetter C 18 | 19 | wget http://download.sysinternals.com/files/SDelete.zip -OutFile sdelete.zip 20 | [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") 21 | [System.IO.Compression.ZipFile]::ExtractToDirectory("sdelete.zip", ".") 22 | 23 | reg.exe ADD "HKCU\Software\Sysinternals\SDelete" /v EulaAccepted /t REG_DWORD /d 1 /f 24 | ./sdelete.exe -z c: -------------------------------------------------------------------------------- /scripts/disable-password-complexity.ps1: -------------------------------------------------------------------------------- 1 | # works on Microsoft Windows Server 2008 #carriage return 2 | secedit /export /cfg c:\new.cfg #carriage return 3 | #start-sleep -s 5 #carriage return 4 | ((get-content c:\new.cfg) -replace ('PasswordComplexity = 1', 'PasswordComplexity = 0')) | Out-File c:\new.cfg #carriage return 5 | secedit /configure /db $env:windir\security\new.sdb /cfg c:\new.cfg /areas SECURITYPOLICY #carriage return 6 | Rename-Item c:\new.cfg c:\new.cfg.txt #carriage return 7 | write-host "That's all folks!" #carriage return 8 | rm c:\new.cfg.txt -------------------------------------------------------------------------------- /scripts/ec2-bootstrap.ps1: -------------------------------------------------------------------------------- 1 | <powershell> 2 | write-output "Running User Data Script" 3 | write-host "(host) Running User Data Script" 4 | 5 | # TODO: User should replace password here with something random. Even better, implement over SSL: https://github.com/packer-community/packer-windows-plugins/issues/30 6 | # Also note, this user should be removed in Cfn Init 7 | cmd.exe /c net user /add vagrant FooBar@123 8 | cmd.exe /c net localgroup administrators vagrant /add 9 | 10 | Set-ExecutionPolicy -ExecutionPolicy bypass -Force 11 | 12 | # RDP 13 | cmd.exe /c netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389 14 | cmd.exe /c reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f 15 | 16 | # WinRM 17 | write-output "Setting up WinRM" 18 | write-host "(host) setting up WinRM" 19 | 20 | cmd.exe /c winrm quickconfig -q 21 | cmd.exe /c winrm quickconfig '-transport:http' 22 | cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}' 23 | cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="512"}' 24 | cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}' 25 | cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}' 26 | cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}' 27 | cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}' 28 | cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}' 29 | cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTP" '@{Port="5985"}' 30 | cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes 31 | cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" 32 | cmd.exe /c net stop winrm 33 | cmd.exe /c sc config winrm start= auto 34 | cmd.exe /c net start winrm 35 | cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE 36 | 37 | </powershell> 38 | -------------------------------------------------------------------------------- /scripts/ec2-user-data.ps1: -------------------------------------------------------------------------------- 1 | <powershell> 2 | write-output "Running User Data Script" 3 | write-host "(host) Running User Data Script" 4 | 5 | cmd.exe /c net user /add vagrant FooBar@123 6 | cmd.exe /c net localgroup administrators vagrant /add 7 | 8 | Set-ExecutionPolicy -ExecutionPolicy bypass -Force 9 | 10 | # WinRM 11 | write-output "Setting up WinRM" 12 | write-host "(host) setting up WinRM" 13 | 14 | cmd.exe /c winrm quickconfig -q 15 | cmd.exe /c winrm quickconfig '-transport:http' 16 | cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}' 17 | cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="512"}' 18 | cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}' 19 | cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}' 20 | cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}' 21 | cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}' 22 | cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}' 23 | cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTP" '@{Port="5985"}' 24 | cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes 25 | cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" 26 | cmd.exe /c net stop winrm 27 | cmd.exe /c sc config winrm start= auto 28 | cmd.exe /c net start winrm 29 | cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE 30 | 31 | </powershell> 32 | -------------------------------------------------------------------------------- /scripts/microsoft-updates.bat: -------------------------------------------------------------------------------- 1 | net stop wuauserv 2 | 3 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v EnableFeaturedSoftware /t REG_DWORD /d 1 /f 4 | 5 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v IncludeRecommendedUpdates /t REG_DWORD /d 1 /f 6 | 7 | echo Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager") > A:\temp.vbs 8 | echo Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") >> A:\temp.vbs 9 | 10 | cscript A:\temp.vbs 11 | 12 | net start wuauserv -------------------------------------------------------------------------------- /scripts/openssh.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [switch]$AutoStart = $false 3 | ) 4 | 5 | Write-Host "AutoStart: $AutoStart" 6 | $is_64bit = [IntPtr]::size -eq 8 7 | 8 | # setup openssh 9 | $ssh_download_url = "http://www.mls-software.com/files/setupssh-6.6p1-1.exe" 10 | if ($is_64bit) { 11 | Write-Host "64 bit OS found" 12 | $ssh_download_url = "http://www.mls-software.com/files/setupssh-6.6p1-1(x64).exe" 13 | } 14 | 15 | if (!(Test-Path "C:\Program Files\OpenSSH\bin\ssh.exe")) { 16 | Write-Host "Downloading $ssh_download_url" 17 | (New-Object System.Net.WebClient).DownloadFile($ssh_download_url, "C:\Windows\Temp\openssh.exe") 18 | Start-Process "C:\Windows\Temp\openssh.exe" "/S /port=22 /privsep=1 /password=D@rj33l1ng" -NoNewWindow -Wait 19 | } 20 | 21 | Stop-Service "OpenSSHd" -Force 22 | 23 | # ensure vagrant can log in 24 | Write-Host "Setting vagrant user file permissions" 25 | New-Item -ItemType Directory -Force -Path "C:\Users\vagrant\.ssh" 26 | C:\Windows\System32\icacls.exe "C:\Users\vagrant" /grant "vagrant:(OI)(CI)F" 27 | C:\Windows\System32\icacls.exe "C:\Program Files\OpenSSH\bin" /grant "vagrant:(OI)RX" 28 | C:\Windows\System32\icacls.exe "C:\Program Files\OpenSSH\usr\sbin" /grant "vagrant:(OI)RX" 29 | 30 | Write-Host "Setting SSH home directories" 31 | (Get-Content "C:\Program Files\OpenSSH\etc\passwd") | 32 | Foreach-Object { $_ -replace '/home/(\w+)', '/cygdrive/c/Users/$1' } | 33 | Set-Content 'C:\Program Files\OpenSSH\etc\passwd' 34 | 35 | # Set shell to /bin/sh to return exit status 36 | $passwd_file = Get-Content 'C:\Program Files\OpenSSH\etc\passwd' 37 | $passwd_file = $passwd_file -replace '/bin/bash', '/bin/sh' 38 | Set-Content 'C:\Program Files\OpenSSH\etc\passwd' $passwd_file 39 | 40 | # fix opensshd to not be strict 41 | Write-Host "Setting OpenSSH to be non-strict" 42 | $sshd_config = Get-Content "C:\Program Files\OpenSSH\etc\sshd_config" 43 | $sshd_config = $sshd_config -replace 'StrictModes yes', 'StrictModes no' 44 | $sshd_config = $sshd_config -replace '#PubkeyAuthentication yes', 'PubkeyAuthentication yes' 45 | $sshd_config = $sshd_config -replace '#PermitUserEnvironment no', 'PermitUserEnvironment yes' 46 | # disable the use of DNS to speed up the time it takes to establish a connection 47 | $sshd_config = $sshd_config -replace '#UseDNS yes', 'UseDNS no' 48 | # disable the login banner 49 | $sshd_config = $sshd_config -replace 'Banner /etc/banner.txt', '#Banner /etc/banner.txt' 50 | Set-Content "C:\Program Files\OpenSSH\etc\sshd_config" $sshd_config 51 | 52 | # use c:\Windows\Temp as /tmp location 53 | Write-Host "Setting temp directory location" 54 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "C:\Program Files\OpenSSH\tmp" 55 | C:\Program` Files\OpenSSH\bin\junction.exe /accepteula "C:\Program Files\OpenSSH\tmp" "C:\Windows\Temp" 56 | C:\Windows\System32\icacls.exe "C:\Windows\Temp" /grant "vagrant:(OI)(CI)F" 57 | 58 | # add 64 bit environment variables missing from SSH 59 | Write-Host "Setting SSH environment" 60 | $sshenv = "TEMP=C:\Windows\Temp" 61 | if ($is_64bit) { 62 | $env_vars = "ProgramFiles(x86)=C:\Program Files (x86)", ` 63 | "ProgramW6432=C:\Program Files", ` 64 | "CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files", ` 65 | "CommonProgramW6432=C:\Program Files\Common Files" 66 | $sshenv = $sshenv + "`r`n" + ($env_vars -join "`r`n") 67 | } 68 | Set-Content C:\Users\vagrant\.ssh\environment $sshenv 69 | 70 | # record the path for provisioners (without the newline) 71 | Write-Host "Recording PATH for provisioners" 72 | Set-Content C:\Windows\Temp\PATH ([byte[]][char[]] $env:PATH) -Encoding Byte 73 | 74 | # configure firewall 75 | Write-Host "Configuring firewall" 76 | netsh advfirewall firewall add rule name="SSHD" dir=in action=allow service=OpenSSHd enable=yes 77 | netsh advfirewall firewall add rule name="SSHD" dir=in action=allow program="C:\Program Files\OpenSSH\usr\sbin\sshd.exe" enable=yes 78 | netsh advfirewall firewall add rule name="ssh" dir=in action=allow protocol=TCP localport=22 79 | 80 | Start-Service "OpenSSHd" 81 | 82 | Write-Host "Adding the default vagrant public key to ~/.ssh/authorized_keys:" 83 | Set-Content C:\Users\vagrant\.ssh\authorized_keys "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" -------------------------------------------------------------------------------- /scripts/oracle-cert.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefellows/packer-community-templates/c34276519a26b83d9ccd64dc91f1b279efc2aaad/scripts/oracle-cert.cer -------------------------------------------------------------------------------- /scripts/parallels-guest-tools.ps1: -------------------------------------------------------------------------------- 1 | cp C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp -Force 2 | & "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels 3 | C:\Windows\Temp\parallels\Autorun.exe /S 4 | 5 | Start-Sleep -s 60 -------------------------------------------------------------------------------- /scripts/provision.ps1: -------------------------------------------------------------------------------- 1 | # Enable basic Web Server features 2 | Install-WindowsFeature Web-Server 3 | Install-WindowsFeature Web-Mgmt-Tools 4 | Install-WindowsFeature Web-App-Dev -IncludeAllSubFeature 5 | 6 | # Install .NET and related tools so we can build/test/CI. 7 | choco install seek-dsc -y 8 | choco install netfx-4.5.1-devpack -y 9 | choco install microsoft-build-tools -y 10 | choco install vs2013agents -y 11 | Install-WindowsFeature NET-Framework-Core # needs to be here otherwise other packages above don't install 12 | 13 | # F# Bundle 14 | cd $env:TEMP 15 | $webclient = New-Object Net.WebClient 16 | $url = 'http://download.microsoft.com/download/E/A/3/EA38D9B8-E00F-433F-AAB5-9CDA28BA5E7D/FSharp_Bundle.exe' 17 | $webclient.DownloadFile($url, "$pwd\FSharp_Bundle.exe") 18 | .\FSharp_Bundle.exe /install /quiet -------------------------------------------------------------------------------- /scripts/rsync.bat: -------------------------------------------------------------------------------- 1 | rem install rsync 2 | if not exist "C:\Windows\Temp\7z920-x64.msi" ( 3 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/sevenzip/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL 4 | ) 5 | msiexec /qb /i C:\Windows\Temp\7z920-x64.msi 6 | 7 | pushd C:\Windows\Temp 8 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/rsync/rsync-3.1.0-1.tar.xz', 'C:\Windows\Temp\rsync-3.1.0-1.tar.xz')" <NUL 9 | cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar.xz" 10 | cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar" 11 | copy /Y usr\bin\rsync.exe "C:\Program Files\OpenSSH\bin\rsync.exe" 12 | rmdir /s /q usr 13 | del rsync-3.1.0-1.tar 14 | popd 15 | 16 | msiexec /qb /x C:\Windows\Temp\7z920-x64.msi 17 | 18 | rem make symlink for c:/vagrant share 19 | mklink /D "C:\Program Files\OpenSSH\vagrant" "C:\vagrant" 20 | -------------------------------------------------------------------------------- /scripts/virtualbox-guest-tools.ps1: -------------------------------------------------------------------------------- 1 | # If the ISO is uploaded, unzip and install 2 | if ( Test-Path "C:\Users\vagrant\VBoxGuestAdditions.iso" ) { 3 | # There needs to be Oracle CA (Certificate Authority) certificates installed in order 4 | # to prevent user intervention popups which will undermine a silent installation. 5 | cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer 6 | 7 | # We also need to download 7zip... 8 | if ( -not ( Test-Path "C:\Windows\Temp\7z920-x64.msi") -and -not( get-command '7z' -ErrorAction SilentlyContinue ) ) { 9 | cmd /c powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softlayer-sng.dl.sourceforge.net/project/sevenzip/7-Zip/9.38/7z938-extra.7z', 'C:\Windows\Temp\7z920-x64.msi')" 10 | cmd /c msiexec /qb /i C:\Windows\Temp\7z920-x64.msi 11 | } 12 | cmd /c move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp 13 | cmd /c "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox 14 | cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S 15 | rm C:\Windows\Temp\VBoxGuestAdditions.iso 16 | } -------------------------------------------------------------------------------- /scripts/win-updates.ps1: -------------------------------------------------------------------------------- 1 | param($global:RestartRequired=0, 2 | $global:MoreUpdates=0, 3 | $global:MaxCycles=5) 4 | 5 | function Check-ContinueRestartOrEnd() { 6 | $RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" 7 | $RegistryEntry = "InstallWindowsUpdates" 8 | switch ($global:RestartRequired) { 9 | 0 { 10 | $prop = (Get-ItemProperty $RegistryKey).$RegistryEntry 11 | if ($prop) { 12 | Write-Host "Restart Registry Entry Exists - Removing It" 13 | Remove-ItemProperty -Path $RegistryKey -Name $RegistryEntry -ErrorAction SilentlyContinue 14 | } 15 | 16 | Write-Host "No Restart Required" 17 | Check-WindowsUpdates 18 | 19 | if (($global:MoreUpdates -eq 1) -and ($script:Cycles -le $global:MaxCycles)) { 20 | Install-WindowsUpdates 21 | } elseif ($script:Cycles -gt $global:MaxCycles) { 22 | Write-Host "Exceeded Cycle Count - Stopping" 23 | } else { 24 | Write-Host "Done Installing Windows Updates" 25 | Invoke-Expression "a:\openssh.ps1 -AutoStart" 26 | } 27 | } 28 | 1 { 29 | $prop = (Get-ItemProperty $RegistryKey).$RegistryEntry 30 | if (-not $prop) { 31 | Write-Host "Restart Registry Entry Does Not Exist - Creating It" 32 | Set-ItemProperty -Path $RegistryKey -Name $RegistryEntry -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File $($script:ScriptPath)" 33 | } else { 34 | Write-Host "Restart Registry Entry Exists Already" 35 | } 36 | 37 | Write-Host "Restart Required - Restarting..." 38 | Restart-Computer 39 | } 40 | default { 41 | Write-Host "Unsure If A Restart Is Required" 42 | break 43 | } 44 | } 45 | } 46 | 47 | function Install-WindowsUpdates() { 48 | $script:Cycles++ 49 | Write-Host 'Evaluating Available Updates:' 50 | $UpdatesToDownload = New-Object -ComObject 'Microsoft.Update.UpdateColl' 51 | foreach ($Update in $SearchResult.Updates) { 52 | if (($Update -ne $null) -and (!$Update.IsDownloaded)) { 53 | [bool]$addThisUpdate = $false 54 | if ($Update.InstallationBehavior.CanRequestUserInput) { 55 | Write-Host "> Skipping: $($Update.Title) because it requires user input" 56 | } else { 57 | if (!($Update.EulaAccepted)) { 58 | Write-Host "> Note: $($Update.Title) has a license agreement that must be accepted. Accepting the license." 59 | $Update.AcceptEula() 60 | [bool]$addThisUpdate = $true 61 | } else { 62 | [bool]$addThisUpdate = $true 63 | } 64 | } 65 | 66 | if ([bool]$addThisUpdate) { 67 | Write-Host "Adding: $($Update.Title)" 68 | $UpdatesToDownload.Add($Update) |Out-Null 69 | } 70 | } 71 | } 72 | 73 | if ($UpdatesToDownload.Count -eq 0) { 74 | Write-Host "No Updates To Download..." 75 | } else { 76 | Write-Host 'Downloading Updates...' 77 | $Downloader = $UpdateSession.CreateUpdateDownloader() 78 | $Downloader.Updates = $UpdatesToDownload 79 | $Downloader.Download() 80 | } 81 | 82 | $UpdatesToInstall = New-Object -ComObject 'Microsoft.Update.UpdateColl' 83 | [bool]$rebootMayBeRequired = $false 84 | Write-Host 'The following updates are downloaded and ready to be installed:' 85 | foreach ($Update in $SearchResult.Updates) { 86 | if (($Update.IsDownloaded)) { 87 | Write-Host "> $($Update.Title)" 88 | $UpdatesToInstall.Add($Update) |Out-Null 89 | 90 | if ($Update.InstallationBehavior.RebootBehavior -gt 0){ 91 | [bool]$rebootMayBeRequired = $true 92 | } 93 | } 94 | } 95 | 96 | if ($UpdatesToInstall.Count -eq 0) { 97 | Write-Host 'No updates available to install...' 98 | $global:MoreUpdates=0 99 | $global:RestartRequired=0 100 | Invoke-Expression "a:\openssh.ps1 -AutoStart" 101 | break 102 | } 103 | 104 | if ($rebootMayBeRequired) { 105 | Write-Host 'These updates may require a reboot' 106 | $global:RestartRequired=1 107 | } 108 | 109 | Write-Host 'Installing updates...' 110 | 111 | $Installer = $script:UpdateSession.CreateUpdateInstaller() 112 | $Installer.Updates = $UpdatesToInstall 113 | $InstallationResult = $Installer.Install() 114 | 115 | Write-Host "Installation Result: $($InstallationResult.ResultCode)" 116 | Write-Host "Reboot Required: $($InstallationResult.RebootRequired)" 117 | Write-Host 'Listing of updates installed and individual installation results:' 118 | if ($InstallationResult.RebootRequired) { 119 | $global:RestartRequired=1 120 | } else { 121 | $global:RestartRequired=0 122 | } 123 | 124 | for($i=0; $i -lt $UpdatesToInstall.Count; $i++) { 125 | New-Object -TypeName PSObject -Property @{ 126 | Title = $UpdatesToInstall.Item($i).Title 127 | Result = $InstallationResult.GetUpdateResult($i).ResultCode 128 | } 129 | } 130 | 131 | Check-ContinueRestartOrEnd 132 | } 133 | 134 | function Check-WindowsUpdates() { 135 | Write-Host "Checking For Windows Updates" 136 | $Username = $env:USERDOMAIN + "\" + $env:USERNAME 137 | 138 | New-EventLog -Source $ScriptName -LogName 'Windows Powershell' -ErrorAction SilentlyContinue 139 | 140 | $Message = "Script: " + $ScriptPath + "`nScript User: " + $Username + "`nStarted: " + (Get-Date).toString() 141 | 142 | Write-EventLog -LogName 'Windows Powershell' -Source $ScriptName -EventID "104" -EntryType "Information" -Message $Message 143 | Write-Host $Message 144 | 145 | $script:UpdateSearcher = $script:UpdateSession.CreateUpdateSearcher() 146 | $script:SearchResult = $script:UpdateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") 147 | if ($SearchResult.Updates.Count -ne 0) { 148 | $script:SearchResult.Updates |Select-Object -Property Title, Description, SupportUrl, UninstallationNotes, RebootRequired, EulaAccepted |Format-List 149 | $global:MoreUpdates=1 150 | } else { 151 | Write-Host 'There are no applicable updates' 152 | $global:RestartRequired=0 153 | $global:MoreUpdates=0 154 | } 155 | } 156 | 157 | $script:ScriptName = $MyInvocation.MyCommand.ToString() 158 | $script:ScriptPath = $MyInvocation.MyCommand.Path 159 | $script:UpdateSession = New-Object -ComObject 'Microsoft.Update.Session' 160 | $script:UpdateSession.ClientApplicationID = 'Packer Windows Update Installer' 161 | $script:UpdateSearcher = $script:UpdateSession.CreateUpdateSearcher() 162 | $script:SearchResult = New-Object -ComObject 'Microsoft.Update.UpdateColl' 163 | $script:Cycles = 0 164 | 165 | Check-WindowsUpdates 166 | if ($global:MoreUpdates -eq 1) { 167 | Install-WindowsUpdates 168 | } else { 169 | Check-ContinueRestartOrEnd 170 | } -------------------------------------------------------------------------------- /scripts/winrmconfig.bat: -------------------------------------------------------------------------------- 1 | cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy bypass -Force" 2 | Set-Item WSMan:\localhost\Client\TrustedHosts -Value * -Force 3 | Restart-Service WinRM 4 | winrm quickconfig -q 5 | winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="512"}' 6 | winrm set "winrm/config" '@{MaxTimeoutms="1800000"}' 7 | winrm set "winrm/config/service" '@{AllowUnencrypted="true"}' 8 | winrm set "winrm/config/client" '@{AllowUnencrypted="true"}' 9 | winrm set "winrm/config/service/auth" '@{Basic="true"}' 10 | winrm set "winrm/config/client/auth" '@{CredSSP="true"}' 11 | winrm set "winrm/config/service/auth" '@{CredSSP="true"}' 12 | 13 | # Need to run this on client and server 14 | Enable-WSManCredSSP -role client -delegatecomputer * -force 15 | Enable-WSManCredSSP -role client -delegatecomputer *.seek.int -force 16 | Enable-WSManCredSSP -role server -force 17 | Restart-Service WinRM 18 | 19 | C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy bypass -Force" 20 | cmd.exe /c winrm quickconfig -q 21 | cmd.exe /c winrm quickconfig '-transport:http' 22 | cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}' 23 | cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="512"}' 24 | cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}' 25 | cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}' 26 | cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}' 27 | cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}' 28 | cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}' 29 | cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTP" '@{Port="5985"}' 30 | cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes 31 | cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" 32 | cmd.exe /c net stop winrm 33 | cmd.exe /c sc config winrm start= auto 34 | cmd.exe /c net start winrm 35 | 36 | cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE 37 | -------------------------------------------------------------------------------- /vagrantfile-windows_2012_r2.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.require_version ">= 1.6.2" 5 | 6 | Vagrant.configure("2") do |config| 7 | config.vm.define "vagrant-windows-2012" 8 | config.vm.box = "windows2012r2" 9 | config.vm.communicator = "winrm" 10 | 11 | # Admin user name and password 12 | config.winrm.username = "vagrant" 13 | config.winrm.password = "vagrant" 14 | 15 | config.vm.guest = :windows 16 | config.windows.halt_timeout = 15 17 | 18 | config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true 19 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 20 | config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true 21 | 22 | config.vm.provider :virtualbox do |v, override| 23 | v.gui = true 24 | v.customize ["modifyvm", :id, "--memory", 2048] 25 | v.customize ["modifyvm", :id, "--cpus", 2] 26 | v.customize ["modifyvm", :id, "--vram", 64] 27 | v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ] 28 | end 29 | 30 | config.vm.provider :vmware_fusion do |v, override| 31 | v.gui = true 32 | v.vmx["memsize"] = "2048" 33 | v.vmx["numvcpus"] = "2" 34 | v.vmx["ethernet0.virtualDev"] = "vmxnet3" 35 | v.vmx["RemoteDisplay.vnc.enabled"] = "false" 36 | v.vmx["RemoteDisplay.vnc.port"] = "5900" 37 | v.vmx["scsi0.virtualDev"] = "lsisas1068" 38 | end 39 | 40 | config.vm.provider :vmware_workstation do |v, override| 41 | v.gui = true 42 | v.vmx["memsize"] = "2048" 43 | v.vmx["numvcpus"] = "2" 44 | v.vmx["ethernet0.virtualDev"] = "vmxnet3" 45 | v.vmx["RemoteDisplay.vnc.enabled"] = "false" 46 | v.vmx["RemoteDisplay.vnc.port"] = "5900" 47 | v.vmx["scsi0.virtualDev"] = "lsisas1068" 48 | end 49 | end 50 | --------------------------------------------------------------------------------