Skip to content

Commit

Permalink
Scripts to setup and install Windows 7, 8.1, 08 R2, and 2012 R2, Closes
Browse files Browse the repository at this point in the history
#4, Closes #5, Closes #7, Closes #8
  • Loading branch information
ION28 committed Mar 5, 2018
1 parent 71910a0 commit 3d6dc1e
Show file tree
Hide file tree
Showing 14 changed files with 1,230 additions and 24 deletions.
287 changes: 287 additions & 0 deletions Packer/windows_x64/answer_files/2008_r2/Autounattend.xml

Large diffs are not rendered by default.

289 changes: 289 additions & 0 deletions Packer/windows_x64/answer_files/7/Autounattend.xml

Large diffs are not rendered by default.

288 changes: 288 additions & 0 deletions Packer/windows_x64/answer_files/81/Autounattend.xml

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion Packer/windows_x64/floppy/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Floppy Scripts Dependencies by OS:

## Windows 7:


## Windows 8.1:


## Windows 10:
* PinTo10.exe
* WindowsPowershell.lnk

## Windows Server 2012:
## Windows Server 2008 R2:


## Windows Server 2012 R2:


## Windows Server 2016:
Expand Down
43 changes: 42 additions & 1 deletion Packer/windows_x64/scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Script Dependencies by OS:

## Windows 7:
* compact.bat
* disable-screensaver.ps1
* disable-winrm.ps1
* enable-rdp.bat
* enable-winrm.ps1
* hotfix-KB3102810.bat
* microsoft-updates.bat
* oracle-cert.cer
* set-winrm-automatic.bat
* uac-enable.bat
* vm-guest-tools.bat
* win-updates.ps1

## Windows 8.1:
* compact.bat
* compile-dotnet-assemblies.bat
* disable-screensaver.ps1
* disable-winrm.ps1
* enable-rdp.bat
* enable-winrm.ps1
* microsoft-updates.bat
* oracle-cert.cer
* set-winrm-automatic.bat
* uac-enable.bat
* vm-guest-tools.bat
* win-updates.ps1

## Windows 10:
* compact.bat
* compile-dotnet-assemblies.bat
Expand All @@ -20,7 +48,20 @@
* vm-guest-tools.bat
* win-updates.ps1

## Windows Server 2012:
## Windows Server 2008 R2:
* compact.bat
* disable-screensaver.ps1
* disable-winrm.ps1
* enable-rdp.bat
* enable-winrm.ps1
* microsoft-updates.bat
* oracle-cert.cer
* set-winrm-automatic.bat
* uac-enable.bat
* vm-guest-tools.bat
* win-updates.ps1

## Windows Server 2012 R2:
* compact.bat
* compile-dotnet-assemblies.bat
* disable-screensaver.ps1
Expand Down
21 changes: 21 additions & 0 deletions Packer/windows_x64/scripts/hotfix-KB3102810.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
:: Windows 7 SP1 require KB3102810 hotfix
:: Installing and searching for updates is slow and high CPU usage occurs in Windows 7.
:: https://support.microsoft.com/en-us/kb/3102810

@echo off

@powershell -NoProfile -ExecutionPolicy Bypass -Command "((new-object net.webclient).DownloadFile('https://download.microsoft.com/download/F/A/A/FAABD5C2-4600-45F8-96F1-B25B137E3C87/Windows6.1-KB3102810-x64.msu', 'C:\Windows\Temp\Windows6.1-KB3102810-x64.msu'))"

set hotfix="C:\Windows\Temp\Windows6.1-KB3102810-x64.msu"
if not exist %hotfix% goto :eof

:: get windows version
for /f "tokens=2 delims=[]" %%G in ('ver') do (set _version=%%G)
for /f "tokens=2,3,4 delims=. " %%G in ('echo %_version%') do (set _major=%%G& set _minor=%%H& set _build=%%I)

:: 6.1
if %_major% neq 6 goto :eof
if %_minor% lss 1 goto :eof

