├── .gitignore ├── .rspec ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README-libvirt.md ├── README.md ├── Rakefile ├── VERSION ├── data ├── GeoTrust_Global_CA.pem ├── bginfo │ ├── BGFormat.bgi │ ├── ComputerModel.vbs │ ├── OSArchitecture.vbs │ ├── OnlyIPv4Address.vbs │ ├── OnlyIPv6Address.vbs │ ├── OperatingSystemInformation.vbs │ └── Set-Background.lnk ├── drivers │ └── virtio-win-0.1-100 │ │ └── win7 │ │ └── amd64 │ │ ├── netkvm.cat │ │ ├── netkvm.inf │ │ ├── netkvm.sys │ │ ├── netkvmco.dll │ │ ├── netkvmtemporarycert.cer │ │ ├── viostor.cat │ │ ├── viostor.inf │ │ ├── viostor.pdb │ │ └── viostor.sys ├── inin.jpg ├── vagrant.jpg └── vagrant.pub ├── exec.rb ├── iso └── .gitkeep ├── publish.sh ├── scripts ├── 00-run-all-scripts.cmd ├── 01-config-os.cmd ├── 02-config-posh.cmd ├── 02-fix-network.ps1 ├── 03-config-winrm.cmd ├── 04-install-imdisk.cmd ├── 04-install-openssh.cmd ├── 99-start-services.cmd ├── Backup-Logs.ps1 ├── Get-Checksum.ps1 ├── Set-AccountPicture.ps1 ├── _packer_config.cmd ├── centos-cleanup.sh ├── check-dotnet452.ps1 ├── check-icserver.ps1 ├── config-network.sh ├── config-shell.ps1 ├── create-user-vagrant.sh ├── disable-update.ps1 ├── enable-update.ps1 ├── install-chocolatey.ps1 ├── install-dotnet35.ps1 ├── install-dotnet452.ps1 ├── install-gui.ps1 ├── install-icextras.ps1 ├── install-icfirmware.ps1 ├── install-icpatch.ps1 ├── install-icserver.ps1 ├── install-puppet-modules.cmd ├── install-vmhost-additions.ps1 ├── install-vmhost-additions.sh ├── mount-iso.ps1 ├── prep-share.ps1 └── unmount-iso.ps1 ├── sources.json ├── spec ├── Vagrantfile ├── packages_spec.rb ├── ports_spec.rb ├── spec_helpers.rb └── vmtools_spec.rb └── templates ├── centos-7 ├── config.json ├── ks.cfg ├── packer.json └── vagrantfile.template ├── cic ├── Autounattend.xml ├── config.json ├── packer.json └── vagrantfile.template ├── metadata.json.erb ├── windows-10-enterprise-eval ├── Autounattend.xml ├── config.json ├── packer.json └── vagrantfile.template ├── windows-2012R2-core-standard-eval ├── Autounattend.xml ├── config.json ├── packer.json └── vagrantfile.template ├── windows-2012R2-full-standard-eval ├── Autounattend.xml ├── config.json ├── packer.json └── vagrantfile.template └── windows-8.1-enterprise-eval ├── Autounattend.xml ├── config.json ├── packer.json └── vagrantfile.template /.gitignore: -------------------------------------------------------------------------------- 1 | # Cache objects 2 | packer_cache/ 3 | 4 | # iso files 5 | iso/ 6 | 7 | # For built boxes 8 | output-*/ 9 | output/ 10 | output 11 | boxes/ 12 | boxes 13 | *.box 14 | 15 | # test box 16 | templates/test/ 17 | 18 | # temp folder 19 | tmp/ 20 | 21 | # log folder 22 | log/ 23 | 24 | # vagrant folder 25 | .vagrant/ 26 | 27 | # Bundler folder 28 | .bundle/ 29 | 30 | # Bundler Gemfile. 31 | Gemfile.lock 32 | 33 | # .GitEye 34 | /.project 35 | 36 | # Packages 37 | # it's better to unpack these files and commit the raw source 38 | # git has its own built in compression methods 39 | *.7z 40 | *.dmg 41 | *.gz 42 | *.iso 43 | *.jar 44 | *.rar 45 | *.tar 46 | *.zip 47 | 48 | # Backup files 49 | *~ 50 | *.swp 51 | *.bak 52 | 53 | # OS generated files 54 | .DS_Store 55 | .DS_Store? 56 | ._* 57 | .Spotlight-V100 58 | .Trashes 59 | Icon? 60 | ehthumbs.db 61 | Thumbs.db 62 | 63 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format documentation 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "rake" 4 | gem "serverspec" 5 | gem "winrm" 6 | gem "rest-client" 7 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | akami (1.2.2) 5 | gyoku (>= 0.4.0) 6 | nokogiri 7 | builder (3.2.2) 8 | diff-lcs (1.2.5) 9 | domain_name (0.5.20160309) 10 | unf (>= 0.0.5, < 1.0.0) 11 | ffi (1.9.6) 12 | ffi (1.9.6-x64-mingw32) 13 | gssapi (1.0.3) 14 | ffi (>= 1.0.1) 15 | gyoku (1.2.2) 16 | builder (>= 2.1.2) 17 | http-cookie (1.0.2) 18 | domain_name (~> 0.5) 19 | httpclient (2.5.3.3) 20 | httpi (0.9.7) 21 | rack 22 | little-plugger (1.1.3) 23 | logging (1.8.2) 24 | little-plugger (>= 1.1.3) 25 | multi_json (>= 1.8.4) 26 | mime-types (2.99.1) 27 | mini_portile (0.6.1) 28 | multi_json (1.10.1) 29 | net-scp (1.2.1) 30 | net-ssh (>= 2.6.5) 31 | net-ssh (2.9.1) 32 | netrc (0.11.0) 33 | nokogiri (1.6.5) 34 | mini_portile (~> 0.6.0) 35 | nokogiri (1.6.5-x64-mingw32) 36 | mini_portile (~> 0.6.0) 37 | nori (1.1.5) 38 | rack (1.5.2) 39 | rake (10.4.2) 40 | rest-client (1.8.0) 41 | http-cookie (>= 1.0.2, < 2.0) 42 | mime-types (>= 1.16, < 3.0) 43 | netrc (~> 0.7) 44 | rspec (3.1.0) 45 | rspec-core (~> 3.1.0) 46 | rspec-expectations (~> 3.1.0) 47 | rspec-mocks (~> 3.1.0) 48 | rspec-core (3.1.7) 49 | rspec-support (~> 3.1.0) 50 | rspec-expectations (3.1.2) 51 | diff-lcs (>= 1.2.0, < 2.0) 52 | rspec-support (~> 3.1.0) 53 | rspec-its (1.1.0) 54 | rspec-core (>= 3.0.0) 55 | rspec-expectations (>= 3.0.0) 56 | rspec-mocks (3.1.3) 57 | rspec-support (~> 3.1.0) 58 | rspec-support (3.1.2) 59 | rubyntlm (0.1.1) 60 | savon (0.9.5) 61 | akami (~> 1.0) 62 | builder (>= 2.1.2) 63 | gyoku (>= 0.4.0) 64 | httpi (~> 0.9) 65 | nokogiri (>= 1.4.0) 66 | nori (~> 1.0) 67 | wasabi (~> 1.0) 68 | serverspec (2.6.0) 69 | multi_json 70 | rspec (~> 3.0) 71 | rspec-its 72 | specinfra (~> 2.10) 73 | specinfra (2.10.0) 74 | net-scp 75 | net-ssh 76 | unf (0.1.4) 77 | unf_ext 78 | unf_ext (0.0.7.2) 79 | uuidtools (2.1.5) 80 | wasabi (1.0.0) 81 | nokogiri (>= 1.4.0) 82 | winrm (1.2.0) 83 | gssapi (~> 1.0.0) 84 | httpclient (~> 2.2, >= 2.2.0.2) 85 | logging (~> 1.6, >= 1.6.1) 86 | nokogiri (~> 1.5) 87 | rubyntlm (~> 0.1.1) 88 | savon (= 0.9.5) 89 | uuidtools (~> 2.1.2) 90 | 91 | PLATFORMS 92 | ruby 93 | x64-mingw32 94 | 95 | DEPENDENCIES 96 | rake 97 | rest-client 98 | serverspec 99 | winrm 100 | 101 | BUNDLED WITH 102 | 1.12.4 103 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README-libvirt.md: -------------------------------------------------------------------------------- 1 | KVM (libvirt) support for Linux 2 | =============================== 3 | 4 | Here are some notes to install and run VMs on KVM and Mint. 5 | 6 | First to build the packer stuff, we need to install these packes: 7 | 8 | ```sh 9 | $ sudo apt-get install qemu-system qemu-utils libvirt-bin virt-manager python-spice-client-gtk virt-viewer 10 | ``` 11 | 12 | Make and load the boxes you want (note that rake load will build the boxes as needed): 13 | ```sh 14 | $ rake build:kvm:all 15 | $ rake load:kvm:all 16 | ``` 17 | 18 | Then, make sure to run the latest vagrant, at least 1.7.2, and install the necessary plugin: 19 | 20 | ```sh 21 | $ vagrant plugin install vagrant-libvirt 22 | ``` 23 | 24 | you will need the following packages to use synced folders: 25 | 26 | ```sh 27 | $ sudo apt-get install nfs-kernel-server 28 | ``` 29 | 30 | Test your new VMs: 31 | 32 | ```sh 33 | $ rake up:kvm:windows-2012R2-full-standard-eval 34 | ``` 35 | or 36 | ```sh 37 | $ cd spec && BOX=windows-2012R2-full-standard-eval vagrant up --provider=libvirt 38 | ``` 39 | 40 | And you are good to go! 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | packer-windows 2 | ============== 3 | 4 | Packer Configuration to create Windows boxes 5 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 3.1.0 2 | -------------------------------------------------------------------------------- /data/GeoTrust_Global_CA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT 3 | MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i 4 | YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG 5 | EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg 6 | R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 7 | 9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq 8 | fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv 9 | iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU 10 | 1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ 11 | bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW 12 | MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA 13 | ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l 14 | uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn 15 | Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS 16 | tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF 17 | PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un 18 | hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV 19 | 5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== 20 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /data/bginfo/BGFormat.bgi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/bginfo/BGFormat.bgi -------------------------------------------------------------------------------- /data/bginfo/ComputerModel.vbs: -------------------------------------------------------------------------------- 1 | winmgt = "winmgmts:{impersonationLevel=impersonate}!//" 2 | 3 | Set oWMI_Qeury_Result = GetObject(winmgt).InstancesOf("Win32_ComputerSystem") 4 | 5 | 6 | For Each oItem In oWMI_Qeury_Result 7 | Set oComputer = oItem 8 | Next 9 | 10 | 11 | If IsNull(oComputer.Model) Then 12 | sComputerModel = "*no-name* model" 13 | Else 14 | If LCase(oComputer.Model) = "system product name" Then 15 | sComputerModel = "Custom-built PC" 16 | Else 17 | sComputerModel = oComputer.Model 18 | End If 19 | End If 20 | 21 | If IsNull(oComputer.Manufacturer) Then 22 | sComputerManufacturer = "*no-name* manufacturer" 23 | Else 24 | If LCase(oComputer.Manufacturer) = "system manufacturer" Then 25 | sComputerManufacturer = "some assembler" 26 | Else 27 | sComputerManufacturer = oComputer.Manufacturer 28 | End If 29 | End If 30 | 31 | 32 | sComputer = Trim(sComputerModel) & " by " & Trim(sComputerManufacturer) 33 | 34 | Echo sComputer -------------------------------------------------------------------------------- /data/bginfo/OSArchitecture.vbs: -------------------------------------------------------------------------------- 1 | ' Special BGInfo Script 2 | ' OS Architecture v1.5 3 | ' Programmed by WindowsStar - Copyright (c) 2009 4 | ' --------------------------------------------------- 5 | 6 | strComputer = "." 7 | On Error Resume Next 8 | Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | Set colSettings = objWMIService.ExecQuery ("Select * from Win32_Processor") 10 | For Each objComputer in colSettings 11 | If objComputer.Architecture = 0 Then ArchitectureType = "32Bit" 12 | If objComputer.Architecture = 6 Then ArchitectureType = "Intel Itanium" 13 | If objComputer.Architecture = 9 Then ArchitectureType = "64Bit" 14 | Next 15 | 16 | Echo ArchitectureType -------------------------------------------------------------------------------- /data/bginfo/OnlyIPv4Address.vbs: -------------------------------------------------------------------------------- 1 | ' Special BGInfo Script 2 | ' Only IPv4 Address v1.7 3 | ' Programmed by WindowsStar - Copyright (c) 2009-2011 4 | ' -------------------------------------------------------- 5 | 6 | strComputer = "." 7 | On Error Resume Next 8 | Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | Set colSettings = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled = 'True'") 10 | 11 | For Each objIP in colSettings 12 | For i=LBound(objIP.IPAddress) to UBound(objIP.IPAddress) 13 | If InStr(objIP.IPAddress(i),":") = 0 Then Echo objIP.IPAddress(i) 14 | Next 15 | Next -------------------------------------------------------------------------------- /data/bginfo/OnlyIPv6Address.vbs: -------------------------------------------------------------------------------- 1 | ' Special BGInfo Script 2 | ' Only IPv6 Address v1.7 3 | ' Programmed by WindowsStar - Copyright (c) 2009-2011 4 | ' -------------------------------------------------------- 5 | 6 | strComputer = "." 7 | On Error Resume Next 8 | Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | Set colSettings = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled = 'True'") 10 | 11 | For Each objIP in colSettings 12 | For i=LBound(objIP.IPAddress) to UBound(objIP.IPAddress) 13 | If InStr(objIP.IPAddress(i),":") <> 0 Then Echo objIP.IPAddress(i) 14 | Next 15 | Next -------------------------------------------------------------------------------- /data/bginfo/OperatingSystemInformation.vbs: -------------------------------------------------------------------------------- 1 | ' Special BGInfo Script 2 | ' Operating System Information v1.3 3 | ' Programmed by WindowsStar - Copyright (c) 2009-2010 4 | ' -------------------------------------------------------- 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 8 | 9 | Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") 10 | 11 | For Each objOperatingSystem in colOperatingSystems 12 | OSCaption = Trim(Replace(objOperatingSystem.Caption,"Microsoft ","")) 13 | OSCaption = Replace(OSCaption,"Microsoft","") 14 | OSCaption = Replace(OSCaption,"(R)","") 15 | OSCaption = Trim(Replace(OSCaption,",","")) 16 | Echo OSCaption 17 | Next -------------------------------------------------------------------------------- /data/bginfo/Set-Background.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/bginfo/Set-Background.lnk -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/netkvm.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/netkvm.cat -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/netkvm.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/netkvm.sys -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/netkvmco.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/netkvmco.dll -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/netkvmtemporarycert.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/netkvmtemporarycert.cer -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/viostor.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/viostor.cat -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/viostor.inf: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2009, Red Hat Inc. 2 | [Version] 3 | Signature="$Windows NT$" 4 | Class=SCSIAdapter 5 | ClassGUID={4D36E97B-E325-11CE-BFC1-08002BE10318} 6 | Provider=%RHEL% 7 | DriverVer=01/13/2015,61.71.104.10000 8 | CatalogFile=viostor.cat 9 | DriverPackageType = PlugAndPlay 10 | DriverPackageDisplayName = %RHELScsi.DeviceDesc% 11 | 12 | ; 13 | ; Source file information 14 | ; 15 | 16 | [SourceDisksNames] 17 | 1 = %DiskId1%,,,"" 18 | 19 | [SourceDisksFiles] 20 | viostor.sys = 1,, 21 | 22 | [ControlFlags] 23 | ;ExcludeFromSelect = * 24 | 25 | [DestinationDirs] 26 | DefaultDestDir = 10 27 | viostor_Files_Driver = 12 28 | 29 | ; 30 | ; Driver information 31 | ; 32 | 33 | [Manufacturer] 34 | %RHEL% = RHEL,NTAMD64 35 | 36 | [RHEL.NTAMD64] 37 | %RHELScsi.DeviceDesc% = rhelscsi_inst, PCI\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00 38 | 39 | ; 40 | ; General installation section 41 | ; 42 | 43 | [viostor_Files_Driver] 44 | viostor.sys,,,2 45 | 46 | [rhelscsi_inst] 47 | CopyFiles=viostor_Files_Driver 48 | 49 | ; 50 | ; Service Installation 51 | ; 52 | 53 | [rhelscsi_inst.Services] 54 | AddService = viostor, 0x00000002 , rhelscsi_Service_Inst, rhelscsi_EventLog_Inst 55 | 56 | [rhelscsi_Service_Inst] 57 | ServiceType = %SERVICE_KERNEL_DRIVER% 58 | StartType = %SERVICE_BOOT_START% 59 | ErrorControl = %SERVICE_ERROR_NORMAL% 60 | ServiceBinary = %12%\viostor.sys 61 | LoadOrderGroup = SCSI miniport 62 | AddReg = pnpsafe_pci_addreg 63 | 64 | [rhelscsi_inst.HW] 65 | AddReg = pnpsafe_pci_addreg_msix 66 | 67 | [rhelscsi_EventLog_Inst] 68 | AddReg = rhelscsi_EventLog_AddReg 69 | 70 | [rhelscsi_EventLog_AddReg] 71 | HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\IoLogMsg.dll" 72 | HKR,,TypesSupported,%REG_DWORD%,7 73 | 74 | 75 | [pnpsafe_pci_addreg] 76 | HKR, "Parameters\PnpInterface", "5", %REG_DWORD%, 0x00000001 77 | HKR, "Parameters", "BusType", %REG_DWORD%, 0x00000001 78 | 79 | [pnpsafe_pci_addreg_msix] 80 | HKR, "Interrupt Management",, 0x00000010 81 | HKR, "Interrupt Management\MessageSignaledInterruptProperties",, 0x00000010 82 | HKR, "Interrupt Management\MessageSignaledInterruptProperties", MSISupported, 0x00010001, 1 83 | HKR, "Interrupt Management\MessageSignaledInterruptProperties", MessageNumberLimit, 0x00010001, 2 84 | HKR, "Interrupt Management\Affinity Policy",, 0x00000010 85 | HKR, "Interrupt Management\Affinity Policy", DevicePolicy, 0x00010001, 5 86 | 87 | 88 | [Strings] 89 | ; 90 | ; Localizable Strings 91 | ; 92 | diskId1 = "Red Hat VirtIO SCSI controller Installation Disk" 93 | RHELScsi.DeviceDesc = "Red Hat VirtIO SCSI controller" 94 | RHEL = "Red Hat, Inc." 95 | 96 | ; 97 | ; Non-Localizable Strings 98 | ; 99 | 100 | REG_EXPAND_SZ = 0x00020000 101 | REG_DWORD = 0x00010001 102 | SERVICE_KERNEL_DRIVER = 1 103 | SERVICE_BOOT_START = 0 104 | SERVICE_ERROR_NORMAL = 1 105 | 106 | -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/viostor.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/viostor.pdb -------------------------------------------------------------------------------- /data/drivers/virtio-win-0.1-100/win7/amd64/viostor.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/drivers/virtio-win-0.1-100/win7/amd64/viostor.sys -------------------------------------------------------------------------------- /data/inin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/inin.jpg -------------------------------------------------------------------------------- /data/vagrant.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/data/vagrant.jpg -------------------------------------------------------------------------------- /data/vagrant.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key 2 | -------------------------------------------------------------------------------- /exec.rb: -------------------------------------------------------------------------------- 1 | require 'open3' 2 | 3 | def shell(command) 4 | case RUBY_PLATFORM 5 | when 'x64-mingw32' 6 | stdin, stdout, stderr = Open3.popen3 "powershell.exe -NoLogo -ExecutionPolicy Bypass -Command #{command}" 7 | stdin.close 8 | output=stdout.readlines.join.chomp 9 | error=stderr.readlines.join.chomp 10 | puts "Output: #{output.inspect}" 11 | puts "Error: #{error.inspect}" 12 | return error unless error.empty? #TODO: throw error in the futur? 13 | return output 14 | else 15 | system command 16 | end 17 | end 18 | 19 | status = shell(ARGV.first) 20 | puts "Exit Status: #{status}" 21 | -------------------------------------------------------------------------------- /iso/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildas/packer-windows/c5f5711db2a13e661375b868848d5f3ee4015cf8/iso/.gitkeep -------------------------------------------------------------------------------- /publish.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | shopt -s extglob 4 | set -o errtrace 5 | set +o noclobber 6 | 7 | export NOOP= 8 | ASSUMEYES=0 9 | VERBOSE=1 10 | 11 | DEST=$1 12 | BASE_URL=$2 13 | 14 | case $OSTYPE in 15 | linux-gnu) 16 | MD5=md5sum 17 | ;; 18 | darwin*) 19 | MD5=md5 20 | ;; 21 | esac 22 | 23 | # Pre-requisites {{{ 24 | function install-prereq() # {{{2 25 | { 26 | case $OSTYPE in 27 | linux-gnu) 28 | if [[ -n $(dpkg -s bar | grep '^Status: install ok installed') ]]; then 29 | $NOOP sudo apt-get install bar 30 | fi 31 | if [[ -n $(dpkg -s jq | grep '^Status: install ok installed') ]]; then 32 | $NOOP sudo apt-get install jq 33 | fi 34 | ;; 35 | darwin*) 36 | if [[ -n $(brew info bar | grep '^Not installed$') ]]; then 37 | $NOOP brew install bar 38 | fi 39 | 40 | if [[ -n $(brew info jq | grep '^Not installed$') ]]; then 41 | $NOOP brew install jq 42 | fi 43 | ;; 44 | esac 45 | } # }}}2 46 | # }}} 47 | 48 | function main() # {{{2 49 | { 50 | install-prereq 51 | 52 | for box_path in boxes/* ; do 53 | box=${box_path##*/} 54 | echo "Processing box ${box}" 55 | 56 | if [[ -f "$DEST/$box/metadata.json" && "$DEST/$box/metadata.json" -nt "$box_path/metadata.json" ]]; then 57 | echo " Downloading Metadata" 58 | cp -f "$DEST/$box/metadata.json" "$box_path" 59 | chmod 644 "$box_path/metadata.json" 60 | fi 61 | metadata=$(cat "$box_path/metadata.json") 62 | 63 | for provider_path in $box_path/* ; do 64 | [[ ! -d "$provider_path" ]] && continue 65 | provider=${provider_path##*/} 66 | echo " Processing provider ${provider}" 67 | 68 | for box_filepath in $provider_path/*.box ; do 69 | box_file=${box_filepath##*/} 70 | echo " Box file: ${box_file}" 71 | 72 | if [[ ! -f "${box_filepath}.md5" || "${box_filepath}.md5" -ot "${box_filepath}" ]]; then 73 | printf " Calculating checksum..." 74 | box_checksum=$(bar -n "${box_filepath}" | $MD5 | awk '{print $1}') 75 | echo $box_checksum > "${box_filepath}.md5" 76 | echo '.' 77 | else 78 | box_checksum=$(cat "${box_filepath}.md5") 79 | fi 80 | echo " Checksum: ${box_checksum}" 81 | 82 | metadata_version=$(echo "$metadata" | jq '.versions[] | select(.version=="0.1.0")') 83 | if [[ -z "$metadata_version" ]]; then 84 | echo " ERROR: Cannot find the box version in the metadata" 85 | continue 86 | fi 87 | 88 | metadata_provider=$(echo "$metadata_version" | jq ".providers[] | select(.name==\"$provider\")") 89 | if [[ -z "$metadata_provider" ]]; then 90 | echo " Adding provider" 91 | echo " Copying box file" 92 | mkdir -p "$DEST/$box/$provider" 93 | bar -o "$DEST/$box/$provider/$box_file" "$box_filepath" 94 | #cp "$box_filepath" "$DEST/$box/$provider/$box_file" 95 | 96 | echo "$metadata" | jq "(.versions[] | select(.version==\"0.1.0\") | .providers) |= . + [{name: \"$provider\", url: \"$BASE_URL/$box/$provider/$box_file\", checksum_type: \"md5\", checksum: \"$box_checksum\"}]" > "$box_path/metadata.$$.json" && mv "$box_path/metadata.$$.json" "$box_path/metadata.json" 97 | cp "$box_path/metadata.json" "$DEST/$box/metadata.json" 98 | continue 99 | fi 100 | 101 | metadata_checksum=$(echo "$metadata_provider" | jq --raw-output '.checksum') 102 | echo " Destination Checksum: ${metadata_checksum}" 103 | if [[ $box_checksum == $metadata_checksum ]]; then 104 | echo " Destination box is already uploaded" 105 | continue 106 | else 107 | echo " Copying box file" 108 | bar -o "$DEST/$box/$provider/$box_file" "$box_filepath" 109 | #cp "$box_filepath" "$DEST/$box/$provider/$box_file" 110 | chmod 644 "$DEST/$box/$provider/$box_file" 111 | 112 | echo "$metadata" | jq "(.versions[] | select(.version==\"0.1.0\") | .providers[] | select(.name==\"$provider\") | .checksum) |= \"$box_checksum\"" > "$box_path/metadata.$$.json" && mv "$box_path/metadata.$$.json" "$box_path/metadata.json" 113 | cp "$box_path/metadata.json" "$DEST/$box/metadata.json" 114 | chmod 644 "$box_path/metadata.json" 115 | fi 116 | done 117 | done 118 | done 119 | } # }}}2 120 | 121 | main $@ 122 | -------------------------------------------------------------------------------- /scripts/00-run-all-scripts.cmd: -------------------------------------------------------------------------------- 1 | @setlocal EnableDelayedExpansion EnableExtensions 2 | @for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i" 3 | @if not defined PACKER_DEBUG (@echo off) else (@echo on) 4 | 5 | goto main 6 | 7 | :::::::::::: 8 | :find_tee 9 | :::::::::::: 10 | 11 | set _TEE_CMD= 12 | 13 | for %%i in (tee.cmd tee.exe) do set _TEE_CMD=%%~$PATH:i 14 | if exist "%_TEE_CMD%" goto :eof 15 | 16 | for %%i in ("%SystemRoot%" %PACKER_SEARCH_PATHS%) do if exist "%%~i\tee.exe" set _TEE_CMD=%%~i\tee.exe 17 | if exist "%_TEE_CMD%" goto :eof 18 | 19 | for %%i in ("%SystemRoot%" %PACKER_SEARCH_PATHS%) do if exist "%%~i\tee.cmd" set _TEE_CMD=%%~i\tee.cmd 20 | if exist "%_TEE_CMD%" goto :eof 21 | 22 | set _TEE_CMD=%SystemRoot%\tee.cmd 23 | set _TEE_JS=%SystemRoot%\tee.js 24 | 25 | :: see http://stackoverflow.com/a/10719322/1432614 26 | echo var fso = new ActiveXObject("Scripting.FileSystemObject");>"%_TEE_JS%" 27 | echo var out = fso.OpenTextFile(WScript.Arguments(0),2,true);>>"%_TEE_JS%" 28 | echo var chr;>>"%_TEE_JS%" 29 | echo while( ^^!WScript.StdIn.AtEndOfStream ) {>>"%_TEE_JS%" 30 | echo chr=WScript.StdIn.Read(1);>>"%_TEE_JS%" 31 | echo WScript.StdOut.Write(chr);>>"%_TEE_JS%" 32 | echo out.Write(chr);>>"%_TEE_JS%" 33 | echo }>>"%_TEE_JS%" 34 | 35 | echo @cscript //E:JScript //nologo "%_TEE_JS%" %%* >"%_TEE_CMD%" 36 | 37 | set _TEE_JS= 38 | 39 | goto :eof 40 | 41 | :::::::::::: 42 | :main 43 | :::::::::::: 44 | 45 | :: If TEMP is not defined in this shell instance, define it ourselves 46 | if not defined TEMP set TEMP=%USERPROFILE%\AppData\Local\Temp 47 | 48 | PATH=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\WindowsPowerShell\v1.0;%PATH%;%~dp0 49 | 50 | pushd "%~dp0" 51 | 52 | if defined PACKER_DEBUG ( 53 | set _PACKER_CMD_OPTS= 54 | ) else ( 55 | set _PACKER_CMD_OPTS=/q 56 | ) 57 | 58 | set _PACKER_LOG=%TEMP%\%~n0.log 59 | set _PACKER_RUN=%TEMP%\%~n0.run.tmp 60 | 61 | echo %date% %time%: %0 Started >>"%_PACKER_LOG%" 62 | title %0 Started, please wait... 63 | 64 | dir /b /on "%~d0\*.bat" "%~d0\*.cmd" "%~d0\*.ps1" | findstr /v "^_" | findstr /i /v %~nx0 >"%_PACKER_RUN%" 65 | 66 | echo ==========>>"%_PACKER_LOG%" 67 | echo %_PACKER_RUN%: >>"%_PACKER_LOG%" 68 | echo ==========>>"%_PACKER_LOG%" 69 | type "%_PACKER_RUN%" >>"%_PACKER_LOG%" 70 | echo.>>"%_PACKER_LOG%" 71 | 72 | echo ==========>>"%_PACKER_LOG%" 73 | echo Environment: >>"%_PACKER_LOG%" 74 | echo ==========>>"%_PACKER_LOG%" 75 | set | sort >>"%_PACKER_LOG%" 76 | echo.>>"%_PACKER_LOG%" 77 | 78 | call :find_tee 79 | 80 | for /f %%i in (%_PACKER_RUN%) do ( 81 | pushd "%~dp0" 82 | echo %date% %time%: Executing %%~i >>"%_PACKER_LOG%" 83 | echo ==^> Executing %%~i 84 | title Executing %%~i, please wait... 85 | 86 | if exist "%temp%\%%~ni.err" ( 87 | del "%temp%\%%~ni.err" 88 | ) 89 | 90 | ("%ComSpec%" %_PACKER_CMD_OPTS% /c "%~d0\%%~nxi" 2>&1 || copy /y nul "%temp%\%%~ni.err" >nul) | "%_TEE_CMD%" "%TEMP%\%%~ni.log" 91 | if exist "%temp%\%%~ni.err" ( 92 | echo ==^> %%~i returned an error. See "%TEMP%\%%~ni.log" for details. 93 | echo %date% %time%: %%~i returned an error. See "%TEMP%\%%~ni.log" for details. >>"%_PACKER_LOG%" 94 | if defined PACKER_PAUSE_ON_ERROR ( 95 | echo title Press any key to continue . . . 96 | pause 97 | ) 98 | if defined PACKER_SHUTDOWN_ON_ERROR ( 99 | shutdown /s /t 0 /f /d p:4:1 /c "Packer shutdown as %%~i returned error %errorlevel%" 100 | ) 101 | ) else ( 102 | echo ==^> %%~i completed successfully. 103 | echo %date% %time%: %%~i completed successfully. >>"%_PACKER_LOG%" 104 | if defined PACKER_PAUSE ( 105 | title Waiting for %PACKER_PAUSE% seconds, press Y to continue 106 | choice /C Y /N /T %PACKER_PAUSE% /D Y /M "Waiting for %PACKER_PAUSE% seconds, press Y to continue: " 107 | ) 108 | ) 109 | del "%temp%\%%~ni.err" 110 | popd 111 | ) 112 | 113 | echo %date% %time%: %0 Finished >>"%_PACKER_LOG%" 114 | title %0 Finished 115 | exit /b 0 116 | -------------------------------------------------------------------------------- /scripts/01-config-os.cmd: -------------------------------------------------------------------------------- 1 | @if not defined PACKER_DEBUG (@echo off) else (@echo on) 2 | setlocal EnableDelayedExpansion EnableExtensions 3 | title Configuring Windows... 4 | 5 | rem turn off hibernation 6 | %SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f 7 | %SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f 8 | 9 | rem Turn on QuickEdit mode 10 | %SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f 11 | 12 | rem Show file extensions in Explorer 13 | %SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f 14 | 15 | rem Network Prompt 16 | cmd.exe /c reg add "HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff" 17 | 18 | title Configuring User Accounts... 19 | cmd.exe /c wmic useraccount where "name='packer'" set PasswordExpires=FALSE 20 | cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE 21 | -------------------------------------------------------------------------------- /scripts/02-config-posh.cmd: -------------------------------------------------------------------------------- 1 | @if not defined PACKER_DEBUG (@echo off) else (@echo on) 2 | setlocal EnableDelayedExpansion EnableExtensions 3 | title Configuring Powershell Execution Policy... 4 | 5 | cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" Creating "%IMDISK_DIR%" 15 | mkdir "%IMDISK_DIR%" 16 | pushd "%IMDISK_DIR%" 17 | 18 | if exist "%SystemRoot%\_download.cmd" ( 19 | call "%SystemRoot%\_download.cmd" "%IMDISK_URL%" "%IMDISK_PATH%" 20 | ) else ( 21 | echo ==^> Downloading "%IMDISK_URL%" to "%IMDISK_PATH%" 22 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%IMDISK_URL%', '%IMDISK_PATH%')" Installing ImDisk 27 | SET IMDISK_SILENT_SETUP=1 28 | "%IMDISK_PATH%" -y 29 | 30 | :: wait for imdisk service to finish starting 31 | timeout 2 32 | -------------------------------------------------------------------------------- /scripts/04-install-openssh.cmd: -------------------------------------------------------------------------------- 1 | @if not defined PACKER_DEBUG (@echo off) else (@echo on) 2 | setlocal EnableDelayedExpansion EnableExtensions 3 | title Installing Openssh... 4 | 5 | if not defined OPENSSH_32_URL set OPENSSH_32_URL=http://www.mls-software.com/files/setupssh-6.7p1-1-v1.exe 6 | if not defined OPENSSH_64_URL set OPENSSH_64_URL=http://www.mls-software.com/files/setupssh-6.7p1-1-v1(x64).exe 7 | if not defined SSHD_PASSWORD set SSHD_PASSWORD=D@rj33l1ng 8 | 9 | if exist "%SystemDrive%\Program Files (x86)" ( 10 | set OPENSSH_URL="%OPENSSH_64_URL%" 11 | ) else ( 12 | set OPENSSH_URL="%OPENSSH_32_URL%" 13 | ) 14 | 15 | :: strip off quotes 16 | for %%i in (%OPENSSH_URL%) do set OPENSSH_EXE=%%~nxi 17 | for %%i in (%OPENSSH_URL%) do set OPENSSH_URL=%%~i 18 | 19 | set OPENSSH_DIR=%TEMP%\openssh 20 | set OPENSSH_PATH=%OPENSSH_DIR%\%OPENSSH_EXE% 21 | 22 | echo ==^> Creating "%OPENSSH_DIR%" 23 | mkdir "%OPENSSH_DIR%" 24 | pushd "%OPENSSH_DIR%" 25 | 26 | if exist "%SystemRoot%\_download.cmd" ( 27 | call "%SystemRoot%\_download.cmd" "%OPENSSH_URL%" "%OPENSSH_PATH%" 28 | ) else ( 29 | echo ==^> Downloading "%OPENSSH_URL%" to "%OPENSSH_PATH%" 30 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%OPENSSH_URL%', '%OPENSSH_PATH%')" Blocking SSH port 22 on the firewall 35 | netsh advfirewall firewall add rule name="SSHD" dir=in action=block program="%ProgramFiles%\OpenSSH\usr\sbin\sshd.exe" enable=yes 36 | netsh advfirewall firewall add rule name="ssh" dir=in action=block protocol=TCP localport=22 37 | 38 | echo ==^> Installing OpenSSH 39 | "%OPENSSH_PATH%" /S /port=22 /privsep=1 /password=%SSHD_PASSWORD% 40 | 41 | :: wait for opensshd service to finish starting 42 | timeout 5 43 | 44 | sc query opensshd | findstr "RUNNING" >nul 45 | if errorlevel 1 goto sshd_not_running 46 | 47 | echo ==^> Stopping the sshd service 48 | sc stop opensshd 49 | 50 | :is_sshd_running 51 | 52 | timeout 1 53 | 54 | sc query opensshd | findstr "STOPPED" >nul 55 | if errorlevel 1 goto is_sshd_running 56 | 57 | :sshd_not_running 58 | ver>nul 59 | 60 | echo ==^> Unblocking SSH port 22 on the firewall 61 | netsh advfirewall firewall delete rule name="SSHD" 62 | netsh advfirewall firewall delete rule name="ssh" 63 | 64 | echo ==^> Setting temp location 65 | rmdir /q /s "%ProgramFiles%\OpenSSH\tmp" 66 | mklink /d "%ProgramFiles%\OpenSSH\tmp" "%SystemRoot%\Temp" 67 | 68 | icacls "%SystemRoot%\Temp" /grant %USERNAME%:(OI)(CI)F 69 | 70 | echo ==^> Adding missing environment variables to %USERPROFILE%\.ssh\environment 71 | 72 | if not exist "%USERPROFILE%\.ssh" mkdir "%USERPROFILE%\.ssh" 73 | 74 | if exist a:\vagrant.pub ( 75 | copy a:\vagrant.pub %USERPROFILE%\.ssh\authorized_keys 76 | ) 77 | 78 | set SSHENV=%USERPROFILE%\.ssh\environment 79 | 80 | echo APPDATA=%SystemDrive%\Users\%USERNAME%\AppData\Roaming>>"%SSHENV%" 81 | echo COMMONPROGRAMFILES=%SystemDrive%\Program Files\Common Files>>"%SSHENV%" 82 | echo LOCALAPPDATA=%SystemDrive%\Users\%USERNAME%\AppData\Local>>"%SSHENV%" 83 | echo PROGRAMDATA=%SystemDrive%\ProgramData>>"%SSHENV%" 84 | echo PROGRAMFILES=%SystemDrive%\Program Files>>"%SSHENV%" 85 | echo PSMODULEPATH=%SystemDrive%\Windows\system32\WindowsPowerShell\v1.0\Modules\>>"%SSHENV%" 86 | echo PUBLIC=%SystemDrive%\Users\Public>>"%SSHENV%" 87 | echo SESSIONNAME=Console>>"%SSHENV%" 88 | echo TEMP=%SystemDrive%\Users\%USERNAME%\AppData\Local\Temp>>"%SSHENV%" 89 | echo TMP=%SystemDrive%\Users\%USERNAME%\AppData\Local\Temp>>"%SSHENV%" 90 | :: This fix simply masks the issue, we need to fix the underlying cause 91 | :: to override sshd_server: 92 | :: echo USERNAME=%USERNAME%>>"%SSHENV%" 93 | 94 | if exist "%SystemDrive%\Program Files (x86)" ( 95 | echo COMMONPROGRAMFILES^(X86^)=%SystemDrive%\Program Files ^(x86^)\Common Files>>"%SSHENV%" 96 | echo COMMONPROGRAMW6432=%SystemDrive%\Program Files\Common Files>>"%SSHENV%" 97 | echo PROGRAMFILES^(X86^)=%SystemDrive%\Program Files ^(x86^)>>"%SSHENV%" 98 | echo PROGRAMW6432=%SystemDrive%\Program Files>>"%SSHENV%" 99 | ) 100 | 101 | echo ==^> Fixing opensshd's configuration to be less strict 102 | powershell -Command "(Get-Content '%ProgramFiles%\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace 'StrictModes yes', 'StrictModes no' } | Set-Content '%ProgramFiles%\OpenSSH\etc\sshd_config'" 103 | powershell -Command "(Get-Content '%ProgramFiles%\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace '#PubkeyAuthentication yes', 'PubkeyAuthentication yes' } | Set-Content '%ProgramFiles%\OpenSSH\etc\sshd_config'" 104 | powershell -Command "(Get-Content '%ProgramFiles%\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace '#PermitUserEnvironment no', 'PermitUserEnvironment yes' } | Set-Content '%ProgramFiles%\OpenSSH\etc\sshd_config'" 105 | powershell -Command "(Get-Content '%ProgramFiles%\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace '#UseDNS yes', 'UseDNS no' } | Set-Content '%ProgramFiles%\OpenSSH\etc\sshd_config'" 106 | powershell -Command "(Get-Content '%ProgramFiles%\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace 'Banner /etc/banner.txt', '#Banner /etc/banner.txt' } | Set-Content '%ProgramFiles%\OpenSSH\etc\sshd_config'" 107 | 108 | echo ==^> Opening SSH port 22 on the firewall 109 | netsh advfirewall firewall add rule name="SSHD" dir=in action=allow program="%ProgramFiles%\OpenSSH\usr\sbin\sshd.exe" enable=yes 110 | netsh advfirewall firewall add rule name="ssh" dir=in action=allow protocol=TCP localport=22 111 | 112 | echo ==^> Ensuring user %USERNAME% can login 113 | icacls "%USERPROFILE%" /grant %USERNAME%:(OI)(CI)F 114 | icacls "%ProgramFiles%\OpenSSH\bin" /grant %USERNAME%:(OI)RX 115 | icacls "%ProgramFiles%\OpenSSH\usr\sbin" /grant %USERNAME%:(OI)RX 116 | 117 | echo ==^> Setting user's home directories to their windows profile directory 118 | powershell -Command "(Get-Content '%ProgramFiles%\OpenSSH\etc\passwd') | Foreach-Object { $_ -replace '/home/(\w+)', '/cygdrive/c/Users/$1' } | Set-Content '%ProgramFiles%\OpenSSH\etc\passwd'" 119 | 120 | :: This fix simply masks the issue, we need to fix the underlying cause 121 | :: echo ==^> Overriding sshd_server username in environment 122 | :: reg add "HKLM\Software\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "@for %%i in (%%USERPROFILE%%) do @set USERNAME=%%~ni" /f 123 | 124 | :exit0 125 | 126 | ver>nul 127 | 128 | goto :exit 129 | 130 | :exit1 131 | 132 | verify other 2>nul 133 | 134 | :exit 135 | -------------------------------------------------------------------------------- /scripts/99-start-services.cmd: -------------------------------------------------------------------------------- 1 | @if not defined PACKER_DEBUG (@echo off) else (@echo on) 2 | setlocal EnableDelayedExpansion EnableExtensions 3 | 4 | if not defined PACKER_SERVICES set PACKER_SERVICES=opensshd sshd winrm 5 | 6 | title Starting services: %PACKER_SERVICES%. Please wait... 7 | 8 | :: Intentionally named with zz so it runs last by 00-run-all-scripts.cmd so 9 | :: that the Packer winrm/ssh connections is not inadvertently dropped during the 10 | :: Sysprep run 11 | 12 | for %%i in (%PACKER_SERVICES%) do ( 13 | echo ==^> Checking if the %%i service is installed 14 | sc query %%i >nul 2>nul && ( 15 | echo ==^> Starting the %%i service 16 | sc start %%i 17 | ) 18 | ) 19 | 20 | :exit0 21 | 22 | ver>nul 23 | 24 | goto :exit 25 | 26 | :exit1 27 | 28 | verify other 2>nul 29 | 30 | :exit 31 | -------------------------------------------------------------------------------- /scripts/Backup-Logs.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess=$true)] 2 | Param( 3 | ) 4 | begin 5 | { 6 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 7 | } 8 | process 9 | { 10 | if (Test-Path $env:USERPROFILE/share-log.info) 11 | { 12 | $ShareArgs = @{ PSProvider = 'FileSystem'; ErrorAction = 'Stop' } 13 | $ShareInfo = Get-Content $env:USERPROFILE/share-log.info -Raw | ConvertFrom-Json 14 | 15 | if ($ShareInfo.DriveLetter -ne $null) 16 | { 17 | if ($ShareInfo.User -ne $null) 18 | { 19 | if ($ShareInfo.Password -eq $null) 20 | { 21 | Throw "No password for $($ShareInfo.User) in $($env:USERPROFILE)/share-log.info" 22 | exit 1 23 | } 24 | $ShareArgs['Credential'] = New-Object System.Management.Automation.PSCredential($ShareInfo.User, (ConvertTo-SecureString -String $ShareInfo.Password -AsPlainText -Force)) 25 | } 26 | $Drive = New-PSDrive -Name $ShareInfo.DriveLetter -Root $ShareInfo.Path @ShareArgs 27 | $log_dir = $Drive.Root 28 | } 29 | else 30 | { 31 | $log_dir = $ShareInfo.Path 32 | } 33 | Write-Output "Using Share at $log_dir" 34 | } 35 | else 36 | { 37 | Write-Output "Share log information was not found" 38 | Write-Warning "No log will be backed up" 39 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 40 | exit 41 | } 42 | if ([string]::IsNullOrEmpty($log_dir)) 43 | { 44 | Throw "No share to use from $($env:USERPROFILE)/share-log.info" 45 | exit 2 46 | } 47 | 48 | While (! (Test-Path $log_dir)) 49 | { 50 | Write-Output "Waiting for shares to be available" 51 | Start-Sleep 20 52 | } 53 | $log_dir = Join-Path $log_dir "${env:PACKER_BUILDER_TYPE}-${env:PACKER_BUILD_NAME}-$(Get-Date -Format 'yyyyMMddHHmmss')" 54 | if (! (Test-Path $log_dir)) { New-Item -ItemType Directory -Path $log_dir -ErrorAction Stop | Out-Null } 55 | 56 | Write-Output "Backing up logs in $log_dir" 57 | if (Test-Path "C:\ProgramData\chocolatey\logs\chocolatey.log") 58 | { 59 | if ($PSCmdlet.ShouldProcess("chocolatey.log", "Backing up")) 60 | { 61 | Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log $log_dir 62 | } 63 | } 64 | 65 | Get-ChildItem "C:\Windows\Logs\*.log" | ForEach { 66 | if ($PSCmdlet.ShouldProcess((Split-Path $_ -Leaf), "Backing up")) 67 | { 68 | Copy-Item $_ $log_dir 69 | } 70 | } 71 | 72 | Get-ChildItem "C:\Windows\Logs\*.txt" | ForEach { 73 | if ($PSCmdlet.ShouldProcess((Split-Path $_ -Leaf), "Backing up")) 74 | { 75 | Copy-Item $_ $log_dir 76 | } 77 | } 78 | 79 | Start-Sleep 5 80 | } 81 | end 82 | { 83 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 84 | } 85 | -------------------------------------------------------------------------------- /scripts/Get-Checksum.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Compute and check SHA1/MD5 message digest 4 | 5 | .DESCRIPTION 6 | Print or check the checksum of the given file or the standard input. 7 | 8 | .PARAMETER SHA1 9 | Will compute an SHA1 (160-bit) checksum 10 | 11 | .PARAMETER MD5 12 | Will compute an MD5 checksum 13 | 14 | .PARAMETER Path 15 | Path of the file to compute 16 | 17 | .PARAMETER eq 18 | If present, the checksum will be compared to the value of the parameter. 19 | The Cmdlet will return an error if both values do not match. This is case insensitive. 20 | 21 | .EXAMPLE 22 | Get-Checksum -MD5 C:\windows\explorer.exe 23 | 24 | .EXAMPLE 25 | Get-ChildItem C:\windows\explorer.exe | Get-Checksum 26 | 27 | .EXAMPLE This will return a success or failure error code: 28 | Get-Checksum -SHA1 C:\windows\explorer.exe -eq '83e89fee77583097ddbb2648af43c097c62580fc' 29 | #> 30 | [CmdletBinding(DefaultParameterSetName="SHA1")] 31 | param( 32 | [Parameter(ParameterSetName="SHA1", Mandatory=$true)] 33 | [switch] $SHA1, 34 | [Parameter(ParameterSetName="MD5", Mandatory=$true)] 35 | [switch] $MD5, 36 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 37 | [string] $Path, 38 | [Parameter(Mandatory=$false)] 39 | [string] $eq 40 | ) 41 | begin 42 | { 43 | Write-Verbose "ParameterSet Name: $($PSCmdlet.ParameterSetName)" 44 | switch($PSCmdlet.ParameterSetName) 45 | { 46 | "SHA1" { $provider = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider } 47 | "MD5" { $provider = New-Object System.Security.Cryptography.MD5CryptoServiceProvider } 48 | default { $provider = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider } 49 | } 50 | } 51 | process 52 | { 53 | Get-Item $Path -Force | ForEach-Object { 54 | $hash = New-Object System.Text.StringBuilder 55 | $stream = $_.OpenRead() 56 | 57 | if ($stream) 58 | { 59 | foreach ($byte in $provider.ComputeHash($stream)) 60 | { 61 | [Void] $hash.Append($byte.ToString("X2")) 62 | } 63 | $stream.Close() 64 | $checksum = $hash.ToString() 65 | 66 | if ($eq -ne '') 67 | { 68 | 69 | Write-Verbose "Matching $checksum with $eq" 70 | if ($checksum -ieq $eq) 71 | { 72 | Write-Verbose 'matches' 73 | return $true 74 | } 75 | else 76 | { 77 | Write-Error 'does not match' 78 | #Throw [System.IO.InvalidDataException] 79 | return $false 80 | } 81 | } 82 | else 83 | { 84 | Write-Output $checksum 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /scripts/Set-AccountPicture.ps1: -------------------------------------------------------------------------------- 1 | function Set-AccountPicture { 2 | [cmdletbinding(SupportsShouldProcess=$true)] 3 | PARAM( 4 | [Parameter(Position=0, ParameterSetName='PicturePath')] 5 | [string]$UserName = ('{0}\{1}' -f $env:UserDomain, $env:UserName), 6 | 7 | [Parameter(Position=1, ParameterSetName='PicturePath')] 8 | [string]$PicturePath, 9 | 10 | [Parameter(Position=0, ParameterSetName='UsePictureFromAD')] 11 | [switch]$UsePictureFromAD 12 | ) 13 | 14 | Begin { 15 | Add-Type -TypeDefinition @' 16 | using System; 17 | using System.Runtime.InteropServices; 18 | namespace WinAPIs { 19 | public class UserAccountPicture { 20 | [DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)] 21 | public static extern void SetUserTile(string username, int notneeded, string picturefilename); 22 | } 23 | } 24 | '@ -IgnoreWarnings 25 | } 26 | 27 | Process { 28 | if ($pscmdlet.ShouldProcess($UserName, "SetAccountPicture")) { 29 | switch ($PsCmdlet.ParameterSetName) { 30 | 31 | 'PicturePath' { 32 | if (Test-Path -Path $PicturePath -PathType Leaf) { 33 | [WinAPIs.UserAccountPicture]::SetUserTile($UserName, 0, $PicturePath) 34 | } else { 35 | Write-Error ('Picture file {0} does not exist!' -f $PicturePath) 36 | } 37 | break 38 | } 39 | 40 | 'UsePictureFromAD' { 41 | $PicturePath = '{0}\{1}_{1}.jpeg' -f $env:Temp, $env:UserDomain, $env:UserName 42 | $photo = ([ADSISEARCHER]"samaccountname=$($env:username)").findone().properties.thumbnailphoto 43 | $photo | Set-Content -Path $PicturePath -Encoding byte 44 | $UserName = '{0}\{1}' -f $env:UserDomain, $env:UserName 45 | [WinAPIs.UserAccountPicture]::SetUserTile($UserName, 0, $PicturePath) 46 | break 47 | } 48 | 49 | } 50 | } 51 | } 52 | End { } 53 | } 54 | 55 | Set-AccountPicture -PicturePath (Join-Path $env:USERPROFILE (Join-Path "Pictures" "vagrant.jpg")) 56 | -------------------------------------------------------------------------------- /scripts/_packer_config.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Uncomment the following to set a different Cygwin mirror 4 | :: Default: http://mirrors.kernel.org/sourceware/cygwin 5 | :: set CYGWIN_MIRROR_URL=http://mirrors.kernel.org/sourceware/cygwin 6 | 7 | :: Uncomment the following to echo commands as they are run 8 | :: Default: (unset) 9 | :: set PACKER_DEBUG=1 10 | 11 | :: Uncomment the following to define the directory where scripts/save-logs.cmd 12 | :: will save the installation logs 13 | :: Default: z:\c\packer_logs 14 | :: set PACKER_LOG_DIR=z:\c\packer_logs 15 | 16 | :: Uncomment the following to pause PACKER_PAUSE seconds after each script is 17 | :: run by floppy/00-run-all-scripts.cmd (unless you press Y) 18 | :: Default: (unset) 19 | :: set PACKER_PAUSE=60 20 | 21 | :: Uncomment the following to pause if a script run by 22 | :: floppy/00-run-all-scripts.cmd returns a non-zero exit value 23 | :: Default: (unset) 24 | set PACKER_PAUSE_ON_ERROR=1 25 | 26 | :: Uncomment the following to shutdown if a script run by 27 | :: floppy/00-run-all-scripts.cmd returns a non-zero exit value 28 | :: Default: (unset) 29 | :: set PACKER_SHUTDOWN_ON_ERROR=1 30 | 31 | :: Locations to search to find files locally, before trying to download them 32 | :: %USERPROFILE% is listed first, as this is where Packer uploads 33 | :: VMWare's windows.iso, and Virtualbox's VBoxGuestAdditions.iso 34 | :: Default: "%USERPROFILE%" a: b: c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z: 35 | set PACKER_SEARCH_PATHS="%USERPROFILE%" a: b: c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z: 36 | 37 | :: List of services to start by floppy/zz-start-sshd.cmd 38 | :: Default: opensshd sshd winrm 39 | set PACKER_SERVICES=opensshd sshd winrm 40 | 41 | :: Uncomment the following to define a new password for the sshd service 42 | :: Default: D@rj33l1ng 43 | :: set SSHD_PASSWORD=D@rj33l1ng 44 | -------------------------------------------------------------------------------- /scripts/centos-cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -euxo pipefail 2 | 3 | # Get the distro ('redhat', 'centos', 'roaclelinux') 4 | distro=$(rpm -qf --queryformat '%{NAME}' /etc/redhat-release | cut -f 1 -d '-') 5 | # Remove Linux headers 6 | yum -y remove gcc kernel-devel kernel-headers perl cpp 7 | [[ $distro != 'redhat' ]] && yum -y clean all 8 | 9 | # Remove Virtualbox specific files 10 | rm -rf /usr/src/vboxguest* /usr/src/virtualbox-ose-guest* 11 | rm -rf *.iso *.iso.? /tmp/vbox /home/vagrant/.vbox_version 12 | 13 | # Cleanup log files 14 | find /var/log -type f | while read f; do echo -ne '' > $f; done; 15 | 16 | # remove under tmp directory 17 | rm -rf /tmp/* 18 | 19 | # remove interface persistent 20 | rm -f /etc/udev/rules.d/70-persistent-net.rules 21 | 22 | for ifcfg in $(ls /etc/sysconfig/network-scripts/ifcfg-*) 23 | do 24 | if [ "$(basename ${ifcfg})" != "ifcfg-lo" ] 25 | then 26 | sed -i '/^UUID/d' /etc/sysconfig/network-scripts/ifcfg-enp0s3 27 | sed -i '/^HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-enp0s3 28 | fi 29 | done 30 | 31 | # Whiteout root 32 | dd if=/dev/zero of=/EMPTY bs=1M 33 | rm -rf /EMPTY 34 | 35 | # Whiteout /boot 36 | dd if=/dev/zero of=/boot/EMPTY bs=1M 37 | rm -rf /boot/EMPTY 38 | 39 | # Whiteout swap 40 | set +e 41 | swapuuid="$(/sbin/blkid -o value -l -s UUID -t type=SWAP)" 42 | case "$?" in 43 | 2|0) ;; 44 | *) exit 1 ;; 45 | esac 46 | set -e 47 | 48 | if [[ -n $swapuuid ]]; then 49 | swappart="$(readlink -f /dev/disk/by-uuid/$swapuuid)" 50 | if [[ -n $swappart ]]; then 51 | /sbin/swapoff "$swappart" 52 | dd if=/dev/zero of="$swappart" bs=1M 53 | /sbin/mkswap -U "$swapuuid" "$swappart" 54 | fi 55 | fi 56 | 57 | sync 58 | -------------------------------------------------------------------------------- /scripts/check-dotnet452.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs .Net 3.5 4 | #> # }}} 5 | [CmdletBinding(SupportsShouldProcess=$true)] 6 | Param( 7 | ) 8 | begin 9 | { 10 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 11 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 12 | } 13 | process 14 | { 15 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 16 | { 17 | $elapsed = '' 18 | if ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) days" } 19 | if ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hours" } 20 | if ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 21 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 22 | return $elapsed 23 | } # }}} 24 | 25 | # Prerequisites: {{{ 26 | # Prerequisite: Powershell 3 {{{2 27 | if($PSVersionTable.PSVersion.Major -lt 3) 28 | { 29 | Write-Error "Powershell version 3 or more recent is required" 30 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 31 | Start-Sleep 2 32 | exit 1 33 | } 34 | # 2}}} 35 | # Prerequisites }}} 36 | 37 | # Checking for dotnet 4.5.2 38 | $dotnet_info = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -ErrorAction SilentlyContinue 39 | if ($dotnet_info -eq $null -or $dotnet_info.Release -lt 379893) 40 | { 41 | Write-Error "Failure while installing .Net 4.5.2" 42 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 43 | Start-Sleep 5 44 | exit 1 45 | } 46 | } 47 | end 48 | { 49 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 50 | Start-Sleep 5 51 | exit $LastExitCode 52 | } 53 | -------------------------------------------------------------------------------- /scripts/check-icserver.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs CIC 4 | #> # }}} 5 | [CmdletBinding()] 6 | Param( 7 | [Parameter(Mandatory=$false)] 8 | [int] $RunningMsiAllowed = 1, 9 | [Parameter(Mandatory=$false)] 10 | [int] $Sleep = 10 11 | ) 12 | begin 13 | { 14 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 15 | $Product = 'Interaction Center Server' 16 | } 17 | process 18 | { 19 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 20 | { 21 | $elapsed = '' 22 | if ($watch.Elapsed.Days -gt 1) { $elapsed += " $($watch.Elapsed.Days) days" } 23 | elseif ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) day" } 24 | if ($watch.Elapsed.Hours -gt 1) { $elapsed += " $($watch.Elapsed.Hours) hours" } 25 | elseif ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hour" } 26 | if ($watch.Elapsed.Minutes -gt 1) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 27 | elseif ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minute" } 28 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 29 | return $elapsed 30 | } # }}} 31 | 32 | function Test-MsiExecMutex # {{{ 33 | { 34 | <# {{{2 35 | .SYNOPSIS 36 | Wait, up to a timeout, for the MSI installer service to become free. 37 | .DESCRIPTION 38 | The _MSIExecute mutex is used by the MSI installer service to serialize installations 39 | and prevent multiple MSI based installations happening at the same time. 40 | Wait, up to a timeout (default is 10 minutes), for the MSI installer service to become free 41 | by checking to see if the MSI mutex, "Global\\_MSIExecute", is available. 42 | Thanks to: https://psappdeploytoolkit.codeplex.com/discussions/554673 43 | .PARAMETER MsiExecWaitTime 44 | The length of time to wait for the MSI installer service to become available. 45 | This variable must be specified as a [timespan] variable type using the [New-TimeSpan] cmdlet. 46 | Example of specifying a [timespan] variable type: New-TimeSpan -Minutes 5 47 | .OUTPUTS 48 | Returns true for a successful wait, when the installer service has become free. 49 | Returns false when waiting for the installer service to become free has exceeded the timeout. 50 | .EXAMPLE 51 | Test-MsiExecMutex 52 | .EXAMPLE 53 | Test-MsiExecMutex -MsiExecWaitTime $(New-TimeSpan -Minutes 5) 54 | .EXAMPLE 55 | Test-MsiExecMutex -MsiExecWaitTime $(New-TimeSpan -Seconds 60) 56 | .LINK 57 | http://msdn.microsoft.com/en-us/library/aa372909(VS.85).aspx 58 | #> # }}}2 59 | [CmdletBinding()] 60 | Param 61 | ( 62 | [Parameter(Mandatory=$false)] 63 | [ValidateNotNullOrEmpty()] 64 | [timespan]$MsiExecWaitTime = $(New-TimeSpan -Minutes 10) 65 | ) 66 | 67 | Begin 68 | { 69 | ${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name 70 | $PSParameters = New-Object -TypeName PSObject -Property $PSBoundParameters 71 | 72 | Write-Verbose "Function Start" 73 | if (-not [string]::IsNullOrEmpty($PSParameters)) 74 | { 75 | Write-Verbose "Function invoked with bound parameters [$PSParameters]" 76 | } 77 | else 78 | { 79 | Write-Verbose "Function invoked without any bound parameters" 80 | } 81 | 82 | $IsMsiExecFreeSource = @" 83 | using System; 84 | using System.Threading; 85 | public class MsiExec 86 | { 87 | public static bool IsMsiExecFree(TimeSpan maxWaitTime) 88 | { 89 | /// 90 | /// Wait (up to a timeout) for the MSI installer service to become free. 91 | /// 92 | /// 93 | /// Returns true for a successful wait, when the installer service has become free. 94 | /// Returns false when waiting for the installer service has exceeded the timeout. 95 | /// 96 | 97 | // The _MSIExecute mutex is used by the MSI installer service to serialize installations 98 | // and prevent multiple MSI based installations happening at the same time. 99 | // For more info: http://msdn.microsoft.com/en-us/library/aa372909(VS.85).aspx 100 | const string installerServiceMutexName = "Global\\_MSIExecute"; 101 | Mutex MSIExecuteMutex = null; 102 | var isMsiExecFree = false; 103 | 104 | try 105 | { 106 | MSIExecuteMutex = Mutex.OpenExisting(installerServiceMutexName, 107 | System.Security.AccessControl.MutexRights.Synchronize); 108 | isMsiExecFree = MSIExecuteMutex.WaitOne(maxWaitTime, false); 109 | } 110 | catch (WaitHandleCannotBeOpenedException) 111 | { 112 | // Mutex doesn't exist, do nothing 113 | isMsiExecFree = true; 114 | } 115 | catch (ObjectDisposedException) 116 | { 117 | // Mutex was disposed between opening it and attempting to wait on it, do nothing 118 | isMsiExecFree = true; 119 | } 120 | finally 121 | { 122 | if (MSIExecuteMutex != null && isMsiExecFree) 123 | MSIExecuteMutex.ReleaseMutex(); 124 | } 125 | 126 | return isMsiExecFree; 127 | } 128 | } 129 | "@ 130 | 131 | If (-not ([System.Management.Automation.PSTypeName]'MsiExec').Type) 132 | { 133 | Add-Type -TypeDefinition $IsMsiExecFreeSource -Language CSharp 134 | } 135 | } 136 | Process 137 | { 138 | Try 139 | { 140 | If ($MsiExecWaitTime.TotalMinutes -gt 0) 141 | { 142 | [string]$WaitLogMsg = "$($MsiExecWaitTime.TotalMinutes) minutes" 143 | } 144 | Else 145 | { 146 | [string]$WaitLogMsg = "$($MsiExecWaitTime.TotalSeconds) seconds" 147 | } 148 | Write-Verbose "Check to see if the MSI installer service is available. Wait up to [$WaitLogMsg] for the installer service to become available." 149 | [boolean]$IsMsiExecInstallFree = [MsiExec]::IsMsiExecFree($MsiExecWaitTime) 150 | 151 | If ($IsMsiExecInstallFree) 152 | { 153 | Write-Verbose "The MSI installer service is available to start a new installation." 154 | } 155 | Else 156 | { 157 | Write-Verbose "The MSI installer service is not available because another installation is already in progress." 158 | } 159 | Return $IsMsiExecInstallFree 160 | } 161 | Catch 162 | { 163 | Write-Verbose "There was an error while attempting to check if the MSI installer service is available" 164 | } 165 | } 166 | End 167 | { 168 | Write-Verbose "Function End" 169 | } 170 | } # }}} 171 | 172 | try 173 | { 174 | #$MSI_available=Test-MSIExecMutex -MsiExecWaitTime $(New-TimeSpan -Minutes 5) 175 | #if (-not $MSI_available) 176 | #{ 177 | # Write-Output "IC Server installation is not finished yet. This is bad news..." 178 | # exit 1618 179 | #} 180 | 181 | $watch = [Diagnostics.StopWatch]::StartNew() 182 | do 183 | { 184 | Start-Sleep $Sleep 185 | $msiexec_count = @(Get-Process | where ProcessName -eq 'msiexec').Count 186 | $elapsed = Show-Elapsed($watch) 187 | Write-Output "Found ${msiexec_count} MSI installers running after $elapsed" 188 | } 189 | while ($msiexec_count -gt $RunningMsiAllowed) 190 | $watch.Stop() 191 | $elapsed = Show-Elapsed($watch) 192 | Write-Output "No more MSI installers running after $elapsed" 193 | 194 | if (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -match "${Product}.*") 195 | { 196 | Write-Output "$Product is installed" 197 | } 198 | else 199 | { 200 | Write-Output "Failed to install $Product" 201 | Write-Output "Manually backing up logs" 202 | 203 | if (Test-Path $env:USERPROFILE/share-log.info) 204 | { 205 | $ShareArgs = @{ PSProvider = 'FileSystem'; ErrorAction = 'Stop' } 206 | $ShareInfo = Get-Content $env:USERPROFILE/share-log.info -Raw | ConvertFrom-Json 207 | 208 | if ($ShareInfo.DriveLetter -ne $null) 209 | { 210 | if ($ShareInfo.User -ne $null) 211 | { 212 | if ($ShareInfo.Password -eq $null) 213 | { 214 | Throw "No password for $($ShareInfo.User) in $($env:USERPROFILE)/share-log.info" 215 | exit 1 216 | } 217 | $ShareArgs['Credential'] = New-Object System.Management.Automation.PSCredential($ShareInfo.User, (ConvertTo-SecureString -String $ShareInfo.Password -AsPlainText -Force)) 218 | } 219 | $Drive = New-PSDrive -Name $ShareInfo.DriveLetter -Root $ShareInfo.Path @ShareArgs 220 | $log_dir = $Drive.Root 221 | } 222 | else 223 | { 224 | $log_dir = $ShareInfo.Path 225 | } 226 | Write-Output "Using Share at $log_dir" 227 | } 228 | else 229 | { 230 | Write-Output "Share log information was not found" 231 | Write-Warning "No log will be backed up" 232 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 233 | exit 234 | } 235 | if ([string]::IsNullOrEmpty($log_dir)) 236 | { 237 | Throw "No share to use from $($env:USERPROFILE)/share-log.info" 238 | exit 2 239 | } 240 | 241 | $log_dir = (Join-Path $log_dir "${env:PACKER_BUILDER_TYPE}-${env:PACKER_BUILD_NAME}-$(Get-Date -Format 'yyyyMMddHHmmss')") 242 | if (! (Test-Path $log_dir)) { New-Item -ItemType Directory -Path $log_dir -ErrorAction Stop | Out-Null } 243 | 244 | if (Test-Path "C:\ProgramData\chocolatey\logs\chocolatey.log") 245 | { 246 | if ($PSCmdlet.ShouldProcess("chocolatey.log", "Backing up")) 247 | { 248 | Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log $log_dir 249 | } 250 | } 251 | 252 | Get-ChildItem "C:\Windows\Logs\*.log" | ForEach { 253 | if ($PSCmdlet.ShouldProcess((Split-Path $_ -Leaf), "Backing up")) 254 | { 255 | Copy-Item $_ $log_dir 256 | } 257 | } 258 | 259 | Get-ChildItem "C:\Windows\Logs\*.txt" | ForEach { 260 | if ($PSCmdlet.ShouldProcess((Split-Path $_ -Leaf), "Backing up")) 261 | { 262 | Copy-Item $_ $log_dir 263 | } 264 | } 265 | #Write-Output "Backing up logs" 266 | #Backup-Logs.ps1 267 | exit 2 268 | } 269 | } 270 | finally 271 | { 272 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 273 | Start-Sleep 2 274 | } 275 | } 276 | -------------------------------------------------------------------------------- /scripts/config-network.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | case "$PACKER_BUILDER_TYPE" in 4 | virtualbox-iso|virtualbox-ovf) 5 | major_version="`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release | awk -F. '{print $1}'`"; 6 | 7 | if [ "$major_version" -ge 6 ]; then 8 | # Fix slow DNS: 9 | # Add 'single-request-reopen' so it is included when /etc/resolv.conf is generated 10 | # https://access.redhat.com/site/solutions/58625 (subscription required) 11 | echo 'RES_OPTIONS="single-request-reopen"' >>/etc/sysconfig/network; 12 | service network restart; 13 | echo 'Slow DNS fix applied (single-request-reopen)'; 14 | fi 15 | ;; 16 | esac 17 | -------------------------------------------------------------------------------- /scripts/config-shell.ps1: -------------------------------------------------------------------------------- 1 | Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name Shell -Value 'Powershell.exe -NoExit -Command "$PSVersionTable; cd $env:userprofile"' -Force 2 | -------------------------------------------------------------------------------- /scripts/create-user-vagrant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -euxo pipefail 2 | 3 | HOME_DIR="${HOME_DIR:-/home/vagrant}" 4 | 5 | install -v -o vagrant -g vagrant -m 0700 -d $HOME_DIR/.ssh 6 | curl --insecure -o $HOME_DIR/.ssh/authorized_keys -kL 'https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub' 7 | chown vagrant:vagrant $HOME_DIR/.ssh/authorized_keys 8 | chmod 600 $HOME_DIR/.ssh/authorized_keys 9 | 10 | cat <<'EOF' > $HOME_DIR/.bash_profile 11 | [ -f ~/.bashrc ] && . ~/.bashrc 12 | export PATH=$PATH:/sbin:/usr/sbin:$HOME/bin 13 | EOF 14 | -------------------------------------------------------------------------------- /scripts/disable-update.ps1: -------------------------------------------------------------------------------- 1 | $WindowsUpdateKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" 2 | 3 | $Update_Never = 1 4 | $Update_Check = 2 5 | $Update_Download = 3 6 | $Update_Auto = 4 7 | 8 | Set-ItemProperty -Path $WindowsUpdateKey -Name AUOptions -Value $Update_Never -Force -Confirm:$false 9 | Set-ItemProperty -Path $WindowsUpdateKey -Name CachedAUOptions -Value $Update_Never -Force -Confirm:$false 10 | -------------------------------------------------------------------------------- /scripts/enable-update.ps1: -------------------------------------------------------------------------------- 1 | $mgr = New-Object -ComObject Microsoft.Update.ServiceManager -Strict 2 | $mgr.ClientApplicationID = "packer" 3 | $mgr.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") 4 | -------------------------------------------------------------------------------- /scripts/install-chocolatey.ps1: -------------------------------------------------------------------------------- 1 | 2 | #iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) 3 | (new-object net.webclient).DownloadFile('https://chocolatey.org/install.ps1', 'C:\Windows\Temp\install.ps1') 4 | 5 | $env:chocolateyUseWindowsCompression = 'false' 6 | for($try = 0; $try -lt 5; $try++) 7 | { 8 | & C:/Windows/Temp/install.ps1 9 | if ($?) { exit 0 } 10 | if (Test-Path C:\ProgramData\chocolatey) { exit 0 } 11 | Write-Host "Failed to install chocolatey (Try #${try})" 12 | Start-Sleep 2 13 | } 14 | Write-Error "Chocolatey failed to install, please re-build your machine again" 15 | exit 2 16 | -------------------------------------------------------------------------------- /scripts/install-dotnet35.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs .Net 3.5 4 | #> # }}} 5 | [CmdletBinding(SupportsShouldProcess=$true)] 6 | Param( 7 | ) 8 | begin 9 | { 10 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 11 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 12 | } 13 | process 14 | { 15 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 16 | { 17 | $elapsed = '' 18 | if ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) days" } 19 | if ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hours" } 20 | if ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 21 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 22 | return $elapsed 23 | } # }}} 24 | 25 | # Prerequisites: {{{ 26 | # Prerequisite: Powershell 3 {{{2 27 | if($PSVersionTable.PSVersion.Major -lt 3) 28 | { 29 | Write-Error "Powershell version 3 or more recent is required" 30 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 31 | Start-Sleep 2 32 | exit 1 33 | } 34 | # 2}}} 35 | # Prerequisites }}} 36 | 37 | if ((Get-WindowsFeature Net-Framework-Core -Verbose:$false).InstallState -ne 'Installed') 38 | { 39 | if (Get-Hotfix -id 2966828 -ErrorAction SilentlyContinue) 40 | { 41 | Write-Output "KB 2966828 was installed, we need to uninstall it" 42 | 43 | $install='NDPFixit-KB3005628-X64.exe' 44 | $source_url="http://download.microsoft.com/download/8/0/8/80894270-D665-4E7A-8A2C-814373FC25C1/$install" 45 | $dest=Join-Path $env:TEMP $install 46 | 47 | Write-Output "Downloading KB 3005628" 48 | #Start-BitsTransfer -Source $source_url -Destination $dest -ErrorAction Stop 49 | (New-Object System.Net.WebClient).DownloadFile($source_url, $dest) 50 | 51 | #& ${env:TEMP}\NDPFixit-KB3005628-X64.exe /Log C:\Windows\Logs\KB-3005628.log 52 | & ${env:TEMP}\NDPFixit-KB3005628-X64.exe 53 | } 54 | Write-Output "Installing .Net 3.5" 55 | $watch = [Diagnostics.StopWatch]::StartNew() 56 | if ($PSCmdlet.ShouldProcess('.Net 3.5', "Running msiexec /install")) 57 | { 58 | $parms = @{} 59 | $dvd_drives = Get-WmiObject Win32_LogicalDisk -Filter 'DriveType=5' | Select -ExpandProperty DeviceID 60 | foreach ($_ in $dvd_drives) 61 | { 62 | $sources = (Join-Path $_ (Join-Path 'sources' 'sxs')) 63 | if (Test-Path $sources) 64 | { 65 | $parms['Source'] = $sources 66 | Write-Output "Using $sources to install .Net" 67 | break 68 | } 69 | } 70 | 71 | $results = Install-WindowsFeature -Name Net-Framework-Core -LogPath C:\Windows\Logs\dotnet-3.5.log @parms -Verbose 72 | if (! $results.Success) 73 | { 74 | Write-Error "Failure while installing .Net 3.5, exit code: $($results.ExitCode)" 75 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 76 | Start-Sleep 10 77 | exit 1 78 | } 79 | } 80 | $watch.Stop() 81 | $elapsed = Show-Elapsed($watch) 82 | Write-Output ".Net 3.5 installed successfully in $elapsed!" 83 | Write-Output $results.FeatureResult 84 | switch($results.RestartNeeded) 85 | { 86 | [Microsoft.Windows.ServerManager.Commands.RestartState]::Yes 87 | { 88 | Write-Warning "The system will need to be restarted to be able to use the new features" 89 | } 90 | [Microsoft.Windows.ServerManager.Commands.RestartState]::Maybe 91 | { 92 | Write-Warning "The system might need to be restarted to be able to use the new features" 93 | } 94 | [Microsoft.Windows.ServerManager.Commands.RestartState]::No 95 | { 96 | Write-Output "The system does not need to be restarted to be able to use the new features" 97 | } 98 | } 99 | } 100 | } 101 | end 102 | { 103 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 104 | Start-Sleep 5 105 | exit 0 106 | } 107 | -------------------------------------------------------------------------------- /scripts/install-dotnet452.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs .Net 3.5 4 | #> # }}} 5 | [CmdletBinding(SupportsShouldProcess=$true)] 6 | Param( 7 | ) 8 | begin 9 | { 10 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 11 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 12 | } 13 | process 14 | { 15 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 16 | { 17 | $elapsed = '' 18 | if ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) days" } 19 | if ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hours" } 20 | if ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 21 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 22 | return $elapsed 23 | } # }}} 24 | 25 | # Prerequisites: {{{ 26 | # Prerequisite: Powershell 3 {{{2 27 | if($PSVersionTable.PSVersion.Major -lt 3) 28 | { 29 | Write-Error "Powershell version 3 or more recent is required" 30 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 31 | Start-Sleep 2 32 | exit 1 33 | } 34 | # 2}}} 35 | # Prerequisites }}} 36 | 37 | Write-Output "Checking if .Net 4.5.2 or more is installed" 38 | $dotnet_info = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -ErrorAction SilentlyContinue 39 | if ($dotnet_info -eq $null -or $dotnet_info.Release -lt 379893) 40 | { 41 | if (Test-Path $env:USERPROFILE/mounted.info) 42 | { 43 | $SourceDriveLetter = Get-Content $env:USERPROFILE/mounted.info 44 | Write-Verbose "Got drive letter from a previous mount: $SourceDriveLetter" 45 | if (Test-Path "${SourceDriveLetter}\ThirdPartyInstalls\Microsoft\DotNET4.5.2\dotNetFx452_Full_x86_x64.exe") 46 | { 47 | Write-Output "Installing .Net 4.5.2 from the ISO ($SourceDriveLetter)" 48 | & ${SourceDriveLetter}ThirdPartyInstalls\Microsoft\DotNET4.5.2\dotNetFx452_Full_x86_x64.exe /Passive /norestart /Log C:\Windows\Logs\dotnet-4.5.2.log.txt 49 | Start-Sleep 60 50 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 51 | Start-Sleep 5 52 | exit 53 | } 54 | } 55 | $install='NDP452-KB2901907-x86-x64-AllOS-ENU.exe' 56 | $source_url="https://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/$install" 57 | $dest=Join-Path $env:TEMP $install 58 | 59 | Write-Output "Downloading .Net 4.5.2" 60 | #Start-BitsTransfer -Source $source_url -Destination $dest -ErrorAction Stop 61 | (New-Object System.Net.WebClient).DownloadFile($source_url, $dest) 62 | 63 | 64 | Write-Output "Installing .Net 4.5.2" 65 | & ${env:TEMP}\NDP452-KB2901907-x86-x64-AllOS-ENU.exe /Passive /norestart /Log C:\Windows\Logs\dotnet-4.5.2.log.txt 66 | Start-Sleep 60 67 | } 68 | } 69 | end 70 | { 71 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 72 | Start-Sleep 5 73 | exit $LastExitCode 74 | } 75 | -------------------------------------------------------------------------------- /scripts/install-gui.ps1: -------------------------------------------------------------------------------- 1 | Add-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra 2 | -------------------------------------------------------------------------------- /scripts/install-icextras.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs Extra software from Interaction Center 4 | #> # }}} 5 | [CmdletBinding()] 6 | Param( 7 | [Parameter(Mandatory=$false)] 8 | [string] $SourceDriveLetter 9 | ) 10 | begin 11 | { 12 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 13 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 14 | $InstallPath = "${env:ProgramFiles(x86)}\Interactive Intelligence\GetHostID" 15 | } 16 | process 17 | { 18 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 19 | { 20 | $elapsed = '' 21 | if ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) days" } 22 | if ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hours" } 23 | if ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 24 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 25 | return $elapsed 26 | } # }}} 27 | 28 | # Prerequisites: {{{ 29 | # Prerequisite: Powershell 3 {{{2 30 | if($PSVersionTable.PSVersion.Major -lt 3) 31 | { 32 | Write-Error "Powershell version 3 or more recent is required" 33 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 34 | Start-Sleep 2 35 | exit 1 36 | } 37 | # 2}}} 38 | 39 | # Prerequisite: Find the source! {{{2 40 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 41 | { 42 | if (Test-Path $env:USERPROFILE/mounted.info) 43 | { 44 | $SourceDriveLetter = Get-Content $env:USERPROFILE/mounted.info 45 | Write-Verbose "Got drive letter from a previous mount: $SourceDriveLetter" 46 | } 47 | else 48 | { 49 | $SourceDriveLetter = ls function:[d-z]: -n | ?{ Test-Path "$_\Additional_Files\GetHostID" } | Select -First 1 50 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 51 | { 52 | Write-Error "No drive containing installation was mounted" 53 | exit 3 54 | } 55 | Write-Verbose "Calculated drive letter: $SourceDriveLetter" 56 | } 57 | } 58 | $InstallSource = "${SourceDriveLetter}\Additional_Files\GetHostID" 59 | if (! (Test-Path $InstallSource)) 60 | { 61 | Write-Error "$Product Installation source not found in $SourceDriveLetter" 62 | Start-Sleep 2 63 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 64 | exit 2 65 | } 66 | Write-Output "Installing from $InstallSource" 67 | # 2}}} 68 | 69 | # Prerequisites }}} 70 | 71 | Write-Output "Installing Interactive Intelligence Extras..." 72 | 73 | if (! (Test-Path $InstallPath)) 74 | { 75 | Write-Verbose " Creating folder $InstallPath" 76 | New-Item -ItemType Directory -Path $InstallPath | Out-Null 77 | } 78 | 79 | Write-Verbose " Copying files from $InstallSource to $InstallPath" 80 | Copy-Item "${InstallSource}\*" $InstallPath 81 | if (! $?) 82 | { 83 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 84 | Start-Sleep 2 85 | exit 1 86 | } 87 | } 88 | end 89 | { 90 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 91 | Start-Sleep 2 92 | } 93 | 94 | -------------------------------------------------------------------------------- /scripts/install-icfirmware.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs Interaction Center Firmware 4 | #> # }}} 5 | [CmdletBinding(SupportsShouldProcess=$true)] 6 | Param( 7 | [Parameter(Mandatory=$false)] 8 | [string] $SourceDriveLetter, 9 | [Parameter(Mandatory=$false)] 10 | [switch] $Reboot 11 | ) 12 | begin 13 | { 14 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 15 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 16 | $Product = 'Interaction Firmware' 17 | $msi_prefix = 'InteractionFirmware' 18 | $Log = "C:\Windows\Logs\${msi_prefix}-${Now}.log" 19 | } 20 | process 21 | { 22 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 23 | { 24 | $elapsed = '' 25 | if ($watch.Elapsed.Days -gt 1) { $elapsed += " $($watch.Elapsed.Days) days" } 26 | elseif ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) day" } 27 | if ($watch.Elapsed.Hours -gt 1) { $elapsed += " $($watch.Elapsed.Hours) hours" } 28 | elseif ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hour" } 29 | if ($watch.Elapsed.Minutes -gt 1) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 30 | elseif ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minute" } 31 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 32 | return $elapsed 33 | } # }}} 34 | 35 | # Prerequisites: {{{ 36 | # Prerequisite: Product is not installed {{{2 37 | if (Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -match "${Product}.*") 38 | { 39 | Write-Output "$Product is already installed" 40 | exit 41 | } 42 | if (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -match "${Product}.*") 43 | { 44 | Write-Output "$Product is already installed" 45 | exit 46 | } 47 | # 2}}} 48 | 49 | # Prerequisite: Powershell 3 {{{2 50 | if($PSVersionTable.PSVersion.Major -lt 3) 51 | { 52 | Write-Error "Powershell version 3 or more recent is required" 53 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 54 | Start-Sleep 2 55 | exit 1 56 | } 57 | # 2}}} 58 | 59 | # Prerequisite: Interaction Center Server {{{2 60 | if (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -match "Interaction Center Server.*") 61 | { 62 | Write-Output "Interaction Center Server is installed, we can proceed" 63 | } 64 | else 65 | { 66 | Write-Error "Interaction Center Server is not installed, aborting." 67 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 68 | Start-Sleep 2 69 | exit 3 70 | } 71 | # 2}}} 72 | 73 | # Prerequisite: Find the source! {{{2 74 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 75 | { 76 | if (Test-Path $env:USERPROFILE/mounted.info) 77 | { 78 | $SourceDriveLetter = Get-Content $env:USERPROFILE/mounted.info 79 | Write-Verbose "Got drive letter from a previous mount: $SourceDriveLetter" 80 | } 81 | else 82 | { 83 | $SourceDriveLetter = ls function:[d-z]: -n | ?{ Test-Path "$_\Installs\ServerComponents" } | Select -First 1 84 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 85 | { 86 | Write-Error "No drive containing installation for $Product was mounted" 87 | exit 3 88 | } 89 | Write-Verbose "Calculated drive letter: $SourceDriveLetter" 90 | } 91 | } 92 | Write-Verbose "Searching for $msi_prefix in $(Get-ChildItem -Path ${SourceDriveLetter}\Installs\ServerComponents)" 93 | $InstallSource = (Get-ChildItem -Path "${SourceDriveLetter}\Installs\ServerComponents" -Filter "${msi_prefix}_*.msi").FullName 94 | if (! (Test-Path $InstallSource)) 95 | { 96 | Write-Error "$Product Installation source not found in $SourceDriveLetter" 97 | Start-Sleep 2 98 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 99 | exit 2 100 | } 101 | Write-Output "Installing from $InstallSource" 102 | # 2}}} 103 | 104 | # Prerequisites }}} 105 | 106 | Write-Output "Installing $Product" 107 | $parms = '/i',"${InstallSource}" 108 | $parms += 'STARTEDBYEXEORIUPDATE=1' 109 | $parms += 'REBOOT=ReallySuppress' 110 | $parms += '/l*v' 111 | $parms += "$Log" 112 | $parms += '/qn' 113 | $parms += '/norestart' 114 | 115 | Write-Verbose "Arguments: $($parms -join ',')" 116 | 117 | if ($PSCmdlet.ShouldProcess($Product, "Running msiexec /install")) 118 | { 119 | $watch = [Diagnostics.StopWatch]::StartNew() 120 | $process = Start-Process -FilePath msiexec -ArgumentList $parms -Wait -PassThru 121 | $watch.Stop() 122 | $elapsed = Show-Elapsed($watch) 123 | if ($process.ExitCode -eq 0) 124 | { 125 | Write-Output "$Product installed successfully in $elapsed!" 126 | $exit_code = 0 127 | } 128 | elseif ($process.ExitCode -eq 3010) 129 | { 130 | Write-Output "$Product installed successfully in $elapsed!" 131 | $exit_code = 0 132 | if ($Reboot) 133 | { 134 | Write-Output "Restarting..." 135 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 136 | Restart-Computer 137 | Start-Sleep 30 138 | } 139 | else 140 | { 141 | Write-Warning "Rebooting is needed before using $Product" 142 | } 143 | } 144 | else 145 | { 146 | Write-Error "Failure: Error= $($process.ExitCode), Logs=$Log, Execution time=$elapsed" 147 | $exit_code = $process.ExitCode 148 | } 149 | } 150 | } 151 | end 152 | { 153 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 154 | Start-Sleep 2 155 | exit $exit_code 156 | } 157 | -------------------------------------------------------------------------------- /scripts/install-icpatch.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs CIC 4 | #> # }}} 5 | [CmdletBinding(SupportsShouldProcess=$true)] 6 | Param( 7 | [Parameter(Mandatory=$false)] 8 | [ValidateNotNullOrEmpty()] 9 | [string] $SourceDriveLetter, 10 | [Parameter(Mandatory=$false)] 11 | [ValidateNotNullOrEmpty()] 12 | [Alias('Product')] 13 | [string] $ProductName, 14 | [Parameter(Mandatory=$false)] 15 | [switch] $AsJob, 16 | [Parameter(Mandatory=$false)] 17 | [ValidateNotNullOrEmpty()] 18 | [string] $JobName, 19 | [Parameter(Mandatory=$false)] 20 | [switch] $Reboot 21 | ) 22 | begin 23 | { 24 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 25 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 26 | $product_key = "HKLM:\SOFTWARE\Wow6432Node\Interactive Intelligence\Installed\Products\*" 27 | } 28 | process 29 | { 30 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 31 | { 32 | $elapsed = '' 33 | if ($watch.Elapsed.Days -gt 1) { $elapsed += " $($watch.Elapsed.Days) days" } 34 | elseif ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) day" } 35 | if ($watch.Elapsed.Hours -gt 1) { $elapsed += " $($watch.Elapsed.Hours) hours" } 36 | elseif ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hour" } 37 | if ($watch.Elapsed.Minutes -gt 1) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 38 | elseif ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minute" } 39 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 40 | return $elapsed 41 | } # }}} 42 | 43 | # Prerequisites: {{{ 44 | # Prerequisite: Powershell 3 {{{2 45 | if($PSVersionTable.PSVersion.Major -lt 3) 46 | { 47 | Write-Error "Powershell version 3 or more recent is required" 48 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 49 | Start-Sleep 2 50 | exit 1 51 | } 52 | # 2}}} 53 | 54 | # Prerequisite: Find the source! {{{2 55 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 56 | { 57 | if (Test-Path $env:USERPROFILE/mounted.info) 58 | { 59 | $SourceDriveLetter = Get-Content $env:USERPROFILE/mounted.info 60 | } 61 | else 62 | { 63 | $SourceDriveLetter = ls function:[d-z]: -n | ?{ Test-Path "$_\Installs\ServerComponents" } | Select -First 1 64 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 65 | { 66 | Write-Output "No drive containing patches for $Product was mounted" 67 | Write-Output "No action will be taken" 68 | exit 0 69 | } 70 | } 71 | } 72 | Write-Verbose "Patches will be run from $SourceDriveLetter" 73 | # 2}}} 74 | # Prerequisites }}} 75 | 76 | $want_reboot = $false 77 | if ($PSBoundParameters.ContainsKey('ProductName')) 78 | { 79 | $products = Get-ItemProperty $product_key | Where { $_.ProductName -like "*${ProductName}*" } 80 | } 81 | else 82 | { 83 | $products = Get-ItemProperty $product_key | Where { $_.ProductName -ne $null } 84 | } 85 | $jobs = @() 86 | $products | ForEach { 87 | Write-Output "Checking $($_.ProductName)" 88 | 89 | if ($product_info = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq $_.ProductName) 90 | { 91 | Write-Output " version $($product_info.DisplayVersion) is installed" 92 | } 93 | elseif ($product_info = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq $_.ProductName) 94 | { 95 | Write-Output " version $($product_info.DisplayVersion) is installed" 96 | } 97 | else 98 | { 99 | Write-Error "$Product is not installed properly, aborting." 100 | return # aka continue (We are in a foreack ScriptBlock!) 101 | } 102 | 103 | if ($_.ProductName -match '^Interaction Center Server.*') { $msi_prefix = 'icserver'} 104 | elseif ($_.ProductName -match '^Interaction Firmware.*') { $msi_prefix = 'InteractionFirmware' } 105 | else 106 | { 107 | Write-Error "Patching $($_.ProductName) is not yet supported. Please report this to the DaaS team" 108 | return # aka continue (We are in a foreack ScriptBlock!) 109 | } 110 | Write-Verbose " MSI Prefix: $msi_prefix" 111 | 112 | $InstallSource = (Get-ChildItem -Path "${SourceDriveLetter}\Installs\ServerComponents" -Filter "${msi_prefix}_*.msp").FullName 113 | if ([string]::IsNullOrEmpty($InstallSource) -or ! (Test-Path $InstallSource)) 114 | { 115 | Write-Error "$Product Patch not found in $SourceDriveLetter" 116 | return # aka continue (We are in a foreack ScriptBlock!) 117 | } 118 | 119 | if ($InstallSource -match '.*Patch([0-9]+)\.msp') { $Patch = $matches[1] } 120 | if ((Split-Path $InstallSource -Leaf) -le "${msi_prefix}_$($_.SU).msp") 121 | { 122 | Write-Output " already patched to $($_.SU) (Patch $Patch)" 123 | return # aka continue (We are in a foreack ScriptBlock!) 124 | } 125 | Write-Output "Patching $($_.ProductName) to Patch $Patch..." 126 | Write-Verbose " from $InstallSource" 127 | $Log = "C:\Windows\Logs\${msi_prefix}-patch-${Now}.log" 128 | $parms = '/update',"${InstallSource}" 129 | $parms += 'STARTEDBYEXEORIUPDATE=1' 130 | $parms += 'REBOOT=ReallySuppress' 131 | $parms += '/l*v' 132 | $parms += $Log 133 | $parms += '/qn' 134 | $parms += '/norestart' 135 | Write-Verbose "Arguments: $($parms -join ',')" 136 | 137 | if ($PSCmdlet.ShouldProcess($_.ProductName, "Running msiexec /update")) 138 | { 139 | if ($AsJob) 140 | { 141 | #$job_parms = @{} 142 | #if (! [string]::IsNullOrEmpty($JobName)) { $job_parms['Name'] = $JobName } 143 | #$job = Start-Job @job_parms -ScriptBlock { &msiexec.exe $args } -ArgumentList $parms 144 | #Write-Verbose "Job Created: $Job" 145 | #$jobs += $job 146 | $process = Start-Process -FilePath msiexec -ArgumentList $parms -PassThru 147 | Write-Output "$Product is patching (process: $($process.Id))" 148 | } 149 | else 150 | { 151 | $watch = [Diagnostics.StopWatch]::StartNew() 152 | $process = Start-Process -FilePath msiexec -ArgumentList $parms -Wait -PassThru 153 | $watch.Stop() 154 | $elapsed = Show-Elapsed($watch) 155 | 156 | if ($process.ExitCode -eq 0) 157 | { 158 | Write-Output "$Product patched successfully in $elapsed!" 159 | $exit_code = 0 160 | } 161 | elseif ($process.ExitCode -eq 3010) 162 | { 163 | Write-Output "$($_.ProductName) patched successfully in $elapsed!" 164 | Write-Warning "Rebooting is needed before using $($_.ProductName)" 165 | $want_reboot = $true 166 | $exit_code = 0 167 | } 168 | else 169 | { 170 | Write-Error "Failure: Error= $($process.ExitCode), Logs=$Log, Execution time=$elapsed" 171 | $exit_code = $process.ExitCode 172 | } 173 | } 174 | } 175 | } 176 | if ($want_reboot -and $Reboot) 177 | { 178 | if ($PSCmdlet.ShouldProcess($env:COMPUTERNAME, 'Reboot')) 179 | { 180 | Write-Output "Restarting..." 181 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 182 | Restart-Computer 183 | Start-Sleep 30 184 | } 185 | } 186 | } 187 | end 188 | { 189 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 190 | # return $jobs 191 | Start-Sleep 2 192 | exit $exit_code 193 | } 194 | -------------------------------------------------------------------------------- /scripts/install-icserver.ps1: -------------------------------------------------------------------------------- 1 | <# # Documentation {{{ 2 | .Synopsis 3 | Installs CIC 4 | #> # }}} 5 | [CmdletBinding(SupportsShouldProcess=$true)] 6 | Param( 7 | [Parameter(Mandatory=$false)] 8 | [string] $User = 'vagrant', 9 | [Parameter(Mandatory=$false)] 10 | [string] $Password = 'vagrant', 11 | [Parameter(Mandatory=$false)] 12 | [string] $InstallPath = 'C:\I3\IC', 13 | [Parameter(Mandatory=$false)] 14 | [string] $SourceDriveLetter, 15 | [Parameter(Mandatory=$false)] 16 | [switch] $Wait, 17 | [Parameter(Mandatory=$false)] 18 | [switch] $Reboot 19 | ) 20 | begin 21 | { 22 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 23 | $Now = Get-Date -Format 'yyyyMMddHHmmss' 24 | $Product = 'Interaction Center Server' 25 | $msi_prefix = 'icserver' 26 | $Log = "C:\Windows\Logs\${msi_prefix}-${Now}.log" 27 | } 28 | process 29 | { 30 | function Show-Elapsed([Diagnostics.StopWatch] $watch) # {{{ 31 | { 32 | $elapsed = '' 33 | if ($watch.Elapsed.Days -gt 1) { $elapsed += " $($watch.Elapsed.Days) days" } 34 | elseif ($watch.Elapsed.Days -gt 0) { $elapsed += " $($watch.Elapsed.Days) day" } 35 | if ($watch.Elapsed.Hours -gt 1) { $elapsed += " $($watch.Elapsed.Hours) hours" } 36 | elseif ($watch.Elapsed.Hours -gt 0) { $elapsed += " $($watch.Elapsed.Hours) hour" } 37 | if ($watch.Elapsed.Minutes -gt 1) { $elapsed += " $($watch.Elapsed.Minutes) minutes" } 38 | elseif ($watch.Elapsed.Minutes -gt 0) { $elapsed += " $($watch.Elapsed.Minutes) minute" } 39 | if ($watch.Elapsed.Seconds -gt 0) { $elapsed += " $($watch.Elapsed.Seconds) seconds" } 40 | return $elapsed 41 | } # }}} 42 | 43 | # Prerequisites: {{{ 44 | # Prerequisite: Product is not installed {{{2 45 | if (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -match "${Product}.*") 46 | { 47 | Write-Output "$Product is already installed" 48 | exit 49 | } 50 | # 2}}} 51 | 52 | # Prerequisite: Powershell 3 {{{2 53 | if($PSVersionTable.PSVersion.Major -lt 3) 54 | { 55 | Write-Error "Powershell version 3 or more recent is required" 56 | Start-Sleep 2 57 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 58 | exit 1 59 | } 60 | # 2}}} 61 | 62 | # Prerequisite: Find the source! {{{2 63 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 64 | { 65 | if (Test-Path $env:USERPROFILE/mounted.info) 66 | { 67 | $SourceDriveLetter = Get-Content $env:USERPROFILE/mounted.info 68 | Write-Verbose "Got drive letter from a previous mount: $SourceDriveLetter" 69 | } 70 | else 71 | { 72 | $SourceDriveLetter = ls function:[d-z]: -n | ?{ Test-Path "$_\Installs\ServerComponents" } | Select -First 1 73 | if ([string]::IsNullOrEmpty($SourceDriveLetter)) 74 | { 75 | Write-Error "No drive containing installation for $Product was mounted" 76 | exit 3 77 | } 78 | Write-Verbose "Calculated drive letter: $SourceDriveLetter" 79 | } 80 | } 81 | $InstallSource = (Get-ChildItem -Path "${SourceDriveLetter}\Installs\ServerComponents" -Filter "${msi_prefix}_*.msi").FullName 82 | if (! (Test-Path $InstallSource)) 83 | { 84 | Write-Error "$Product Installation source not found in $SourceDriveLetter" 85 | Start-Sleep 2 86 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 87 | exit 2 88 | } 89 | if ($InstallSource -match '.*\\ICServer_([0-9]+)_R([0-9]+)\.msi') 90 | { 91 | $ProductVersion = $matches[1] 92 | $ProductRelease = $matches[2] 93 | Write-Output "Installing $Product ${ProducVersion}R${ProductRelease} from $InstallSource" 94 | } 95 | else 96 | { 97 | Write-Error "Cannot find version and release of $Product in $InstallSource" 98 | Start-Sleep 2 99 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 100 | exit 2 101 | } 102 | # 2}}} 103 | 104 | # Prerequisite: .Net {{{2 105 | # For now, we always need .Net 3.5 106 | if ((Get-WindowsFeature -Name Net-Framework-Core -Verbose:$false).InstallState -ne 'Installed') 107 | { 108 | Write-Output ".Net 3.5 install state: $((Get-WindowsFeature -Name Net-Framework-Core -Verbose:$false).InstallState)" 109 | Write-Output "Installing .Net 3.5" 110 | Install-WindowsFeature -Name Net-Framework-Core 111 | if (! $?) 112 | { 113 | Write-Error "ERROR $LastExitCode while installing .Net 3.5" 114 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 115 | Start-Sleep 10 116 | exit $LastExitCode 117 | } 118 | } 119 | else 120 | { 121 | Write-Output ".Net 3.5 is installed" 122 | } 123 | if ($ProductVersion -ge 2016) 124 | { 125 | Write-Output "Checking if .Net 4.5.2 or more is installed" 126 | # We need .Net >= 4.5.2 127 | $dotnet_info = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -ErrorAction SilentlyContinue 128 | if ($dotnet_info -eq $null -or $dotnet_info.Release -lt 379893) 129 | { 130 | if (Test-Path "${SourceDriveLetter}\ThirdPartyInstalls\Microsoft\DotNET4.5.2\dotNetFx452_Full_x86_x64.exe") 131 | { 132 | Write-Output "Installing .Net 4.5.2 from the ISO" 133 | & ${SourceDriveLetter}ThirdPartyInstalls\Microsoft\DotNET4.5.2\dotNetFx452_Full_x86_x64.exe /Passive /norestart /Log C:\Windows\Logs\dotnet-4.5.2.log.txt 134 | } 135 | else 136 | { 137 | Write-Output "Installing .Net 4.5.2 from the Internet" 138 | choco install -y dotnet4.5.2 139 | } 140 | } 141 | else 142 | { 143 | Write-Output ".Net 4.5.2 or better is installed" 144 | } 145 | } 146 | # 2}}} 147 | 148 | # Prerequisites }}} 149 | 150 | Write-Output "Installing $Product" 151 | #TODO: Capture the domain if it is in $User 152 | $Domain = $env:COMPUTERNAME 153 | 154 | $parms = '/i',"${InstallSource}" 155 | $parms += "PROMPTEDUSER=$User" 156 | $parms += "PROMPTEDDOMAIN=$Domain" 157 | $parms += "PROMPTEDPASSWORD=$Password" 158 | $parms += "INTERACTIVEINTELLIGENCE=$InstallPath" 159 | $parms += "TRACING_LOGS=$InstallPath\Logs" 160 | $parms += 'STARTEDBYEXEORIUPDATE=1' 161 | $parms += 'CANCELBIG4COPY=1' 162 | $parms += 'OVERRIDEKBREQUIREMENT=1' 163 | $parms += 'REBOOT=ReallySuppress' 164 | $parms += '/l*v' 165 | $parms += "$Log" 166 | $parms += '/qn' 167 | $parms += '/norestart' 168 | 169 | Write-Verbose "Arguments: $($parms -join ',')" 170 | if ($PSCmdlet.ShouldProcess($_.ProductName, "Running msiexec /install")) 171 | { 172 | if ($Wait) 173 | { 174 | $watch = [Diagnostics.StopWatch]::StartNew() 175 | $process = Start-Process -FilePath msiexec -ArgumentList $parms -Wait -PassThru 176 | $watch.Stop() 177 | $elapsed = Show-Elapsed($watch) 178 | if ($process.ExitCode -eq 0) 179 | { 180 | Write-Output "$Product installed successfully in $elapsed!" 181 | $exit_code = 0 182 | } 183 | elseif ($process.ExitCode -eq 3010) 184 | { 185 | Write-Output "$Product installed successfully in $elapsed!" 186 | $exit_code = 0 187 | if ($Reboot) 188 | { 189 | Write-Output "Restarting..." 190 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 191 | Restart-Computer 192 | Start-Sleep 30 193 | } 194 | else 195 | { 196 | Write-Warning "Rebooting is needed before using $Product" 197 | } 198 | } 199 | else 200 | { 201 | Write-Error "Failure: Error= $($process.ExitCode), Logs=$Log, Execution time=$elapsed" 202 | $exit_code = $process.ExitCode 203 | } 204 | } 205 | else 206 | { 207 | $process = Start-Process -FilePath msiexec -ArgumentList $parms -PassThru 208 | # Give some time for the msiexec process to start 209 | Start-Sleep 30 210 | Write-Output "$Product is being installed" 211 | if ($process.HasExited) 212 | { 213 | $exit_code = $process.ExitCode 214 | #if ($exit_code -ne 0) 215 | #{ 216 | #Write-Error "$Product failed to start installing itself. Error: $exit_code." 217 | Write-Output "Install process exit code: [${exit_code}]." 218 | $exit_code = 0 219 | #} 220 | } 221 | else 222 | { 223 | Write-Output "Installing..." 224 | } 225 | } 226 | 227 | # The ICServer MSI tends to not finish properly even if successful 228 | # $process = Start-Process -FilePath msiexec -ArgumentList $parms -PassThru 229 | 230 | # # Let's wait for things to start and be well under way 231 | # Start-Sleep 30 232 | 233 | # # Check for MSI Exec processes 234 | # # When there is 0 or 1 MSI process left, we should be good to continue 235 | # do 236 | # { 237 | # Start-Sleep 10 238 | # $process_count = @(Get-Process | Where ProcessName -eq 'msiexec').Count 239 | # Write-Verbose " Still $process_count MSI processes running [$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')]" 240 | # } 241 | # while ($process_count -gt 1) 242 | # Write-Verbose " No more MSI running" 243 | 244 | # # Check for successful installation 245 | # if (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq $Product) 246 | # { 247 | # Write-Verbose "$Product is installed" 248 | # } 249 | # else 250 | # { 251 | # #TODO: Should we return values or raise exceptions? 252 | # Write-Error "Failed to install $Product" 253 | # return -2 254 | # } 255 | } 256 | } 257 | end 258 | { 259 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 260 | Start-Sleep 5 261 | exit $exit_code 262 | } 263 | -------------------------------------------------------------------------------- /scripts/install-puppet-modules.cmd: -------------------------------------------------------------------------------- 1 | cmd /c certutil -addstore "Root" C:\Windows\Temp\GeoTrust_Global_CA.pem 2 | cmd /c del C:\Windows\Temp\GeoTrust_Global_CA.pem 3 | puppet.bat module install puppetlabs-windows 4 | puppet.bat module install puppetlabs-dism 5 | puppet.bat module install puppetlabs-inifile 6 | puppet.bat module install gildas-firewall 7 | -------------------------------------------------------------------------------- /scripts/install-vmhost-additions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | #> 3 | 4 | function Eject-Drive # {{{ 5 | { 6 | <# {{{2 7 | .SYNOPSIS 8 | Eject the current CD-ROM from the given Drive 9 | .PARAMETER DriveLetter 10 | The drive letter to eject. 11 | Mandatory, no default. 12 | .EXAMPLE 13 | Eject-Drive D 14 | .EXAMPLE 15 | Eject-Drive -DriveLetter D 16 | #> # }}}2 17 | [CmdletBinding()] 18 | Param( 19 | [Parameter(Mandatory=$true)][string] $DriveLetter 20 | ) 21 | $shellapp = new-object -com Shell.Application 22 | $shellapp.Namespace(17).ParseName("${DriveLetter}:").InvokeVerb("Eject") 23 | [System.Runtime.Interopservices.Marshal]::ReleaseComObject($shellapp) 24 | Remove-Variable shellapp 25 | } # }}} 26 | 27 | if ($env:PACKER_BUILDER_TYPE -match 'vmware') 28 | { 29 | $image = $null 30 | $volume = Get-Volume | where FileSystemLabel -match 'VMWare Tools' 31 | if ($volume) 32 | { 33 | $drive=$volume.DriveLetter 34 | Write-Output "Found VMWare Tools mounted on ${drive}:" 35 | } 36 | else 37 | { 38 | $iso_path = Join-Path $env:USERPROFILE "windows.iso" 39 | if (Test-Path $iso_path) 40 | { 41 | Write-Host "Mounting ISO $iso_path" 42 | $image = Mount-DiskImage $iso_path -PassThru 43 | if (! $?) 44 | { 45 | Write-Error "ERROR $LastExitCode while mounting VMWare Guest Additions" 46 | Start-Sleep 10 47 | exit 2 48 | } 49 | $drive = (Get-Volume -DiskImage $image).DriveLetter 50 | Write-Host "ISO Mounted on $drive" 51 | } 52 | else 53 | { 54 | Write-Error "Could not find the VMWare Tools CD-ROM" 55 | Start-Sleep 10 56 | exit 3 57 | } 58 | } 59 | 60 | Write-Host "Installing VMWare Guest Additions" 61 | $process = Start-Process -Wait -PassThru -FilePath ${drive}:\setup64.exe -ArgumentList '/S /v"/qn REBOOT=ReallySuppress ADDLOCAL=ALL" /l C:\Windows\Logs\vmware-tools.log' 62 | if ($process.ExitCode -eq 0) 63 | { 64 | Write-Host "Installation was successful" 65 | } 66 | elseif ($process.ExitCode -eq 3010) 67 | { 68 | Write-Warning "Installation was successful, Rebooting is needed" 69 | # Write-Host "Restarting Virtual Machine" 70 | # Restart-Computer 71 | # Start-Sleep 30 72 | } 73 | else 74 | { 75 | Write-Error "Installation failed: Error= $($process.ExitCode), Logs=C:\Windows\Logs\vmware-tools.log" 76 | Start-Sleep 2; exit $process.ExitCode 77 | } 78 | if ($volume) 79 | { 80 | Eject-Drive -DriveLetter $drive 81 | } 82 | elseif ($image -ne $null) 83 | { 84 | Write-Host "Dismounting ISO" 85 | if (! (Dismount-DiskImage -ImagePath $image.ImagePath)) 86 | { 87 | Write-Error "Cannot unmount $($image.ImagePath), error: $LastExitCode" 88 | exit $LastExitCode 89 | } 90 | } 91 | Start-Sleep 2 92 | } 93 | elseif ($env:PACKER_BUILDER_TYPE -match 'virtualbox') 94 | { 95 | $volume = Get-Volume | where FileSystemLabel -match 'VBOXADDITIONS.*' 96 | 97 | if (! $volume) 98 | { 99 | Write-Error "Could not find the VirtualBox Guest Additions CD-ROM" 100 | Start-Sleep 10 101 | exit 3 102 | } 103 | 104 | $drive=$volume.DriveLetter 105 | # cd ${drive}:\cert ; VBoxCertUtil add-trusted-publisher oracle-vbox.cer --root oracle-vbox.cer 106 | certutil -addstore -f "TrustedPublisher" ${drive}:\cert\oracle-vbox.cer 107 | if (! $?) 108 | { 109 | Write-Error "ERROR $LastExitCode while adding Oracle certificate to the trusted publishers" 110 | Start-Sleep 10 111 | exit 2 112 | } 113 | Write-Host "Installing Virtualbox Guest Additions" 114 | $process = Start-Process -Wait -PassThru -FilePath ${drive}:\VBoxWindowsAdditions.exe -ArgumentList '/S /l C:\Windows\Logs\virtualbox-tools.log /v"/qn REBOOT=R"' 115 | if ($process.ExitCode -eq 0) 116 | { 117 | Write-Host "Installation was successful" 118 | } 119 | elseif ($process.ExitCode -eq 3010) 120 | { 121 | Write-Warning "Installation was successful, Rebooting is needed" 122 | # Write-Host "Restarting Virtual Machine" 123 | # Restart-Computer 124 | # Start-Sleep 30 125 | } 126 | else 127 | { 128 | Write-Error "Installation failed: Error= $($process.ExitCode), Logs=C:\Windows\Logs\vmware-tools.log" 129 | Start-Sleep 2; exit $process.ExitCode 130 | } 131 | Eject-Drive -DriveLetter $drive 132 | Start-Sleep 2 133 | } 134 | elseif ($env:PACKER_BUILDER_TYPE -match 'parallels') 135 | { 136 | $volume = Get-Volume | where FileSystemLabel -eq 'Parallels Tools' 137 | 138 | if (! $volume) 139 | { 140 | Write-Error "Could not find the Parallels Desktop Tools CD-ROM" 141 | Start-Sleep 10 142 | exit 3 143 | } 144 | 145 | $drive=$volume.DriveLetter 146 | Write-Host "ISO Mounted on $drive" 147 | Write-Host "Installing Parallels Guest Additions" 148 | $process = Start-Process -Wait -PassThru -FilePath ${drive}:\PTAgent.exe -ArgumentList '/install_silent' 149 | if ($process.ExitCode -eq 0) 150 | { 151 | Write-Host "Installation was successful" 152 | } 153 | elseif ($process.ExitCode -eq 3010) 154 | { 155 | Write-Warning "Installation was successful, Rebooting is needed" 156 | # Write-Host "Restarting Virtual Machine" 157 | # Restart-Computer 158 | # Start-Sleep 30 159 | } 160 | else 161 | { 162 | Write-Error "Installation failed: Error= $($process.ExitCode)" 163 | Start-Sleep 2; exit $process.ExitCode 164 | } 165 | Start-Sleep 2 166 | } 167 | elseif ($env:PACKER_BUILDER_TYPE -match 'hyperv-iso') 168 | { 169 | Write-Host "No guest software to install for Hyper-V" 170 | } 171 | else 172 | { 173 | Write-Error "Ignoring unsupported Packer builder: $env:PACKER_BUILDER_TYPE" 174 | exit 1 175 | } 176 | -------------------------------------------------------------------------------- /scripts/install-vmhost-additions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -euxo pipefail 2 | 3 | HOME_DIR="${HOME_DIR:-/home/vagrant}" 4 | 5 | case "$PACKER_BUILDER_TYPE" in 6 | parallels-iso|parallels-pvm) 7 | mount -o loop "$HOME_DIR/prl-tools-lin.iso" /mnt 8 | VER="$(cat /mnt/parallels/version)" 9 | echo "Installing Parallels Desktop Tools version $VER" 10 | 11 | /mnt/parallels/install --install-unatttended-with-deps \ 12 | || (status="$?" ; \ 13 | echo "Parallels Desktop Tools installation failed. Error: $status" ; \ 14 | cat /var/log/parallels-tools-install.log ; \ 15 | exit $status) 16 | umount /mnt 17 | rm -rf "$HOME_DIR/prl-tools-lin.iso" 18 | ;; 19 | virtualbox-iso|virtualbox-ovf) 20 | mount -o loop "$HOME_DIR/VBoxGuestAdditions.iso" /mnt 21 | VER="$(cat $HOME_DIR/.vbox_version)" 22 | echo "Installing Virtualbox Tools version $VER" 23 | 24 | sh /mnt/VBoxLinuxAdditions.run \ 25 | || (status="$?" ; \ 26 | echo "Virtualbox Tools installation failed. Error: $status" ; \ 27 | exit $status) 28 | umount /mnt 29 | rm -rf "$HOME_DIR/VBoxGuestAdditions.iso" 30 | ;; 31 | vmware-iso|vmware-vmx) 32 | mount -o loop $HOME_DIR/linux.iso /mnt; 33 | mkdir -p /tmp/vmware; 34 | 35 | TOOLS_PATH="$(ls /mnt/VMwareTools-*.tar.gz)"; 36 | VER="$(echo "${TOOLS_PATH}" | cut -f2 -d'-')"; 37 | MAJ_VER="$(echo ${VER} | cut -d '.' -f 1)"; 38 | 39 | echo "VMware Tools installation version $VER"; 40 | 41 | tar xzf ${TOOLS_PATH} -C /tmp/vmware; 42 | if [ "${MAJ_VER}" -lt "10" ]; then 43 | /tmp/vmware/vmware-tools-distrib/vmware-install.pl --default; 44 | else 45 | /tmp/vmware/vmware-tools-distrib/vmware-install.pl --force-install; 46 | fi 47 | yum install -y open-vm-tools; 48 | mkdir /mnt/hgfs; 49 | umount /mnt; 50 | rm -rf /tmp/vmware; 51 | rm -f $HOME_DIR/linux.iso; 52 | ;; 53 | esac 54 | -------------------------------------------------------------------------------- /scripts/mount-iso.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] 2 | Param( 3 | [Parameter(Mandatory=$false)] 4 | [string] $DriveLetter, 5 | [Parameter(Mandatory=$false)] 6 | [string] $HostShare = 'daas-cache', 7 | [Parameter(Mandatory=$false)] 8 | [string] $Product='CIC', 9 | [Parameter(Mandatory=$false)] 10 | [int] $Version, 11 | [Parameter(Mandatory=$false)] 12 | [int] $Release, 13 | [Parameter(Mandatory=$false)] 14 | [int] $Patch, 15 | [Parameter(Mandatory=$false)] 16 | [switch] $LastPatch 17 | ) 18 | begin 19 | { 20 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 21 | } 22 | process 23 | { 24 | # TODO: Use $HostShare 25 | if (Test-Path $env:USERPROFILE/share-daas-cache.info) 26 | { 27 | $ShareArgs = @{ PSProvider = 'FileSystem'; ErrorAction = 'Stop' } 28 | $ShareInfo = Get-Content $env:USERPROFILE/share-daas-cache.info -Raw | ConvertFrom-Json 29 | 30 | if ($ShareInfo.DriveLetter -ne $null) 31 | { 32 | if ($ShareInfo.User -ne $null) 33 | { 34 | if ($ShareInfo.Password -eq $null) 35 | { 36 | Throw "No password for $($ShareInfo.User) in $($env:USERPROFILE)/share-daas-cache.info" 37 | exit 1 38 | } 39 | $ShareArgs['Credential'] = New-Object System.Management.Automation.PSCredential($ShareInfo.User, (ConvertTo-SecureString -String $ShareInfo.Password -AsPlainText -Force)) 40 | } 41 | $Drive = New-PSDrive -Name $ShareInfo.DriveLetter -Root $ShareInfo.Path @ShareArgs -Persist -Scope Global 42 | $share_dir = $Drive.Root 43 | } 44 | else 45 | { 46 | $share_dir = $ShareInfo.Path 47 | } 48 | Write-Output "Using Share at $share_dir" 49 | } 50 | else 51 | { 52 | Write-Output "Share daas-cache information was not found" 53 | Write-Warning "No iso can be mounted" 54 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 55 | exit 56 | } 57 | if ([string]::IsNullOrEmpty($share_dir)) 58 | { 59 | Throw "No share to use from $($env:USERPROFILE)/share-daas-cache.info" 60 | exit 2 61 | } 62 | 63 | $pattern = ".*${Product}_" 64 | if ($PSBoundParameters.ContainsKey('Version')) { $pattern += "${Version}" } else { $pattern += '\d{4}' } 65 | if ($PSBoundParameters.ContainsKey('Release')) { $pattern += "_R${Release}" } else { $pattern += '_R\d+' } 66 | if ($LastPatch) { $pattern += '_Patch\d+' } 67 | elseif ($PSBoundParameters.ContainsKey('Patch')) 68 | { 69 | if ($Patch -eq 9999) { $pattern += '_Patch\d+' } else { $pattern += "_Patch${Patch}" } 70 | } 71 | $pattern += '\.iso$' 72 | Write-Verbose "Checking $share_dir for $Product Installation (Version: $Version, Release: $Release, Patch: $Patch)" 73 | Write-Verbose "Pattern: $pattern" 74 | $InstallISO = Get-ChildItem $share_dir -Name -Filter "${Product}_*.iso" | Where { $_ -match $pattern } | Sort -Descending | Select -First 1 75 | 76 | if ([string]::IsNullOrEmpty($InstallISO)) 77 | { 78 | if ($LastPatch) 79 | { 80 | Write-Output "There is no patch available for Interaction Center in $share_dir" 81 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 82 | exit 0 83 | } 84 | else 85 | { 86 | Throw "Could not find a suitable Interaction Center ISO in $share_dir" 87 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 88 | exit 2 89 | } 90 | } 91 | Write-Verbose "Found: $InstallISO" 92 | 93 | While (! (Test-Path $share_dir)) 94 | { 95 | Write-Output "Waiting for shars to be available" 96 | Start-Sleep 20 97 | } 98 | 99 | if ([string]::IsNullOrEmpty($DriveLetter)) 100 | { 101 | Write-Verbose "Searching for the last unused drive letter" 102 | $DriveLetter = ls function:[D-T]: -n | ?{ !(Test-Path $_) } | Select -Last 1 103 | } 104 | 105 | Write-Output "Mounting Windows Share on Drive ${DriveLetter}" 106 | if ($PSCmdlet.ShouldProcess($DriveLetter, "Mounting ${share_dir}\${InstallISO}")) 107 | { 108 | imdisk -a -m $DriveLetter -f (Join-Path $share_dir $InstallISO) 109 | if (! $?) 110 | { 111 | Throw "Could not mount $share_dir on drive $DriveLetter" 112 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 113 | exit 3 114 | } 115 | 116 | echo $DriveLetter > $env:USERPROFILE/mounted.info 117 | } 118 | } 119 | end 120 | { 121 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 122 | } 123 | -------------------------------------------------------------------------------- /scripts/prep-share.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] 2 | Param( 3 | [Parameter(Mandatory=$false)] 4 | [string] $DriveLetter, 5 | [Parameter(Mandatory=$false)] 6 | [string] $Server, 7 | [Parameter(Mandatory=$false)] 8 | [string] $Share, 9 | [Parameter(Mandatory=$false)] 10 | [string] $User, 11 | [Parameter(Mandatory=$false)] 12 | [string] $Password 13 | ) 14 | begin 15 | { 16 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 17 | if ([string]::IsNullOrEmpty($Server)) { $Server = $env:SMBHOST } 18 | if ([string]::IsNullOrEmpty($Share)) { $Share = $env:SMBSHARE } 19 | if ([string]::IsNullOrEmpty($User)) { $User = $env:SMBUSER } 20 | if ([string]::IsNullOrEmpty($Password)) { $Password = $env:SMBPASSWORD } 21 | if ([string]::IsNullOrEmpty($DriveLetter)) { $DriveLetter = $env:SMBDRIVE } 22 | 23 | if ([string]::IsNullOrEmpty($Share)) { Write-Error "Cannot connect to empty Share" ; exit 1 } 24 | $ShareInfo = @{ Name = $Share } 25 | } 26 | process 27 | { 28 | switch ($env:PACKER_BUILDER_TYPE) 29 | { 30 | 'parallels-iso' { $ShareInfo['Path'] = "\\psf\${Share}" } 31 | 'virtualbox-iso' { $ShareInfo['Path'] = "\\vboxsvr\${Share}" } 32 | 'vmware-iso' { $ShareInfo['Path'] = "\\vmware-host\Shared Folders\${Share}" } 33 | #'hyperv-iso' 34 | default 35 | { 36 | if ([string]::IsNullOrEmpty($Server)) { Write-Error "No Server to connect to" ; exit 1 } 37 | if ([string]::IsNullOrEmpty($User)) { Write-Error "No User to connect with" ; exit 1 } 38 | if ([string]::IsNullOrEmpty($Password)) { Write-Error "No Password to connect with" ; exit 1 } 39 | if ([string]::IsNullOrEmpty($DriveLetter)) 40 | { 41 | do 42 | { 43 | $DriveLetter = Get-ChildItem function:[D-Z]: -Name | Where { !(Test-Path $_) } | Select -Last 1 44 | } while (Get-PSDrive | Where Name -eq $DriveLetter.Substring(0,1)) 45 | } 46 | if ($DriveLetter -match '^[a-z]:$') { $DriveLetter = $DriveLetter.Substring(0, 1) } 47 | 48 | Write-Output "$Share from $Server will be used with $DriveLetter and connected as $User" 49 | if ($PSCmdlet.ShouldProcess($DriveLetter, "Mounting ${Server}\${Share}")) 50 | { 51 | Write-Output "Testing connection information" 52 | $Drive = New-PSDrive -Name $DriveLetter -PSProvider FileSystem -Root \\${Server}\${Share} -Credential (New-Object System.Management.Automation.PSCredential("${Server}\${User}", (ConvertTo-SecureString -String $Password -AsPlainText -Force))) -ErrorAction Stop 53 | $ShareInfo['DriveLetter'] = $DriveLetter 54 | $ShareInfo['Path'] = "\\${Server}\${Share}" 55 | $ShareInfo['User'] = "${Server}\${User}"; 56 | $ShareInfo['Password'] = $Password 57 | Write-Output "connection information: name=${$Drive.Name}, root=${$Drive.Root} (${$Drive.displayRoot}), provider=${$Drive.Provider}, description=${$Drive.Description}" 58 | } 59 | } 60 | } 61 | ConvertTo-Json $ShareInfo > $env:USERPROFILE/share-$Share.info 62 | } 63 | end 64 | { 65 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 66 | } 67 | -------------------------------------------------------------------------------- /scripts/unmount-iso.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | Param( 3 | [Parameter(Mandatory=$false)] 4 | [string] $DriveLetter 5 | ) 6 | begin 7 | { 8 | Write-Output "Script started at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 9 | } 10 | process 11 | { 12 | if ([string]::IsNullOrEmpty($DriveLetter)) 13 | { 14 | if (Test-Path $env:USERPROFILE/mounted.info) 15 | { 16 | $DriveLetter = Get-Content $env:USERPROFILE/mounted.info 17 | Remove-Item $env:USERPROFILE/mounted.info 18 | } 19 | else 20 | { 21 | Write-Output "No drive was mounted" 22 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 23 | exit 24 | } 25 | } 26 | 27 | Write-Output "Unmounting drive $DriveLetter" 28 | imdisk -d -m $DriveLetter 29 | } 30 | end 31 | { 32 | Write-Output "Script ended at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" 33 | } 34 | -------------------------------------------------------------------------------- /sources.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "system": "Windows", 4 | "version": "2012R2", 5 | "license": "evaluation", 6 | "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 | "checksum_type": "md5", 8 | "checksum": "458ff91f8abc21b75cb544744bf92e6a" 9 | }, 10 | { 11 | "system": "Windows", 12 | "version": "2012", 13 | "license": "evaluation", 14 | "url": "http://care.dlservice.microsoft.com//dl/download/6/D/A/6DAB58BA-F939-451D-9101-7DE07DC09C03/9200.16384.WIN8_RTM.120725-1247_X64FRE_SERVER_EVAL_EN-US-HRM_SSS_X64FREE_EN-US_DV5.iso", 15 | "checksum_type": "md5", 16 | "checksum": "8503997171f731d9bd1cb0b0edc31f3d" 17 | }, 18 | { 19 | "system": "Windows", 20 | "version": "2008R2", 21 | "license": "evaluation", 22 | "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", 23 | "checksum_type": "md5", 24 | "checksum": "4263be2cf3c59177c45085c0a7bc6ca5" 25 | }, 26 | { 27 | "system": "Windows", 28 | "version": "2003R2", 29 | "license": "evaluation", 30 | "url": "", 31 | "checksum_type": "", 32 | "checksum": "" 33 | }, 34 | { 35 | "system": "Windows", 36 | "version": "8.1", 37 | "license": "evaluation", 38 | "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", 39 | "checksum_type": "sha1", 40 | "checksum": "73321fa912305e5a16096ef62380a91ee1f112da" 41 | }, 42 | { 43 | "system": "Windows", 44 | "version": "7", 45 | "license": "evaluation", 46 | "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", 47 | "checksum_type": "sha1", 48 | "checksum": "15ddabafa72071a06d5213b486a02d5b55cb7070" 49 | } 50 | ] 51 | -------------------------------------------------------------------------------- /spec/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure(2) do |config| 5 | config.vm.box = "#{ENV['BOX']}" 6 | config.vm.box_url = "#{ENV['BOX_URL']}" if ENV['BOX_URL'] 7 | 8 | config.vm.guest = :windows 9 | config.windows.halt_timeout = 15 10 | config.vm.communicator = 'winrm' 11 | 12 | config.winrm.username = 'vagrant' 13 | config.winrm.password = 'vagrant' 14 | 15 | config.vm.box_check_update = false 16 | 17 | config.vm.synced_folder "../scripts", "/scripts" 18 | case RUBY_PLATFORM 19 | when 'i386-mingw32' then config.vm.synced_folder "C:/Programdata/daas/cache", "/ProgramData/DaaS/cache" 20 | when 'x64-mingw32' then config.vm.synced_folder "C:/Programdata/daas/cache", "/ProgramData/DaaS/cache" 21 | when 'universal.x86_64-darwin14' then config.vm.synced_folder "/var/cache/daas", "/ProgramData/DaaS/cache" 22 | else config.vm.synced_folder "/var/cache/daas", "/ProgramData/DaaS/cache" 23 | end 24 | 25 | config.vm.provider :vmware_fusion do |provider, override| 26 | provider.gui = true 27 | provider.vmx['memsize'] = '2048' 28 | provider.vmx['numvcpus'] = '2' 29 | end 30 | 31 | config.vm.provider :virtualbox do |provider, override| 32 | provider.gui = true 33 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 34 | provider.customize ['modifyvm', :id, '--vram', 30] 35 | provider.customize ['modifyvm', :id, '--memory', 2048] 36 | provider.customize ['modifyvm', :id, '--cpus', 2] 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/packages_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helpers' 2 | 3 | describe package('OpenSSH for Windows (remove only)') do 4 | it { should be_installed } 5 | end 6 | 7 | describe package('Puppet (64-bit)') do 8 | it { should be_installed } 9 | end 10 | -------------------------------------------------------------------------------- /spec/ports_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helpers' 2 | 3 | describe port(5985) do 4 | it { should be_listening } 5 | end 6 | 7 | describe port(3389) do 8 | it { should be_listening } 9 | end 10 | -------------------------------------------------------------------------------- /spec/spec_helpers.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | require 'winrm' 3 | 4 | set :backend, :winrm 5 | set :os, family: 'windows' 6 | 7 | winrm = ::WinRM::WinRMWebService.new('http://localhost:5985/wsman', :ssl, user: 'vagrant', pass: 'vagrant', basic_auth_only: true) 8 | winrm.set_timeout 300 9 | Specinfra.configuration.winrm = winrm 10 | -------------------------------------------------------------------------------- /spec/vmtools_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helpers' 2 | 3 | def is_vmware? 4 | endpoint = "http://localhost:5985/wsman" 5 | winrm = ::WinRM::WinRMWebService.new(endpoint, :plaintext, :user => 'vagrant', :pass => 'vagrant', :disable_sspi => true) 6 | winrm.set_timeout 300 7 | response = '' 8 | winrm.cmd('wmic path win32_videocontroller Where DeviceID="VideoController1" get Description /value | find "="') do |stdout, stderr| 9 | response = stdout 10 | end 11 | return response.include?('VMware') 12 | end 13 | 14 | 15 | describe "virtualbox", :unless => is_vmware? do 16 | context package('Oracle VM VirtualBox Guest Additions 4.3.12') do 17 | it { should be_installed } 18 | end 19 | end 20 | 21 | describe "vmware", :if => is_vmware? do 22 | context package('VMware Tools') do 23 | it { should be_installed } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /templates/centos-7/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "centos-7", 3 | "organization": "Interactive Intelligence", 4 | "description": "This box contains CentOS 7", 5 | "os": "centos", 6 | "os_version": "7", 7 | "cache_dir": "/var/cache/daas", 8 | "hyperv_switch": "Bridged Switch" 9 | } 10 | -------------------------------------------------------------------------------- /templates/centos-7/ks.cfg: -------------------------------------------------------------------------------- 1 | install 2 | url --url http://ftp.riken.jp/Linux/centos/7/os/x86_64/ 3 | 4 | lang en_US.UTF-8 5 | keyboard us 6 | timezone Asia/Tokyo 7 | 8 | network --device=em0 --bootproto=dhcp --ipv6=auto 9 | firewall --enable --ssh 10 | 11 | authconfig --enableshadow --passalgo=sha512 12 | selinux --disabled 13 | rootpw vagrant 14 | 15 | text 16 | skipx 17 | 18 | clearpart --all --initlabel 19 | zerombr 20 | autopart 21 | bootloader --location=mbr 22 | 23 | firstboot --disabled 24 | reboot 25 | 26 | %packages --nobase --ignoremissing --excludedocs 27 | @Core 28 | sudo 29 | bzip2 30 | gcc 31 | kernel-devel 32 | kernel-headers 33 | selinux-policy-devel 34 | nfs-utils 35 | net-tools 36 | # unnecessary firmware 37 | -aic94xx-firmware 38 | -atmel-firmware 39 | -avahi 40 | -b43-openfwwf 41 | -bfa-firmware 42 | -bluez-utils 43 | -dogtail 44 | -ipw2100-firmware 45 | -ipw2200-firmware 46 | -ivtv-firmware 47 | -iwl100-firmware 48 | -iwl105-firmware 49 | -iwl135-firmware 50 | -iwl1000-firmware 51 | -iwl2000-firmware 52 | -iwl2030-firmware 53 | -iwl3160-firmware 54 | -iwl3945-firmware 55 | -iwl4965-firmware 56 | -iwl5000-firmware 57 | -iwl5150-firmware 58 | -iwl6000-firmware 59 | -iwl6000g2a-firmware 60 | -iwl6000g2b-firmware 61 | -iwl6050-firmware 62 | -iwl7260-firmware 63 | -kudzu 64 | -libertas-usb8388-firmware 65 | -libertas-sd8686-firmware 66 | -libertas-sd8787-firmware 67 | -ql2100-firmware 68 | -ql2200-firmware 69 | -ql23xx-firmware 70 | -ql2400-firmware 71 | -ql2500-firmware 72 | -rt61pci-firmware 73 | -rt73usb-firmware 74 | -xorg-x11-drv-ati-firmware 75 | -zd1211-firmware 76 | %end 77 | 78 | %post 79 | # disable unnecessary services 80 | chkconfig acpid off 81 | chkconfig auditd off 82 | chkconfig blk-availability off 83 | chkconfig bluetooth off 84 | chkconfig certmonger off 85 | chkconfig cpuspeed off 86 | chkconfig cups off 87 | chkconfig haldaemon off 88 | chkconfig ip6tables off 89 | chkconfig lvm2-monitor off 90 | chkconfig messagebus off 91 | chkconfig mdmonitor off 92 | chkconfig rpcbind off 93 | chkconfig rpcgssd off 94 | chkconfig rpcidmapd off 95 | chkconfig yum-updateonboot off 96 | 97 | # vagrant 98 | groupadd vagrant -g 1001 99 | useradd vagrant -g vagrant -G wheel -u 1001 100 | echo "vagrant" | passwd --stdin vagrant 101 | 102 | # sudo 103 | yum install -y sudo 104 | echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant 105 | sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers 106 | %end 107 | -------------------------------------------------------------------------------- /templates/centos-7/packer.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": 3 | { 4 | "template": "box", 5 | "organization": "{{env `USERNAME` }}", 6 | "description": "This is a packer generated box", 7 | "version": "0.1.0", 8 | "cache_dir": "./iso", 9 | "vmware_iso_dir": "", 10 | "os": "", 11 | "os_version": "", 12 | "os_install": "", 13 | "os_edition": "", 14 | "os_license": "", 15 | "admin_username": "vagrant", 16 | "admin_password": "vagrant", 17 | "share_host": "", 18 | "share_username": "", 19 | "share_password": "", 20 | "http_proxy": "{{env `HTTP_PROXY`}}", 21 | "https_proxy": "{{env `HTTPS_PROXY`}}", 22 | "no_proxy": "{{env `NO_PROXY`}}", 23 | "disk_size": "8192", 24 | "mem_size": "512", 25 | "cpus": "1", 26 | "hyperv_switch": "" 27 | }, 28 | "builders": 29 | [ 30 | { 31 | "type": "parallels-iso", 32 | "vm_name": "packer-{{user `template`}}", 33 | "guest_os_type": "centos", 34 | "iso_urls": [ 35 | "{{user `cache_dir`}}/CentOS-7-x86_64-NetInstall-1511.iso", 36 | "http://ftp.riken.jp/Linux/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1511.iso" 37 | ], 38 | "iso_checksum_type": "sha256", 39 | "iso_checksum": "9ed9ffb5d89ab8cca834afce354daa70a21dcb410f58287d6316259ff89758f5", 40 | "output_directory": "output-virtualbox-{{user `template`}}", 41 | "boot_wait": "10s", 42 | "ssh_username": "{{user `admin_username`}}", 43 | "ssh_password": "{{user `admin_password`}}", 44 | "ssh_wait_timeout": "20m", 45 | "shutdown_command": "echo 'vagrant' | sudo -S /sbin/halt -h -p", 46 | "shutdown_timeout": "1h", 47 | "parallels_tools_flavor": "lin", 48 | "parallels_tools_mode": "upload", 49 | "disk_size": "{{user `disk_size`}}", 50 | "http_directory": "templates/centos-7", 51 | "boot_command": [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" ], 52 | "prlctl_version_file": ".prlctl_version", 53 | "prlctl": 54 | [ 55 | ["set", "{{.Name}}", "--startup-view", "window"], 56 | ["set", "{{.Name}}", "--memsize", "{{user `mem_size`}}"], 57 | ["set", "{{.Name}}", "--cpus", "{{user `cpus`}}"], 58 | ["set", "{{.Name}}", "--shared-profile", "off"], 59 | ["set", "{{.Name}}", "--shared-cloud", "off"], 60 | ["set", "{{.Name}}", "--sh-app-guest-to-host", "off"], 61 | ["set", "{{.Name}}", "--sh-app-host-to-guest", "off"], 62 | ["set", "{{.Name}}", "--shf-host-add", "log", "--path", "{{pwd}}/log", "--mode", "rw", "--enable"] 63 | ] 64 | }, 65 | { 66 | "type": "qemu", 67 | "vm_name": "packer-{{user `template`}}", 68 | "iso_urls": [ 69 | "{{user `cache_dir`}}/CentOS-7-x86_64-NetInstall-1511.iso", 70 | "http://ftp.riken.jp/Linux/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1511.iso" 71 | ], 72 | "iso_checksum_type": "sha256", 73 | "iso_checksum": "9ed9ffb5d89ab8cca834afce354daa70a21dcb410f58287d6316259ff89758f5", 74 | "output_directory": "output-qemu-{{user `template`}}", 75 | "boot_wait": "10s", 76 | "ssh_username": "{{user `admin_username`}}", 77 | "ssh_password": "{{user `admin_password`}}", 78 | "ssh_wait_timeout": "20m", 79 | "shutdown_command": "echo 'vagrant' | sudo -S /sbin/halt -h -p", 80 | "shutdown_timeout": "1h", 81 | "disk_size": "{{user `disk_size`}}", 82 | "http_directory": "templates/centos-7", 83 | "boot_command": [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" ] 84 | }, 85 | { 86 | "type": "virtualbox-iso", 87 | "vm_name": "packer-{{user `template`}}", 88 | "guest_os_type": "RedHat_64", 89 | "iso_urls": [ 90 | "{{user `cache_dir`}}/CentOS-7-x86_64-NetInstall-1511.iso", 91 | "http://ftp.riken.jp/Linux/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1511.iso" 92 | ], 93 | "iso_checksum_type": "sha256", 94 | "iso_checksum": "9ed9ffb5d89ab8cca834afce354daa70a21dcb410f58287d6316259ff89758f5", 95 | "output_directory": "output-virtualbox-{{user `template`}}", 96 | "boot_wait": "10s", 97 | "headless": true, 98 | "ssh_username": "{{user `admin_username`}}", 99 | "ssh_password": "{{user `admin_password`}}", 100 | "ssh_wait_timeout": "20m", 101 | "shutdown_command": "echo 'vagrant' | sudo -S /sbin/halt -h -p", 102 | "shutdown_timeout": "1h", 103 | "post_shutdown_delay": "30s", 104 | "guest_additions_mode": "upload", 105 | "disk_size": "{{user `disk_size`}}", 106 | "http_directory": "templates/centos-7", 107 | "boot_command": [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" ], 108 | "vboxmanage": 109 | [ 110 | ["modifyvm", "{{.Name}}", "--ioapic", "on"], 111 | ["modifyvm", "{{.Name}}", "--memory", "{{user `mem_size`}}"], 112 | ["modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}"], 113 | ["modifyvm", "{{.Name}}", "--vram", "64"], 114 | ["setextradata", "{{.Name}}", "VBoxInternal/CPUM/CMPXCHG16B", "1"] 115 | ] 116 | } 117 | ], 118 | "provisioners": 119 | [ 120 | { 121 | "type": "shell", 122 | "environment_vars": [ 123 | "HOME_DIR=/home/vagrant", 124 | "http_proxy={{user `http_proxy`}}", 125 | "https_proxy=((user `https_proxy`}}", 126 | "no_proxy={{user `no_proxy`}}" 127 | ], 128 | "scripts": [ 129 | "./scripts/config-network.sh", 130 | "./scripts/create-user-vagrant.sh", 131 | "./scripts/install-vmhost-additions.sh", 132 | "./scripts/centos-cleanup.sh" 133 | ], 134 | "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'" 135 | } 136 | ], 137 | "post-processors": 138 | [ 139 | { 140 | "type": "vagrant", 141 | "keep_input_artifact": false, 142 | "compression_level": 9, 143 | "vagrantfile_template": "templates/{{user `template`}}/vagrantfile.template", 144 | "output": "./boxes/{{user `template`}}_{{user `version`}}_{{.Provider}}.box" 145 | } 146 | ] 147 | } 148 | -------------------------------------------------------------------------------- /templates/centos-7/vagrantfile.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | config.vm.define "vagrant-centos-7" 6 | config.vm.box = "centos-7" 7 | 8 | config.vm.provider :parallels do |provider, override| 9 | provider.update_guest_tools = true 10 | end 11 | 12 | config.vm.provider :vmware_fusion do |provider, override| 13 | provider.gui = true 14 | end 15 | 16 | config.vm.provider :virtualbox do |provider, override| 17 | provider.gui = true 18 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 19 | provider.customize ['modifyvm', :id, '--vram', 30] 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /templates/cic/Autounattend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | en-US 7 | 8 | en-US 9 | en-US 10 | en-US 11 | en-US 12 | en-US 13 | 14 | 15 | 16 | 17 | A:\ 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Primary 27 | 1 28 | 350 29 | 30 | 31 | 2 32 | Primary 33 | true 34 | 35 | 36 | 37 | 38 | true 39 | NTFS 40 | 41 | 1 42 | 1 43 | 44 | 45 | NTFS 46 | 47 | C 48 | 2 49 | 2 50 | 51 | 52 | 0 53 | true 54 | 55 | OnError 56 | 57 | 58 | 59 | 60 | 61 | /IMAGE/NAME 62 | Windows Server 2012 R2 SERVERSTANDARD 63 | 64 | 65 | 66 | 0 67 | 2 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | OnError 79 | 80 | true 81 | Evaluation 82 | Microsoft Corp. 83 | 84 | 85 | 86 | 87 | 88 | 89 | false 90 | 91 | 92 | Pacific Standard Time 93 | 94 | 95 | 96 | true 97 | 98 | 99 | true 100 | 101 | 102 | false 103 | true 104 | 105 | 106 | true 107 | 108 | 109 | 110 | 111 | true 112 | Google 113 | Google 114 | http://www.google.com/search?q={searchTerms} 115 | 116 | 117 | true 118 | true 119 | about:blank 120 | 121 | 122 | 123 | 124 | true 125 | Google 126 | Google 127 | http://www.google.com/search?q={searchTerms} 128 | 129 | 130 | true 131 | true 132 | about:blank 133 | 134 | 135 | false 136 | 137 | 138 | 139 | 140 | true 141 | Remote Desktop 142 | all 143 | 144 | 145 | 146 | 147 | 0 148 | 149 | 150 | 151 | 152 | 153 | true 154 | true 155 | true 156 | true 157 | true 158 | Work 159 | 1 160 | 161 | 162 | 163 | 164 | 165 | vagrant 166 | true</PlainText> 167 | </Password> 168 | <Description>Vagrant User</Description> 169 | <DisplayName>vagrant</DisplayName> 170 | <Group>Administrators</Group> 171 | <Name>vagrant</Name> 172 | </LocalAccount> 173 | </LocalAccounts> 174 | <AdministratorPassword> 175 | <Value>vagrant</Value> 176 | <PlainText>true</PlainText> 177 | </AdministratorPassword> 178 | </UserAccounts> 179 | <AutoLogon> 180 | <Enabled>true</Enabled> 181 | <Username>vagrant</Username> 182 | <Password> 183 | <Value>vagrant</Value> 184 | <PlainText>true</PlainText> 185 | </Password> 186 | </AutoLogon> 187 | <FirstLogonCommands> 188 | <SynchronousCommand wcm:action="add"> 189 | <CommandLine>cmd.exe /c a:\00-run-all-scripts.cmd</CommandLine> 190 | <Description>Run all *.bat and *.cmd scripts on drive A:</Description> 191 | <Order>1</Order> 192 | <RequiresUserInput>true</RequiresUserInput> 193 | </SynchronousCommand> 194 | </FirstLogonCommands> 195 | </component> 196 | </settings> 197 | <settings pass="offlineServicing"> 198 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 199 | <EnableLUA>false</EnableLUA> 200 | </component> 201 | </settings> 202 | <cpi:offlineImage cpi:source="wim:c:/wim/install.wim#Windows Server 2012 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 203 | </unattend> 204 | -------------------------------------------------------------------------------- /templates/cic/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "cic", 3 | "organization": "Interactive Intelligence", 4 | "description": "This box contains Interaction Center", 5 | "os": "windows", 6 | "os_version": "2012R2", 7 | "os_install": "full", 8 | "os_edition": "standard", 9 | "os_license": "eval", 10 | "cache_dir": "/var/cache/daas", 11 | "disk_size": "81920", 12 | "mem_size": "2048", 13 | "cpus": "2", 14 | "hyperv_switch": "Bridged Switch" 15 | } 16 | -------------------------------------------------------------------------------- /templates/cic/vagrantfile.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | current_version = Gem::Version.new(Vagrant::VERSION) 5 | windows_version = Gem::Version.new("1.6.0") 6 | 7 | Vagrant.configure("2") do |config| 8 | config.vm.define "vagrant-cic" 9 | config.vm.box = "cic" 10 | 11 | if current_version < windows_version 12 | if !Vagrant.has_plugin?('vagrant-windows') 13 | puts "vagrant-windows missing, please install the vagrant-windows plugin!" 14 | puts "Run this command in your terminal:" 15 | puts "vagrant plugin install vagrant-windows" 16 | exit 1 17 | end 18 | 19 | # Admin user name and password 20 | config.winrm.username = "vagrant" 21 | config.winrm.password = "vagrant" 22 | 23 | config.vm.guest = :windows 24 | config.windows.halt_timeout = 15 25 | 26 | # Port forward WinRM and RDP 27 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 28 | config.vm.network :forwarded_port, guest: 3389, host: 3389 29 | else 30 | config.vm.communicator = "winrm" 31 | end 32 | 33 | config.vm.provider :parallels do |provider, override| 34 | provider.update_guest_tools = true 35 | provider.memory = 2048 36 | provider.cpus = 2 37 | end 38 | 39 | config.vm.provider :vmware_fusion do |provider, override| 40 | provider.gui = true 41 | provider.vmx['memsize'] = '2048' 42 | provider.vmx['numvcpus'] = '2' 43 | end 44 | 45 | config.vm.provider :virtualbox do |provider, override| 46 | provider.gui = true 47 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 48 | provider.customize ['modifyvm', :id, '--vram', 30] 49 | provider.customize ['modifyvm', :id, '--memory', 2048] 50 | provider.customize ['modifyvm', :id, '--cpus', 2] 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /templates/metadata.json.erb: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= organization%>/<%= template %>", 3 | "description": "<%= description %>", 4 | "versions": 5 | [ 6 | { 7 | "version": "<%= version %>", 8 | "status": "active", 9 | "description_html": "<p><%= description %></p>", 10 | "description_markdown": "<%= description %>", 11 | "providers: 12 | [ 13 | <% providers.each_with_index do |provider, index| -%> 14 | { 15 | "name": "<%= provider.name %>", 16 | "url": "<%= provider.url%>", 17 | "checksum_type": "<%= provider.checksum_type %>", 18 | "checksum": "<%= provider.checksum %>" 19 | }<%= ',' if index < providers.size - 1%> 20 | <% end -%> 21 | ] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /templates/windows-10-enterprise-eval/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "windows-10-enterprise-eval", 3 | "organization": "gildas", 4 | "description": "This box contains Windows 10 full with the Evaluation license", 5 | "version": "0.1.0", 6 | "os": "windows", 7 | "os_version": "10", 8 | "os_edition": "enterprise", 9 | "os_license": "eval", 10 | "cache_dir": "/var/cache/daas", 11 | "mem_size": "2048", 12 | "cpus": "2", 13 | "hyperv_switch": "Bridged Switch" 14 | } 15 | -------------------------------------------------------------------------------- /templates/windows-10-enterprise-eval/packer.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": 3 | { 4 | "template": "box", 5 | "organization": "{{env `USERNAME` }}", 6 | "description": "This is a packer generated box", 7 | "version": "0.1.0", 8 | "cache_dir": "./iso", 9 | "vmware_iso_dir": "", 10 | "os": "", 11 | "os_version": "", 12 | "os_install": "", 13 | "os_edition": "", 14 | "os_license": "", 15 | "admin_username": "vagrant", 16 | "admin_password": "vagrant", 17 | "share_host": "", 18 | "share_username": "", 19 | "share_password": "", 20 | "disk_size": "40960", 21 | "mem_size": "1024", 22 | "cpus": "1", 23 | "hyperv_switch": "" 24 | }, 25 | "builders": 26 | [ 27 | { 28 | "type": "qemu", 29 | "vm_name": "packer_{{user `template`}}", 30 | "iso_urls": [ 31 | "{{user `cache_dir`}}/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO", 32 | "http://download.microsoft.com/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO" 33 | ], 34 | "iso_checksum_type": "md5", 35 | "iso_checksum": "6cd2f47f2c32faa7be85f1dc81af3220", 36 | "output_directory": "output-qemu-{{user `template`}}", 37 | "boot_wait": "30s", 38 | "communicator": "winrm", 39 | "winrm_username": "{{user `admin_username`}}", 40 | "winrm_password": "{{user `admin_password`}}", 41 | "winrm_timeout": "20m", 42 | "shutdown_command": "shutdown /s /t 1 /f /d p:4:1 /c 'Packer Shutdown'", 43 | "format": "qcow2", 44 | "accelerator": "kvm", 45 | "net_device": "virtio-net", 46 | "disk_interface": "virtio", 47 | "disk_size": "{{user `disk_size`}}", 48 | "floppy_files": [ 49 | "./templates/{{user `template`}}/Autounattend.xml", 50 | "./data/drivers/virtio-win-0.1-100/win7/amd64/*", 51 | "./scripts/00-run-all-scripts.cmd", 52 | "./scripts/01-config-os.cmd", 53 | "./scripts/02-config-posh.cmd", 54 | "./scripts/04-install-imdisk.cmd", 55 | "./scripts/99-start-services.cmd" 56 | ], 57 | "qemuargs": 58 | [ 59 | [ "-m", "{{user `mem_size`}}M" ] 60 | ] 61 | }, 62 | { 63 | "type": "parallels-iso", 64 | "vm_name": "packer_win10", 65 | "guest_os_type": "win-10", 66 | "iso_urls": [ 67 | "{{user `cache_dir`}}/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO", 68 | "http://download.microsoft.com/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO" 69 | ], 70 | "iso_checksum_type": "md5", 71 | "iso_checksum": "6cd2f47f2c32faa7be85f1dc81af3220", 72 | "output_directory": "output-parallels-{{user `template`}}", 73 | "boot_wait": "50s", 74 | "communicator": "winrm", 75 | "winrm_username": "{{user `admin_username`}}", 76 | "winrm_password": "{{user `admin_password`}}", 77 | "winrm_timeout": "20m", 78 | "shutdown_command": "shutdown /s /t 5 /f /d p:4:1 /c \"Packer Shutdown\"", 79 | "parallels_tools_flavor": "win", 80 | "parallels_tools_mode": "attach", 81 | "disk_size": "{{user `disk_size`}}", 82 | "floppy_files": [ 83 | "./templates/{{user `template`}}/Autounattend.xml", 84 | "./scripts/00-run-all-scripts.cmd", 85 | "./scripts/01-config-os.cmd", 86 | "./scripts/02-config-posh.cmd", 87 | "./scripts/03-config-winrm.cmd", 88 | "./scripts/04-install-imdisk.cmd", 89 | "./scripts/99-start-services.cmd" 90 | ], 91 | "prlctl": 92 | [ 93 | ["set", "{{.Name}}", "--startup-view", "window"], 94 | ["set", "{{.Name}}", "--memsize", "{{user `mem_size`}}"], 95 | ["set", "{{.Name}}", "--cpus", "{{user `cpus`}}"], 96 | ["set", "{{.Name}}", "--smart-mount", "off"], 97 | ["set", "{{.Name}}", "--efi-boot", "off"], 98 | ["set", "{{.Name}}", "--shared-profile", "off"], 99 | ["set", "{{.Name}}", "--shared-cloud", "off"], 100 | ["set", "{{.Name}}", "--sh-app-guest-to-host", "off"], 101 | ["set", "{{.Name}}", "--sh-app-host-to-guest", "off"], 102 | ["set", "{{.Name}}", "--shf-host-add", "log", "--path", "{{pwd}}/log", "--mode", "rw", "--enable"] 103 | ] 104 | }, 105 | { 106 | "type": "vmware-iso", 107 | "vm_name": "packer_{{user `template`}}", 108 | "guest_os_type": "windows9-64", 109 | "iso_urls": [ 110 | "{{user `cache_dir`}}/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO", 111 | "http://download.microsoft.com/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO" 112 | ], 113 | "iso_checksum_type": "md5", 114 | "iso_checksum": "6cd2f47f2c32faa7be85f1dc81af3220", 115 | "output_directory": "output-vmware-{{user `template`}}", 116 | "boot_wait": "30s", 117 | "communicator": "winrm", 118 | "winrm_username": "{{user `admin_username`}}", 119 | "winrm_password": "{{user `admin_password`}}", 120 | "winrm_timeout": "20m", 121 | "shutdown_command": "shutdown /s /t 5 /f /d p:4:1 /c \"Packer Shutdown\"", 122 | "disk_size": "{{user `disk_size`}}", 123 | "floppy_files": [ 124 | "./templates/{{user `template`}}/Autounattend.xml", 125 | "./scripts/00-run-all-scripts.cmd", 126 | "./scripts/01-config-os.cmd", 127 | "./scripts/02-config-posh.cmd", 128 | "./scripts/03-config-winrm.cmd", 129 | "./scripts/04-install-imdisk.cmd", 130 | "./scripts/99-start-services.cmd" 131 | ], 132 | "vmx_data": 133 | { 134 | "memsize": "{{user `mem_size`}}", 135 | "numvcpus": "{{user `cpus`}}", 136 | "cpuid.coresPerSocket": "1", 137 | "isolation.tools.hgfs.disable": "FALSE", 138 | "scsi0.virtualDev": "lsisas1068", 139 | "sata0.present": "TRUE", 140 | "sata0:1.present": "TRUE", 141 | "sata0:1.startConnected": "TRUE", 142 | "sata0:1.deviceType": "cdrom-image", 143 | "sata0:1.fileName": "{{user `vmware_iso_dir`}}/windows.iso", 144 | "sharedFolder.maxNum": "1", 145 | "sharedFolder0.present": "TRUE", 146 | "sharedFolder0.enabled": "TRUE", 147 | "sharedFolder0.expiration": "never", 148 | "sharedFolder0.readAccess": "TRUE", 149 | "sharedFolder0.writeAccess": "TRUE", 150 | "sharedFolder0.hostPath": "{{pwd}}/log", 151 | "sharedFolder0.guestName": "log" 152 | }, 153 | "vmx_data_post": 154 | { 155 | "sata0:1.present": "FALSE", 156 | "sata0:1.startConnected": "FALSE", 157 | "sata0:1.deviceType": "cdrom-raw", 158 | "sata0:1.fileName": "auto detect", 159 | "sharedFolder.maxNum": "0" 160 | } 161 | }, 162 | { 163 | "type": "virtualbox-iso", 164 | "vm_name": "packer-{{user `template`}}", 165 | "guest_os_type": "Windows10_64", 166 | "iso_urls": [ 167 | "{{user `cache_dir`}}/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO", 168 | "http://download.microsoft.com/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO" 169 | ], 170 | "iso_checksum_type": "md5", 171 | "iso_checksum": "6cd2f47f2c32faa7be85f1dc81af3220", 172 | "output_directory": "output-virtualbox-{{user `template`}}", 173 | "boot_wait": "30s", 174 | "communicator": "winrm", 175 | "winrm_username": "{{user `admin_username`}}", 176 | "winrm_password": "{{user `admin_password`}}", 177 | "winrm_timeout": "20m", 178 | "shutdown_command": "shutdown /s /t 5 /f /d p:4:1 /c \"Packer Shutdown\"", 179 | "post_shutdown_delay": "30s", 180 | "guest_additions_mode": "attach", 181 | "disk_size": "{{user `disk_size`}}", 182 | "floppy_files": 183 | [ 184 | "./templates/{{user `template`}}/Autounattend.xml", 185 | "./scripts/_packer_config.cmd", 186 | "./scripts/00-run-all-scripts.cmd", 187 | "./scripts/01-config-os.cmd", 188 | "./scripts/02-config-posh.cmd", 189 | "./scripts/03-config-winrm.cmd", 190 | "./scripts/04-install-imdisk.cmd", 191 | "./scripts/99-start-services.cmd" 192 | ], 193 | "vboxmanage": 194 | [ 195 | ["modifyvm", "{{.Name}}", "--ioapic", "on"], 196 | ["modifyvm", "{{.Name}}", "--memory", "{{user `mem_size`}}"], 197 | ["modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}"], 198 | ["modifyvm", "{{.Name}}", "--vram", "64"], 199 | ["setextradata", "{{.Name}}", "VBoxInternal/CPUM/CMPXCHG16B", "1"], 200 | ["sharedfolder", "add", "{{.Name}}", "--name", "log", "--hostpath", "{{pwd}}/log", "--automount"] 201 | ], 202 | "vboxmanage_post": 203 | [ 204 | ["sharedfolder", "remove", "{{.Name}}", "--name", "log"] 205 | ] 206 | } 207 | ], 208 | "provisioners": 209 | [ 210 | { "type": "powershell", 211 | "environment_vars": [ "SMBHOST={{user `share_host`}}", "SMBSHARE=log", "SMBUSER={{user `share_username`}}", "SMBPASSWORD={{user `share_password`}}", "SMBDRIVE=Z" ], 212 | "script": "./scripts/prep-share.ps1" }, 213 | { "type": "powershell", 214 | "environment_vars": [ "SMBHOST={{user `share_host`}}", "SMBSHARE=daas-cache", "SMBUSER={{user `share_username`}}", "SMBPASSWORD={{user `share_password`}}", "SMBDRIVE=Y" ], 215 | "script": "./scripts/prep-share.ps1" }, 216 | 217 | { "type": "powershell", "script": "./scripts/disable-update.ps1", "elevated_user": "vagrant", "elevated_password": "vagrant" }, 218 | { "type": "powershell", "inline": [ "Write-Host 'Configuring passwords' ; net accounts /maxpwage:unlimited" ] }, 219 | { "type": "file", "source": "./data/GeoTrust_Global_CA.pem", "destination": "C:/Windows/Temp/GeoTrust_Global_CA.pem" }, 220 | { "type": "file", "source": "./data/vagrant.jpg", "destination": "C:/Users/vagrant/Pictures/vagrant.jpg" }, 221 | { "type": "powershell", "script": "./scripts/Set-AccountPicture.ps1" }, 222 | { "type": "powershell", "script": "./scripts/install-vmhost-additions.ps1" }, 223 | { "type": "powershell", "inline": [ "Install-WindowsFeature -Name Net-Framework-Core -Source D:\\sources\\sxs" ], "elevated_user": "vagrant", "elevated_password": "vagrant" }, 224 | { "type": "windows-restart" }, 225 | 226 | { "type": "powershell", "script": "./scripts/enable-update.ps1", "elevated_user": "vagrant", "elevated_password": "vagrant" }, 227 | { "type": "powershell", "script": "./scripts/Backup-Logs.ps1" }, 228 | { "type": "powershell", "inline": [ "Remove-Item $env:HOME/*.info -Force" ] } 229 | ], 230 | "post-processors": 231 | [ 232 | { 233 | "type": "vagrant", 234 | "keep_input_artifact": false, 235 | "compression_level": 0, 236 | "vagrantfile_template": "./templates/windows-10-enterprise-eval/vagrantfile.template", 237 | "output": "./boxes/{{user `template`}}_{{user `version`}}_{{.Provider}}.box" 238 | } 239 | ] 240 | } 241 | -------------------------------------------------------------------------------- /templates/windows-10-enterprise-eval/vagrantfile.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | current_version = Gem::Version.new(Vagrant::VERSION) 5 | windows_version = Gem::Version.new("1.6.0") 6 | 7 | Vagrant.configure("2") do |config| 8 | config.vm.define "vagrant-windows-10-enterprise" 9 | config.vm.box = "windows-10-enterprise-eval" 10 | 11 | if current_version < windows_version 12 | if !Vagrant.has_plugin?('vagrant-windows') 13 | puts "vagrant-windows missing, please install the vagrant-windows plugin!" 14 | puts "Run this command in your terminal:" 15 | puts "vagrant plugin install vagrant-windows" 16 | exit 1 17 | end 18 | 19 | # Admin user name and password 20 | config.winrm.username = "vagrant" 21 | config.winrm.password = "vagrant" 22 | 23 | config.vm.guest = :windows 24 | config.windows.halt_timeout = 15 25 | 26 | # Port forward WinRM and RDP 27 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 28 | config.vm.network :forwarded_port, guest: 3389, host: 3389 29 | else 30 | config.vm.communicator = "winrm" 31 | end 32 | 33 | config.vm.provider :parallels do |provider, override| 34 | provider.update_guest_tools = true 35 | provider.memory = 2048 36 | provider.cpus = 2 37 | end 38 | 39 | config.vm.provider :vmware_fusion do |provider, override| 40 | provider.gui = true 41 | provider.vmx['memsize'] = '2048' 42 | provider.vmx['numvcpus'] = '2' 43 | end 44 | 45 | config.vm.provider :virtualbox do |provider, override| 46 | provider.gui = true 47 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 48 | provider.customize ['modifyvm', :id, '--vram', 30] 49 | provider.customize ['modifyvm', :id, '--memory', 2048] 50 | provider.customize ['modifyvm', :id, '--cpus', 2] 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /templates/windows-2012R2-core-standard-eval/Autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <settings pass="windowsPE"> 4 | <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 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 name="Microsoft-Windows-PnpCustomizationsWinPE" 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"> 15 | <DriverPaths> 16 | <PathAndCredentials wcm:keyValue="1" wcm:action="add"> 17 | <Path>A:\</Path> 18 | </PathAndCredentials> 19 | </DriverPaths> 20 | </component> 21 | <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 22 | <DiskConfiguration> 23 | <Disk wcm:action="add"> 24 | <CreatePartitions> 25 | <CreatePartition wcm:action="add"> 26 | <Type>Primary</Type> 27 | <Order>1</Order> 28 | <Size>350</Size> 29 | </CreatePartition> 30 | <CreatePartition wcm:action="add"> 31 | <Order>2</Order> 32 | <Type>Primary</Type> 33 | <Extend>true</Extend> 34 | </CreatePartition> 35 | </CreatePartitions> 36 | <ModifyPartitions> 37 | <ModifyPartition wcm:action="add"> 38 | <Active>true</Active> 39 | <Format>NTFS</Format> 40 | <Label>boot</Label> 41 | <Order>1</Order> 42 | <PartitionID>1</PartitionID> 43 | </ModifyPartition> 44 | <ModifyPartition wcm:action="add"> 45 | <Format>NTFS</Format> 46 | <Label>Windows 2012 R2</Label> 47 | <Letter>C</Letter> 48 | <Order>2</Order> 49 | <PartitionID>2</PartitionID> 50 | </ModifyPartition> 51 | </ModifyPartitions> 52 | <DiskID>0</DiskID> 53 | <WillWipeDisk>true</WillWipeDisk> 54 | </Disk> 55 | <WillShowUI>OnError</WillShowUI> 56 | </DiskConfiguration> 57 | <ImageInstall> 58 | <OSImage> 59 | <InstallFrom> 60 | <MetaData wcm:action="add"> 61 | <Key>/IMAGE/NAME</Key> 62 | <Value>Windows Server 2012 R2 SERVERSTANDARDCORE</Value> 63 | </MetaData> 64 | </InstallFrom> 65 | <InstallTo> 66 | <DiskID>0</DiskID> 67 | <PartitionID>2</PartitionID> 68 | </InstallTo> 69 | </OSImage> 70 | </ImageInstall> 71 | <UserData> 72 | <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx --> 73 | <ProductKey> 74 | <!-- Do not uncomment the Key element if you are using trial ISOs --> 75 | <!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs --> 76 | <!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>--> 77 | <!--<Key><%= @os_license%></Key>--> 78 | <WillShowUI>OnError</WillShowUI> 79 | </ProductKey> 80 | <AcceptEula>true</AcceptEula> 81 | <FullName>Evaluation</FullName> 82 | <Organization>Microsoft Corp.</Organization> 83 | </UserData> 84 | </component> 85 | </settings> 86 | <settings pass="specialize"> 87 | <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"> 88 | <OEMInformation> 89 | <HelpCustomized>false</HelpCustomized> 90 | </OEMInformation> 91 | <!-- <ComputerName>vagrant-2012-r2</ComputerName> --> 92 | <TimeZone>Pacific Standard Time</TimeZone> 93 | <RegisteredOwner/> 94 | </component> 95 | <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 96 | <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> 97 | </component> 98 | <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 99 | <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> 100 | </component> 101 | <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 102 | <IEHardenAdmin>false</IEHardenAdmin> 103 | <IEHardenUser>true</IEHardenUser> 104 | </component> 105 | <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 106 | <SkipAutoActivation>true</SkipAutoActivation> 107 | </component> 108 | <component name="Microsoft-Windows-IE-InternetExplorer" 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"> 109 | <SearchScopes> 110 | <Scope wcm:action="add"> 111 | <ScopeDefault>true</ScopeDefault> 112 | <ScopeDisplayName>Google</ScopeDisplayName> 113 | <ScopeKey>Google</ScopeKey> 114 | <ScopeUrl>http://www.google.com/search?q={searchTerms}</ScopeUrl> 115 | </Scope> 116 | </SearchScopes> 117 | <DisableAccelerators>true</DisableAccelerators> 118 | <DisableFirstRunWizard>true</DisableFirstRunWizard> 119 | <Home_Page>about:blank</Home_Page> 120 | </component> 121 | <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 122 | <SearchScopes> 123 | <Scope wcm:action="add"> 124 | <ScopeDefault>true</ScopeDefault> 125 | <ScopeDisplayName>Google</ScopeDisplayName> 126 | <ScopeKey>Google</ScopeKey> 127 | <ScopeUrl>http://www.google.com/search?q={searchTerms}</ScopeUrl> 128 | </Scope> 129 | </SearchScopes> 130 | <DisableAccelerators>true</DisableAccelerators> 131 | <DisableFirstRunWizard>true</DisableFirstRunWizard> 132 | <Home_Page>about:blank</Home_Page> 133 | </component> 134 | <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" 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"> 135 | <fDenyTSConnections>false</fDenyTSConnections> 136 | </component> 137 | <component name="Networking-MPSSVC-Svc" 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"> 138 | <FirewallGroups> 139 | <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"> 140 | <Active>true</Active> 141 | <Group>Remote Desktop</Group> 142 | <Profile>all</Profile> 143 | </FirewallGroup> 144 | </FirewallGroups> 145 | </component> 146 | <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" 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"> 147 | <UserAuthentication>0</UserAuthentication> 148 | </component> 149 | </settings> 150 | <settings pass="oobeSystem"> 151 | <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"> 152 | <OOBE> 153 | <HideEULAPage>true</HideEULAPage> 154 | <HideLocalAccountScreen>true</HideLocalAccountScreen> 155 | <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> 156 | <HideOnlineAccountScreens>true</HideOnlineAccountScreens> 157 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 158 | <NetworkLocation>Work</NetworkLocation> 159 | <ProtectYourPC>1</ProtectYourPC> 160 | </OOBE> 161 | <UserAccounts> 162 | <LocalAccounts> 163 | <LocalAccount wcm:action="add"> 164 | <Password> 165 | <Value>vagrant</Value> 166 | <PlainText>true</PlainText> 167 | </Password> 168 | <Description>Vagrant User</Description> 169 | <DisplayName>vagrant</DisplayName> 170 | <Group>Administrators</Group> 171 | <Name>vagrant</Name> 172 | </LocalAccount> 173 | </LocalAccounts> 174 | <AdministratorPassword> 175 | <Value>vagrant</Value> 176 | <PlainText>true</PlainText> 177 | </AdministratorPassword> 178 | </UserAccounts> 179 | <AutoLogon> 180 | <Enabled>true</Enabled> 181 | <Username>vagrant</Username> 182 | <Password> 183 | <Value>vagrant</Value> 184 | <PlainText>true</PlainText> 185 | </Password> 186 | </AutoLogon> 187 | <FirstLogonCommands> 188 | <SynchronousCommand wcm:action="add"> 189 | <CommandLine>cmd.exe /c a:\00-run-all-scripts.cmd</CommandLine> 190 | <Description>Run all *.bat and *.cmd scripts on drive A:</Description> 191 | <Order>1</Order> 192 | <RequiresUserInput>true</RequiresUserInput> 193 | </SynchronousCommand> 194 | </FirstLogonCommands> 195 | </component> 196 | </settings> 197 | <settings pass="offlineServicing"> 198 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 199 | <EnableLUA>false</EnableLUA> 200 | </component> 201 | </settings> 202 | <cpi:offlineImage cpi:source="wim:c:/wim/install.wim#Windows Server 2012 R2 SERVERSTANDARDCORE" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 203 | </unattend> 204 | -------------------------------------------------------------------------------- /templates/windows-2012R2-core-standard-eval/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "windows-2012R2-core-standard-eval", 3 | "organization": "gildas", 4 | "description": "This box contains Windows 2012 R2 core with the Evaluation license", 5 | "version": "0.1.0", 6 | "os": "windows", 7 | "os_version": "2012R2", 8 | "os_install": "core", 9 | "os_edition": "standard", 10 | "os_license": "eval", 11 | "cache_dir": "/var/cache/daas", 12 | "disk_size": "81920", 13 | "mem_size": "2048", 14 | "cpus": "2", 15 | "hyperv_switch": "Bridged Switch" 16 | } 17 | -------------------------------------------------------------------------------- /templates/windows-2012R2-core-standard-eval/vagrantfile.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | current_version = Gem::Version.new(Vagrant::VERSION) 5 | windows_version = Gem::Version.new("1.6.0") 6 | 7 | Vagrant.configure("2") do |config| 8 | config.vm.define "vagrant-windows-2012R2-core" 9 | config.vm.box = "windows-2012R2-core-standard-eval" 10 | 11 | if current_version < windows_version 12 | if !Vagrant.has_plugin?('vagrant-windows') 13 | puts "vagrant-windows missing, please install the vagrant-windows plugin!" 14 | puts "Run this command in your terminal:" 15 | puts "vagrant plugin install vagrant-windows" 16 | exit 1 17 | end 18 | 19 | # Admin user name and password 20 | config.winrm.username = "vagrant" 21 | config.winrm.password = "vagrant" 22 | 23 | config.vm.guest = :windows 24 | config.windows.halt_timeout = 15 25 | 26 | # Port forward WinRM and RDP 27 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 28 | config.vm.network :forwarded_port, guest: 3389, host: 3389 29 | else 30 | config.vm.communicator = "winrm" 31 | end 32 | 33 | config.vm.provider :parallels do |provider, override| 34 | provider.memory = 2048 35 | provider.cpus = 2 36 | end 37 | 38 | config.vm.provider :vmware_fusion do |provider, override| 39 | provider.gui = true 40 | provider.vmx['memsize'] = '2048' 41 | provider.vmx['numvcpus'] = '2' 42 | end 43 | 44 | config.vm.provider :virtualbox do |provider, override| 45 | provider.gui = true 46 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 47 | provider.customize ['modifyvm', :id, '--vram', 30] 48 | provider.customize ["modifyvm", :id, "--memory", 2048] 49 | provider.customize ["modifyvm", :id, "--cpus", 2] 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /templates/windows-2012R2-full-standard-eval/Autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <settings pass="windowsPE"> 4 | <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 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 name="Microsoft-Windows-PnpCustomizationsWinPE" 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"> 15 | <DriverPaths> 16 | <PathAndCredentials wcm:keyValue="1" wcm:action="add"> 17 | <Path>A:\</Path> 18 | </PathAndCredentials> 19 | </DriverPaths> 20 | </component> 21 | <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 22 | <DiskConfiguration> 23 | <Disk wcm:action="add"> 24 | <CreatePartitions> 25 | <CreatePartition wcm:action="add"> 26 | <Type>Primary</Type> 27 | <Order>1</Order> 28 | <Size>350</Size> 29 | </CreatePartition> 30 | <CreatePartition wcm:action="add"> 31 | <Order>2</Order> 32 | <Type>Primary</Type> 33 | <Extend>true</Extend> 34 | </CreatePartition> 35 | </CreatePartitions> 36 | <ModifyPartitions> 37 | <ModifyPartition wcm:action="add"> 38 | <Active>true</Active> 39 | <Format>NTFS</Format> 40 | <Label>boot</Label> 41 | <Order>1</Order> 42 | <PartitionID>1</PartitionID> 43 | </ModifyPartition> 44 | <ModifyPartition wcm:action="add"> 45 | <Format>NTFS</Format> 46 | <Label>Windows 2012 R2</Label> 47 | <Letter>C</Letter> 48 | <Order>2</Order> 49 | <PartitionID>2</PartitionID> 50 | </ModifyPartition> 51 | </ModifyPartitions> 52 | <DiskID>0</DiskID> 53 | <WillWipeDisk>true</WillWipeDisk> 54 | </Disk> 55 | <WillShowUI>OnError</WillShowUI> 56 | </DiskConfiguration> 57 | <ImageInstall> 58 | <OSImage> 59 | <InstallFrom> 60 | <MetaData wcm:action="add"> 61 | <Key>/IMAGE/NAME</Key> 62 | <Value>Windows Server 2012 R2 SERVERSTANDARD</Value> 63 | </MetaData> 64 | </InstallFrom> 65 | <InstallTo> 66 | <DiskID>0</DiskID> 67 | <PartitionID>2</PartitionID> 68 | </InstallTo> 69 | </OSImage> 70 | </ImageInstall> 71 | <UserData> 72 | <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx --> 73 | <ProductKey> 74 | <!-- Do not uncomment the Key element if you are using trial ISOs --> 75 | <!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs --> 76 | <!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>--> 77 | <!--<Key><%= @os_license%></Key>--> 78 | <WillShowUI>OnError</WillShowUI> 79 | </ProductKey> 80 | <AcceptEula>true</AcceptEula> 81 | <FullName>Evaluation</FullName> 82 | <Organization>Microsoft Corp.</Organization> 83 | </UserData> 84 | </component> 85 | </settings> 86 | <settings pass="specialize"> 87 | <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"> 88 | <OEMInformation> 89 | <HelpCustomized>false</HelpCustomized> 90 | </OEMInformation> 91 | <!-- <ComputerName>vagrant-2012-r2</ComputerName> --> 92 | <TimeZone>Pacific Standard Time</TimeZone> 93 | <RegisteredOwner/> 94 | </component> 95 | <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 96 | <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> 97 | </component> 98 | <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 99 | <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> 100 | </component> 101 | <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 102 | <IEHardenAdmin>false</IEHardenAdmin> 103 | <IEHardenUser>true</IEHardenUser> 104 | </component> 105 | <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 106 | <SkipAutoActivation>true</SkipAutoActivation> 107 | </component> 108 | <component name="Microsoft-Windows-IE-InternetExplorer" 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"> 109 | <SearchScopes> 110 | <Scope wcm:action="add"> 111 | <ScopeDefault>true</ScopeDefault> 112 | <ScopeDisplayName>Google</ScopeDisplayName> 113 | <ScopeKey>Google</ScopeKey> 114 | <ScopeUrl>http://www.google.com/search?q={searchTerms}</ScopeUrl> 115 | </Scope> 116 | </SearchScopes> 117 | <DisableAccelerators>true</DisableAccelerators> 118 | <DisableFirstRunWizard>true</DisableFirstRunWizard> 119 | <Home_Page>about:blank</Home_Page> 120 | </component> 121 | <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 122 | <SearchScopes> 123 | <Scope wcm:action="add"> 124 | <ScopeDefault>true</ScopeDefault> 125 | <ScopeDisplayName>Google</ScopeDisplayName> 126 | <ScopeKey>Google</ScopeKey> 127 | <ScopeUrl>http://www.google.com/search?q={searchTerms}</ScopeUrl> 128 | </Scope> 129 | </SearchScopes> 130 | <DisableAccelerators>true</DisableAccelerators> 131 | <DisableFirstRunWizard>true</DisableFirstRunWizard> 132 | <Home_Page>about:blank</Home_Page> 133 | </component> 134 | <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" 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"> 135 | <fDenyTSConnections>false</fDenyTSConnections> 136 | </component> 137 | <component name="Networking-MPSSVC-Svc" 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"> 138 | <FirewallGroups> 139 | <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"> 140 | <Active>true</Active> 141 | <Group>Remote Desktop</Group> 142 | <Profile>all</Profile> 143 | </FirewallGroup> 144 | </FirewallGroups> 145 | </component> 146 | <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" 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"> 147 | <UserAuthentication>0</UserAuthentication> 148 | </component> 149 | </settings> 150 | <settings pass="oobeSystem"> 151 | <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"> 152 | <OOBE> 153 | <HideEULAPage>true</HideEULAPage> 154 | <HideLocalAccountScreen>true</HideLocalAccountScreen> 155 | <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> 156 | <HideOnlineAccountScreens>true</HideOnlineAccountScreens> 157 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 158 | <NetworkLocation>Work</NetworkLocation> 159 | <ProtectYourPC>1</ProtectYourPC> 160 | </OOBE> 161 | <UserAccounts> 162 | <LocalAccounts> 163 | <LocalAccount wcm:action="add"> 164 | <Password> 165 | <Value>vagrant</Value> 166 | <PlainText>true</PlainText> 167 | </Password> 168 | <Description>Vagrant User</Description> 169 | <DisplayName>vagrant</DisplayName> 170 | <Group>Administrators</Group> 171 | <Name>vagrant</Name> 172 | </LocalAccount> 173 | </LocalAccounts> 174 | <AdministratorPassword> 175 | <Value>vagrant</Value> 176 | <PlainText>true</PlainText> 177 | </AdministratorPassword> 178 | </UserAccounts> 179 | <AutoLogon> 180 | <Enabled>true</Enabled> 181 | <Username>vagrant</Username> 182 | <Password> 183 | <Value>vagrant</Value> 184 | <PlainText>true</PlainText> 185 | </Password> 186 | </AutoLogon> 187 | <FirstLogonCommands> 188 | <SynchronousCommand wcm:action="add"> 189 | <CommandLine>cmd.exe /c a:\00-run-all-scripts.cmd</CommandLine> 190 | <Description>Run all *.bat and *.cmd scripts on drive A:</Description> 191 | <Order>1</Order> 192 | <RequiresUserInput>true</RequiresUserInput> 193 | </SynchronousCommand> 194 | </FirstLogonCommands> 195 | </component> 196 | </settings> 197 | <settings pass="offlineServicing"> 198 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 199 | <EnableLUA>false</EnableLUA> 200 | </component> 201 | </settings> 202 | <cpi:offlineImage cpi:source="wim:c:/wim/install.wim#Windows Server 2012 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 203 | </unattend> 204 | -------------------------------------------------------------------------------- /templates/windows-2012R2-full-standard-eval/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "windows-2012R2-full-standard-eval", 3 | "organization": "gildas", 4 | "description": "This box contains Windows 2012 R2 full with the Evaluation license", 5 | "version": "0.1.0", 6 | "os": "windows", 7 | "os_version": "2012R2", 8 | "os_install": "full", 9 | "os_edition": "standard", 10 | "os_license": "eval", 11 | "cache_dir": "/var/cache/daas", 12 | "disk_size": "81920", 13 | "mem_size": "2048", 14 | "cpus": "2", 15 | "hyperv_switch": "Bridged Switch" 16 | } 17 | -------------------------------------------------------------------------------- /templates/windows-2012R2-full-standard-eval/vagrantfile.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | current_version = Gem::Version.new(Vagrant::VERSION) 5 | windows_version = Gem::Version.new("1.6.0") 6 | 7 | Vagrant.configure("2") do |config| 8 | config.vm.define "vagrant-windows-2012R2-full" 9 | config.vm.box = "windows-2012R2-full-standard-eval" 10 | 11 | if current_version < windows_version 12 | if !Vagrant.has_plugin?('vagrant-windows') 13 | puts "vagrant-windows missing, please install the vagrant-windows plugin!" 14 | puts "Run this command in your terminal:" 15 | puts "vagrant plugin install vagrant-windows" 16 | exit 1 17 | end 18 | 19 | # Admin user name and password 20 | config.winrm.username = "vagrant" 21 | config.winrm.password = "vagrant" 22 | 23 | config.vm.guest = :windows 24 | config.windows.halt_timeout = 15 25 | 26 | # Port forward WinRM and RDP 27 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 28 | config.vm.network :forwarded_port, guest: 3389, host: 3389 29 | else 30 | config.vm.communicator = "winrm" 31 | end 32 | 33 | config.vm.provider :parallels do |provider, override| 34 | provider.update_guest_tools = true 35 | provider.memory = 2048 36 | provider.cpus = 2 37 | end 38 | 39 | config.vm.provider :vmware_fusion do |provider, override| 40 | provider.gui = true 41 | provider.vmx['memsize'] = '2048' 42 | provider.vmx['numvcpus'] = '2' 43 | end 44 | 45 | config.vm.provider :virtualbox do |provider, override| 46 | provider.gui = true 47 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 48 | provider.customize ['modifyvm', :id, '--vram', 30] 49 | provider.customize ['modifyvm', :id, '--memory', 2048] 50 | provider.customize ['modifyvm', :id, '--cpus', 2] 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /templates/windows-8.1-enterprise-eval/Autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend xmlns="urn:schemas-microsoft-com:unattend"> 3 | <settings pass="windowsPE"> 4 | <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 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 name="Microsoft-Windows-PnpCustomizationsWinPE" 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"> 15 | <DriverPaths> 16 | <PathAndCredentials wcm:keyValue="1" wcm:action="add"> 17 | <Path>A:\</Path> 18 | </PathAndCredentials> 19 | </DriverPaths> 20 | </component> 21 | <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 22 | <DiskConfiguration> 23 | <Disk wcm:action="add"> 24 | <CreatePartitions> 25 | <CreatePartition wcm:action="add"> 26 | <Order>1</Order> 27 | <Type>Primary</Type> 28 | <Size>350</Size> 29 | </CreatePartition> 30 | <CreatePartition wcm:action="add"> 31 | <Order>2</Order> 32 | <Type>Primary</Type> 33 | <Extend>true</Extend> 34 | </CreatePartition> 35 | </CreatePartitions> 36 | <ModifyPartitions> 37 | <ModifyPartition wcm:action="add"> 38 | <Active>true</Active> 39 | <Format>NTFS</Format> 40 | <Label>boot</Label> 41 | <Order>1</Order> 42 | <PartitionID>1</PartitionID> 43 | </ModifyPartition> 44 | <ModifyPartition wcm:action="add"> 45 | <Format>NTFS</Format> 46 | <Label>System</Label> 47 | <Letter>C</Letter> 48 | <Order>2</Order> 49 | <PartitionID>2</PartitionID> 50 | </ModifyPartition> 51 | </ModifyPartitions> 52 | <DiskID>0</DiskID> 53 | <WillWipeDisk>true</WillWipeDisk> 54 | </Disk> 55 | <WillShowUI>OnError</WillShowUI> 56 | </DiskConfiguration> 57 | <ImageInstall> 58 | <OSImage> 59 | <InstallFrom> 60 | <MetaData wcm:action="add"> 61 | <Key>/IMAGE/NAME</Key> 62 | <Value>Windows 8.1 ENTERPRISE EVALUATION</Value> 63 | </MetaData> 64 | </InstallFrom> 65 | <InstallTo> 66 | <DiskID>0</DiskID> 67 | <PartitionID>2</PartitionID> 68 | </InstallTo> 69 | </OSImage> 70 | </ImageInstall> 71 | <UserData> 72 | <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx --> 73 | <ProductKey> 74 | <!-- Do not uncomment the Key element if you are using trial ISOs --> 75 | <!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs --> 76 | <!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>--> 77 | <!--<Key><%= @os_license%></Key>--> 78 | <WillShowUI>OnError</WillShowUI> 79 | </ProductKey> 80 | <AcceptEula>true</AcceptEula> 81 | <FullName>Evaluation</FullName> 82 | <Organization>Microsoft Corp.</Organization> 83 | </UserData> 84 | </component> 85 | </settings> 86 | <settings pass="specialize"> 87 | <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"> 88 | <OEMInformation> 89 | <HelpCustomized>false</HelpCustomized> 90 | </OEMInformation> 91 | <ComputerName>*</ComputerName> 92 | <TimeZone>Pacific Standard Time</TimeZone> 93 | <RegisteredOwner/> 94 | </component> 95 | <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 96 | <IEHardenAdmin>false</IEHardenAdmin> 97 | <IEHardenUser>true</IEHardenUser> 98 | </component> 99 | <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 100 | <SkipAutoActivation>true</SkipAutoActivation> 101 | </component> 102 | <component name="Microsoft-Windows-IE-InternetExplorer" 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"> 103 | <SearchScopes> 104 | <Scope wcm:action="add"> 105 | <ScopeDefault>true</ScopeDefault> 106 | <ScopeDisplayName>Google</ScopeDisplayName> 107 | <ScopeKey>Google</ScopeKey> 108 | <ScopeUrl>http://www.google.com/search?q={searchTerms}</ScopeUrl> 109 | </Scope> 110 | </SearchScopes> 111 | <DisableAccelerators>true</DisableAccelerators> 112 | <DisableFirstRunWizard>true</DisableFirstRunWizard> 113 | <Home_Page>about:blank</Home_Page> 114 | </component> 115 | <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 116 | <SearchScopes> 117 | <Scope wcm:action="add"> 118 | <ScopeDefault>true</ScopeDefault> 119 | <ScopeDisplayName>Google</ScopeDisplayName> 120 | <ScopeKey>Google</ScopeKey> 121 | <ScopeUrl>http://www.google.com/search?q={searchTerms}</ScopeUrl> 122 | </Scope> 123 | </SearchScopes> 124 | <DisableAccelerators>true</DisableAccelerators> 125 | <DisableFirstRunWizard>true</DisableFirstRunWizard> 126 | <Home_Page>about:blank</Home_Page> 127 | </component> 128 | <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" 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"> 129 | <fDenyTSConnections>false</fDenyTSConnections> 130 | </component> 131 | <component name="Networking-MPSSVC-Svc" 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"> 132 | <FirewallGroups> 133 | <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"> 134 | <Active>true</Active> 135 | <!-- <Group>Remote Desktop</Group> --> 136 | <Group>@FirewallAPI.dll,-28752</Group> 137 | <Profile>all</Profile> 138 | </FirewallGroup> 139 | </FirewallGroups> 140 | </component> 141 | <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" 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"> 142 | <UserAuthentication>0</UserAuthentication> 143 | </component> 144 | </settings> 145 | <settings pass="oobeSystem"> 146 | <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"> 147 | <OOBE> 148 | <HideEULAPage>true</HideEULAPage> 149 | <HideLocalAccountScreen>true</HideLocalAccountScreen> 150 | <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> 151 | <HideOnlineAccountScreens>true</HideOnlineAccountScreens> 152 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 153 | <NetworkLocation>Work</NetworkLocation> 154 | <ProtectYourPC>1</ProtectYourPC> 155 | </OOBE> 156 | <UserAccounts> 157 | <LocalAccounts> 158 | <LocalAccount wcm:action="add"> 159 | <Password> 160 | <Value>vagrant</Value> 161 | <PlainText>true</PlainText> 162 | </Password> 163 | <Description>Vagrant User</Description> 164 | <DisplayName>vagrant</DisplayName> 165 | <Group>Administrators</Group> 166 | <Name>vagrant</Name> 167 | </LocalAccount> 168 | </LocalAccounts> 169 | <AdministratorPassword> 170 | <Value>vagrant</Value> 171 | <PlainText>true</PlainText> 172 | </AdministratorPassword> 173 | </UserAccounts> 174 | <AutoLogon> 175 | <Enabled>true</Enabled> 176 | <Username>vagrant</Username> 177 | <Password> 178 | <Value>vagrant</Value> 179 | <PlainText>true</PlainText> 180 | </Password> 181 | </AutoLogon> 182 | <FirstLogonCommands> 183 | <SynchronousCommand wcm:action="add"> 184 | <CommandLine>cmd.exe /c a:\00-run-all-scripts.cmd</CommandLine> 185 | <Description>Run all *.bat and *.cmd scripts on drive A:</Description> 186 | <Order>1</Order> 187 | <RequiresUserInput>true</RequiresUserInput> 188 | </SynchronousCommand> 189 | </FirstLogonCommands> 190 | </component> 191 | </settings> 192 | <settings pass="offlineServicing"> 193 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 194 | <EnableLUA>false</EnableLUA> 195 | </component> 196 | </settings> 197 | <cpi:offlineImage cpi:source="wim:c:/wim/install.wim#Windows 8.1 ENTERPRISE EVALUATION" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 198 | </unattend> 199 | -------------------------------------------------------------------------------- /templates/windows-8.1-enterprise-eval/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "windows-8.1-enterprise-eval", 3 | "organization": "gildas", 4 | "description": "This box contains Windows 8.1 full with the Evaluation license", 5 | "version": "0.1.0", 6 | "os": "windows", 7 | "os_version": "8.1", 8 | "os_edition": "enterprise", 9 | "os_license": "eval", 10 | "cache_dir": "/var/cache/daas", 11 | "mem_size": "2048", 12 | "cpus": "2", 13 | "hyperv_switch": "Bridged Switch" 14 | } 15 | -------------------------------------------------------------------------------- /templates/windows-8.1-enterprise-eval/vagrantfile.template: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | current_version = Gem::Version.new(Vagrant::VERSION) 5 | windows_version = Gem::Version.new("1.6.0") 6 | 7 | Vagrant.configure("2") do |config| 8 | config.vm.define "vagrant-windows-8.1-enterprise" 9 | config.vm.box = "windows-8.1-enterprise-eval" 10 | 11 | if current_version < windows_version 12 | if !Vagrant.has_plugin?('vagrant-windows') 13 | puts "vagrant-windows missing, please install the vagrant-windows plugin!" 14 | puts "Run this command in your terminal:" 15 | puts "vagrant plugin install vagrant-windows" 16 | exit 1 17 | end 18 | 19 | # Admin user name and password 20 | config.winrm.username = "vagrant" 21 | config.winrm.password = "vagrant" 22 | 23 | config.vm.guest = :windows 24 | config.windows.halt_timeout = 15 25 | 26 | # Port forward WinRM and RDP 27 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 28 | config.vm.network :forwarded_port, guest: 3389, host: 3389 29 | else 30 | config.vm.communicator = "winrm" 31 | end 32 | 33 | config.vm.provider :parallels do |provider, override| 34 | provider.update_guest_tools = true 35 | provider.memory = 2048 36 | provider.cpus = 2 37 | end 38 | 39 | config.vm.provider :vmware_fusion do |provider, override| 40 | provider.gui = true 41 | provider.vmx['memsize'] = '2048' 42 | provider.vmx['numvcpus'] = '2' 43 | end 44 | 45 | config.vm.provider :virtualbox do |provider, override| 46 | provider.gui = true 47 | provider.customize ['modifyvm', :id, '--ioapic', 'on'] #To assign >1 CPUs 48 | provider.customize ['modifyvm', :id, '--vram', 30] 49 | provider.customize ['modifyvm', :id, '--memory', 2048] 50 | provider.customize ['modifyvm', :id, '--cpus', 2] 51 | end 52 | end 53 | --------------------------------------------------------------------------------