@echo on
start /wait wusa "%hotfix%" /quiet
71 changes: 71 additions & 0 deletions Packer/windows_x64/windows_7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"builders": [{
"type": "virtualbox-iso",
"vm_name": "windows_7",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"boot_wait": "4m",
"boot_command": "",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "8h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows7_64",
"guest_additions_mode": "disable",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/hotfix-KB3102810.bat",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1",
"./scripts/oracle-cert.cer"
],
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"]
]
}],
"provisioners": [
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/vm-guest-tools.bat",
"./scripts/enable-rdp.bat"
]
},
{
"type": "windows-restart"
},
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/set-winrm-automatic.bat",
"./scripts/uac-enable.bat",
"./scripts/compact.bat"
]
}
],
"post-processors": [
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "../../Boxes/windows_x64/windows_7_{{.Provider}}.box",
"vagrantfile_template": "windows_7_vagrantfile.template"
}
],
"variables": {
"iso_url": "http://care.dlservice.microsoft.com/dl/download/evalx/win7/x64/EN/7600.16385.090713-1255_x64fre_enterprise_en-us_EVAL_Eval_Enterprise-GRMCENXEVAL_EN_DVD.iso",
"iso_checksum_type": "md5",
"iso_checksum": "1d0d239a252cb53e466d39e752b17c28",
"autounattend": "./answer_files/7/Autounattend.xml",
"disk_size": "61440"
}
}
27 changes: 27 additions & 0 deletions Packer/windows_x64/windows_7_vagrantfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.require_version ">= 1.6.2"

Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows-7"
config.vm.box = "windows_7"
config.vm.communicator = "winrm"

# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"

config.vm.guest = :windows
config.windows.halt_timeout = 15

config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true

config.vm.provider :virtualbox do |v, override|
#v.gui = true
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
end
end
71 changes: 71 additions & 0 deletions Packer/windows_x64/windows_81.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"builders": [{
"type": "virtualbox-iso",
"vm_name": "windows_81",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"boot_wait": "4m",
"boot_command": "",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "6h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows81_64",
"guest_additions_mode": "disable",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1",
"./scripts/oracle-cert.cer"
],
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"]
]
}],
"provisioners": [
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/vm-guest-tools.bat",
"./scripts/enable-rdp.bat"
]
},
{
"type": "windows-restart"
},
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/set-winrm-automatic.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/uac-enable.bat",
"./scripts/compact.bat"
]
}
],
"post-processors": [
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "../../Boxes/windows_x64/windows_81_{{.Provider}}.box",
"vagrantfile_template": "windows_81_vagrantfile.template"
}
],
"variables": {
"iso_url": "http://download.microsoft.com/download/B/9/9/B999286E-0A47-406D-8B3D-5B5AD7373A4A/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_ENTERPRISE_EVAL_EN-US-IRM_CENA_X64FREE_EN-US_DV5.ISO",
"iso_checksum_type": "md5",
"iso_checksum": "5e4ecb86fd8619641f1d58f96e8561ec",
"autounattend": "./answer_files/81/Autounattend.xml",
"disk_size": "61440"
}
}
27 changes: 27 additions & 0 deletions Packer/windows_x64/windows_81_vagrantfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.require_version ">= 1.6.2"

Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows-81"
config.vm.box = "windows_81"
config.vm.communicator = "winrm"

# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"

config.vm.guest = :windows
config.windows.halt_timeout = 15

config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true

config.vm.provider :virtualbox do |v, override|
#v.gui = true
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
end
end
68 changes: 68 additions & 0 deletions Packer/windows_x64/windows_server_2008_r2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"builders": [{
"type": "virtualbox-iso",
"vm_name": "windows_server_2008_r2",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"boot_wait": "4m",
"boot_command": "",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "8h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows2008_64",
"guest_additions_mode": "disable",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1",
"./scripts/oracle-cert.cer"
],
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"]
]
}],
"provisioners": [
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/vm-guest-tools.bat",
"./scripts/enable-rdp.bat"
]
},
{
"type": "windows-restart"
},
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/set-winrm-automatic.bat",
"./scripts/uac-enable.bat",
"./scripts/compact.bat"
]
}
],
"post-processors": [{
"type": "vagrant",
"keep_input_artifact": false,
"output": "../../Boxes/windows_x64/windows_server_2008_r2_{{.Provider}}.box",
"vagrantfile_template": "windows_server_2008_r2_vagrantfile.template"
}],
"variables": {
"iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso",
"iso_checksum_type": "md5",
"iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5",
"autounattend": "./answer_files/2008_r2/Autounattend.xml",
"disk_size": "61440"
}
}
27 changes: 27 additions & 0 deletions Packer/windows_x64/windows_server_2008_r2_vagrantfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.require_version ">= 1.6.2"

Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows-2008-r2"
config.vm.box = "windows_server_2008_r2"
config.vm.communicator = "winrm"

# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"

config.vm.guest = :windows
config.windows.halt_timeout = 15

config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true

config.vm.provider :virtualbox do |v, override|
#v.gui = true
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
end
end
Loading

0 comments on commit 3d6dc1e

Please sign in to comment.