...
 
Commits (220)
.DS_Store
/iso/*
!/iso/README.md
/output-hyperv-iso/
/output-vmware/
/output-vmware-iso/
/output-vmware-vmx/
......
FROM mcr.microsoft.com/windows:ltsc2019 AS makeiso
WORKDIR C:/source
COPY . .
RUN powershell -NoProfile -ExecutionPolicy unrestricted -file make_unattend_iso.ps1
FROM mcr.microsoft.com/windowsservercore:ltsc2019
ENV chocolateyUseWindowsCompression false
RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command \
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \
choco feature disable --name showDownloadProgress
RUN choco install -y packer
RUN powershell -Command Install-WindowsFeature Hyper-V-PowerShell
COPY --from=makeiso C:/source C:/source
WORKDIR C:/source
RUN powershell -File test.ps1
## Windows - Amazon Import AMIs
VirtualBox Hypervisor is used to build a local vm and then imported as an AMI using
the amazon import service https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html.
## Requirements
* Set your aws credentials on the default location `~/.aws/credentials`. https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
* Packer 1.2.3+. https://www.packer.io/downloads.html
* S3 Bucket with the necessary permissions. Set the `AWS_S3_BUCKET` environment variable.
* If you use SAML authentication make sure you set `profile` in the amazon-import post-processor.
* `vm-guest-tools` provisioner is removed.
You may wonder what's this `Dockerfile` for. I have tested the Windows Server 2019 insider 17744 build
to see if I can run the `test.ps1` script that checks all packer templates with `packer validate` in a Windows container.
```
docker build -t packervalidate .
```
If the Docker image can be built then all packer templates have no errors.
# My Retina Windows Templates for Packer
# Windows Templates for Packer
[![Build status](https://ci.appveyor.com/api/projects/status/76pea1oexae5ca05?svg=true)](https://ci.appveyor.com/project/StefanScherer/packer-windows)
......@@ -16,27 +16,26 @@ Some of my enhancements are:
* Support of fullscreen Retina display on a MacBook Pro.
* WinRM, no more OpenSSH
* PowerShell attached to taskbar in desktop editions
### Packer Version
[Packer](https://github.com/mitchellh/packer/blob/master/CHANGELOG.md) `1.1.3` is recommended.
[Packer](https://github.com/mitchellh/packer/blob/master/CHANGELOG.md) `1.3.3` is recommended.
### Windows Versions
The following Windows versions are known to work (built with VMware Fusion Pro
10.1.1):
11.0.2):
* Windows 10
* Windows 10 1709
* Windows 10 1809 -> Vagrant Cloud box [StefanScherer/windows_10](https://app.vagrantup.com/StefanScherer/boxes/windows_10)
* Windows 10 Insider
* Windows Server 2016 Desktop
* Windows Server 2019 Desktop (Insider Preview)
* Windows Server 2016 Desktop -> Vagrant Cloud box [StefanScherer/windows_2016](https://app.vagrantup.com/StefanScherer/boxes/windows_2016)
* Windows Server 2019 Desktop -> Vagrant Cloud box [StefanScherer/windows_2019](https://app.vagrantup.com/StefanScherer/boxes/windows_2019)
* Windows Server Core
* Windows Server 2016 without and with Docker
* Windows Server 1709 without and with Docker
* Windows Server 2016 without and with Docker -> Vagrant Cloud box [StefanScherer/windows_2016_docker](https://app.vagrantup.com/StefanScherer/boxes/windows_2016_docker)
* Windows Server 2019 without and with Docker -> Vagrant Cloud box [StefanScherer/windows_2019_docker](https://app.vagrantup.com/StefanScherer/boxes/windows_2019_docker)
* Windows Server 1709, 1803, 1809, and 1903 all without and with Docker
* Windows Server InsiderPreview Semi-Annual without and with Docker
* Windows Server 2019 Core(Insider Preview)
You may find other packer template files, but older versions of Windows doesn't
work so nice with a Retina display.
......@@ -171,7 +170,7 @@ hyperv-iso output will be in this color.
### Using .box Files With Vagrant
The generated box files include a Vagrantfile template that is suitable for use
with Vagrant 1.7.4+, but the latest ersion is always recommended.
with Vagrant 1.7.4+, but the latest version is always recommended.
Example Steps for Hyper-V:
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2012 R2 SERVERSTANDARD</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2012 R2 SERVERSTANDARDCORE</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2012 R2 SERVERHYPERCORE</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERSTANDARD</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERSTANDARDCORE</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,8 +50,8 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Value>Windows Server 2016 SERVERDATACENTER</Value>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2019 SERVERDATACENTER</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......@@ -65,7 +65,7 @@
<ProductKey>
<!-- Do not uncomment the Key element if you are using trial ISOs -->
<!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs -->
<Key>6XBNX-4JQGW-QX6QG-74P76-72V67</Key>
<!-- <Key>6XBNX-4JQGW-QX6QG-74P76-72V67</Key> -->
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
......
......@@ -51,7 +51,7 @@
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERDATACENTERCORE</Value>
<Value>Windows Server 2019 SERVERDATACENTERCORE</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......@@ -66,7 +66,7 @@
Windows Server Insider product key
See https://blogs.windows.com/windowsexperience/2017/07/13/announcing-windows-server-insider-preview-build-16237/
-->
<Key>B69WH-PRNHK-BXVK3-P9XF7-XD84W</Key>
<!--<Key></Key>-->
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
......@@ -163,14 +163,15 @@
<Description>Disable password expiration for vagrant user</Description>
</SynchronousCommand>
<!-- WITHOUT WINDOWS UPDATES -->
<!--
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\enable-winrm.ps1</CommandLine>
<Description>Enable WinRM</Description>
<Order>99</Order>
</SynchronousCommand>
-->
<!-- END WITHOUT WINDOWS UPDATES -->
<!-- WITH WINDOWS UPDATES -->
<!--
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine>
<Order>98</Order>
......@@ -188,7 +189,6 @@
<Order>100</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
-->
<!-- END WITH WINDOWS UPDATES -->
</FirstLogonCommands>
<OOBE>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERDATACENTERACORE</Value>
</MetaData>
</InstallFrom>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -51,7 +51,7 @@
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERDATACENTERACORE</Value>
<Value>Windows Server 2019 SERVERDATACENTERACORE</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......
#!/bin/bash
#packer build --only=vmware-iso windows_10.json
#packer build --only=vmware-iso windows_10.json
packer build --only=vmware-iso --var iso_url=~/Downloads/17763.1.180914-1434.rs5_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso windows_10.json
# Windows 10 Pro own license
#packer build --only=vmware-iso --var iso_url=~/packer_cache/my/Win10_1607_English_x64.iso --var iso_checksum=99fd8082a609997ae97a514dca22becf20420891 --var autounattend=./tmp/10_pro/Autounattend.xml windows_10.json
# Windows 10 Insider
# packer build --only=vmware-iso --var iso_url=~/packer_cache/connect/16281.1000.170829-1438.rs3_release_CLIENT_BUSINESS_x64FRE_en-us.iso --var iso_checksum=1424eee844683d5e0206f94a034f3ddb80f13f65add5bf838c8608f247a99bd9 windows_10_insider.json
# packer build --only=vmware-iso --var iso_url=~/packer_cache/connect/17025.1000.171020-1626.rs_prerelease_CLIENT_BUSINESS_VOL_x64FRE_en-us.iso --var iso_checksum=2ffc9daea950a2d43e0cafe4807870ce412cf1a9d24a94f6cf9240c71b4b8039 windows_10_insider.json
# Windows 10 Enterprise MSDN
#packer build --only=vmware-iso --var iso_url=~/packer_cache/msdn/en_windows_10_enterprise_version_1607_updated_jan_2017_x64_dvd_9714415.iso --var iso_checksum=97164DD5C1C933BAEF89A4BDE93D544256134FE4 --var iso_checksum_type=sha1 --var autounattend=./tmp/10/Autounattend.xml windows_10.json
# packer build --only=vmware-iso --var iso_url=~/packer_cache/msdn/en_windows_10_enterprise_version_1703_updated_march_2017_x64_dvd_10189290.iso --var iso_checksum=77D5E7C91B5DBBEE410FB6C57CB944238BF7176A --var iso_checksum_type=sha1 --var autounattend=./tmp/10/Autounattend.xml windows_10.json
# Windows 10 Client 15031
#packer build --only=vmware-iso \
# --var iso_url=~/connect/2017-02-08-windows10-15031-rs2/15031.0.170204-1546.RS2_RELEASE_CLIENTPRO-CORE_OEMRET_X64FRE_EN-US.ISO \
# --var iso_checksum=d35a1bc67c4cf0226a4e7381752e81a0ab081356 \
# --var autounattend=./tmp/10_pro_msdn/Autounattend.xml \
# windows_10.json
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/connect/17046.1000.171118-1403.rs_prerelease_CLIENT_BUSINESS_VOL_x64FRE_en-us.iso \
--var iso_checksum=0c014fda2648f3659682e51ef3609f7b127be09db51c59ad632a6c407afba4b6 \
windows_10_insider.json
# --var disk_type_id=3 \
# --var disk_size=30720 \
#!/bin/bash
packer build --only=vmware-iso --var iso_url=~/packer_cache/insider/Windows10_InsiderPreview_Client_x64_en-us_18290.iso windows_10_insider.json
......@@ -3,5 +3,5 @@
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_vNext_en-us_17639.iso \
--var iso_url=~/downloads/17763.379.190312-0539.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso \
windows_2019.json
if (Test-Path ./output-hyperv-iso) {
Remove-Item -Recurse -Force ./output-hyperv-iso
}
packer build --only=hyperv-iso `
--var iso_url=./iso/17763.379.190312-0539.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso `
--var iso_checksum="221F9ACBC727297A56674A0F1722B8AC7B6E840B4E1FFBDD538A9ED0DA823562" `
windows_2019_docker.json
#!/bin/bash
# Insider ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var autounattend=./tmp/2019_core/Autounattend.xml \
--var iso_url=~/packer_cache/msdn/en_windows_server_2019_x64_dvd_4cb967d8.iso \
--var iso_checksum="4C5DD63EFEE50117986A2E38D4B3A3FBAF3C1C15E2E7EA1D23EF9D8AF148DD2D" \
windows_2019_docker.json
./make_unattend_iso.ps1
if (Test-Path ./output-hyperv-iso) {
Remove-Item -Recurse -Force ./output-hyperv-iso
}
packer build --only=hyperv-iso --var iso_url=./local.iso windows_2019_docker_azure.json
#!/bin/bash
# MSDN 1803 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1803_x64_dvd_12063476.iso \
--var autounattend=./tmp/1803/Autounattend.xml \
windows_server_1803_docker.json
#!/bin/bash
# MSDN 1809 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1809_x64_dvd_92d11ba1.iso \
--var autounattend=./tmp/1809/Autounattend.xml \
windows_server_1809_docker.json
#!/bin/bash
# MSDN 1903 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1903_x64_dvd_58ddff4b.iso \
--var autounattend=./tmp/1903/Autounattend.xml \
windows_server_1903_docker.json
......@@ -4,5 +4,5 @@
PACKER_LOG=debug packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_17623.iso \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_18356.iso \
windows_server_insider_docker.json
This diff is collapsed.
if not exist "C:\Windows\Temp\chef.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.getchef.com/chef/install.msi', 'C:\Windows\Temp\chef.msi')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.getchef.com/chef/install.msi', 'C:\Windows\Temp\chef.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\chef.msi
powershell -Command "Start-Sleep 1" <NUL
\ No newline at end of file
powershell -Command "Start-Sleep 1" <NUL
......@@ -2,13 +2,13 @@ if "%PACKER_BUILDER_TYPE:~0,6%"=="hyperv" (
echo "Skip compact steps in Hyper-V build."
goto :eof
)
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
msiexec /qb /i C:\Windows\Temp\7z1900-x64.msi
if not exist "C:\Windows\Temp\ultradefrag.zip" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL
)
if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" (
......@@ -16,7 +16,7 @@ if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" (
)
if not exist "C:\Windows\Temp\SDelete.zip" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.sysinternals.com/files/SDelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.sysinternals.com/files/SDelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://vagrantboxes.blob.core.windows.net/box/sdelete/v1.6.1/sdelete.exe', 'C:\Windows\Temp\sdelete.exe')" <NUL
)
......@@ -24,7 +24,7 @@ if not exist "C:\Windows\Temp\sdelete.exe" (
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\SDelete.zip -oC:\Windows\Temp"
)
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
msiexec /qb /x C:\Windows\Temp\7z1900-x64.msi
net stop wuauserv
rmdir /S /Q C:\Windows\SoftwareDistribution\Download
......
......@@ -2,6 +2,7 @@ if ($env:PACKER_BUILDER_TYPE -And $($env:PACKER_BUILDER_TYPE).startsWith("hyperv
Write-Host Skip debloat steps in Hyper-V build.
} else {
Write-Host Downloading debloat zip
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$url="https://github.com/StefanScherer/Debloat-Windows-10/archive/master.zip"
(New-Object System.Net.WebClient).DownloadFile($url, "$env:TEMP\debloat.zip")
Expand-Archive -Path $env:TEMP\debloat.zip -DestinationPath $env:TEMP -Force
......
Write-Output 'Do not open Server Manager at logon'
New-ItemProperty -Path HKCU:\Software\Microsoft\ServerManager -Name DoNotOpenServerManagerAtLogon -PropertyType DWORD -Value "1" -Force
Write-Output 'Install bginfo'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (!(Test-Path 'c:\Program Files\sysinternals')) {
New-Item -Path 'c:\Program Files\sysinternals' -type directory -Force -ErrorAction SilentlyContinue
}
if (!(Test-Path 'c:\Program Files\sysinternals\bginfo.exe')) {
(New-Object Net.WebClient).DownloadFile('https://live.sysinternals.com/bginfo.exe', 'c:\Program Files\sysinternals\bginfo.exe')
}
if (!(Test-Path 'c:\Program Files\sysinternals\bginfo.bgi')) {
(New-Object Net.WebClient).DownloadFile('https://github.com/StefanScherer/windows-docker-workshop/raw/master/prepare-vms/azure/packer/bginfo.bgi', 'c:\Program Files\sysinternals\bginfo.bgi')
}
if (!(Test-Path 'c:\Program Files\sysinternals\background.jpg')) {
(New-Object Net.WebClient).DownloadFile('https://github.com/StefanScherer/windows-docker-workshop/raw/master/prepare-vms/azure/packer/background.jpg', 'c:\Program Files\sysinternals\background.jpg')
}
$vbsScript = @'
WScript.Sleep 2000
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""c:\Program Files\sysinternals\bginfo.exe"" /accepteula ""c:\Program Files\sysinternals\bginfo.bgi"" /silent /timer:0")
'@
$vbsScript | Out-File 'c:\Program Files\sysinternals\bginfo.vbs'
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -Name bginfo -Value 'wscript "c:\Program Files\sysinternals\bginfo.vbs"'
wscript "c:\Program Files\sysinternals\bginfo.vbs"
Write-Output 'Install Chocolatey'
Invoke-WebRequest 'https://chocolatey.org/install.ps1' -UseBasicParsing | Invoke-Expression
Write-Output 'Install editors'
choco install -y visualstudiocode
Write-Output 'Install Git'
choco install -y git
Write-Output 'Install browsers'
choco install -y googlechrome
choco install -y firefox
Write-Output 'Install Docker Compose'
choco install -y docker-compose
#"Remove" | Out-File C:\Users\vagrant\Desktop\delete-me-to-continue.txt
#while (Test-Path C:\Users\vagrant\Desktop\delete-me-to-continue.txt) {
# Start-Sleep 1
#}
Write-Host "Downloading nanoserver image"
docker import http://172.16.236.1:8080/CBaseOs_rs_prerelease_17035.1000.171103-1616_amd64fre_NanoServer_en-us.tar.gz microsoft/nanoserver-insider:latest
#Write-Host "Downloading windowsservercore image"
#docker import http://172.16.236.1:8080/CBaseOs_rs_prerelease_17035.1000.171103-1616_amd64fre_ServerDatacenterCore_en-us.tar.gz microsoft/windowsservercore-insider:latest
docker images
......@@ -21,9 +21,24 @@ function DockerPull {
$results
}
function DockerRun {
Param ([string]$image)
if ($image -eq "") {
return
}
Write-Host Run first container from $image ...
docker run --rm $image cmd
}
$images | foreach {
DockerPull $_
}
$images | foreach {
DockerPull $_
}
$images | foreach {
DockerRun $_
}
$docker_provider = "ce"
$docker_version = "17.10.0"
# use docker_provider: "ee", "ce", "master" or ""
$docker_provider = "ee"
$docker_version = "18-09-6"
if (Test-Path env:docker_provider) {
$docker_provider = $env:docker_provider
}
......@@ -7,30 +8,41 @@ if (Test-Path env:docker_version) {
$docker_version = $env:docker_version
}
$ProgressPreference = 'SilentlyContinue'
if ($docker_provider -eq "ce") {
$zip_url = $("https://download.docker.com/win/static/edge/x86_64/docker-{0}-ce.zip" -f $docker_version)
} elseif ($docker_provider -eq "ee") {
$zip_url = $("https://dockermsft.blob.core.windows.net/dockercontainer/docker-{0}.zip" -f $docker_version)
} elseif ($docker_provider -eq "master") {
$docker_version = "master"
$zip_url = "https://master.dockerproject.com/windows/x86_64/docker.zip"
}
if ($zip_url) {
Set-ExecutionPolicy Bypass -scope Process
New-Item -Type Directory -Path "$($env:ProgramFiles)\docker"
Write-Host "Downloading docker $docker_version ..."
wget -outfile $env:TEMP\docker.zip $("https://download.docker.com/win/static/edge/x86_64/docker-{0}-ce.zip" -f $docker_version)
Write-Output "Downloading docker $docker_version ..."
wget -outfile $env:TEMP\docker.zip $zip_url
Expand-Archive -Path $env:TEMP\docker.zip -DestinationPath $env:TEMP -Force
copy $env:TEMP\docker\*.exe $env:ProgramFiles\docker
copy $env:TEMP\docker\*.* $env:ProgramFiles\docker
Remove-Item $env:TEMP\docker.zip
Remove-Item -Recurse $env:TEMP\docker
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($env:ProgramFiles)\docker", [EnvironmentVariableTarget]::Machine)
$env:Path = $env:Path + ";$($env:ProgramFiles)\docker"
Write-Host "Registering docker service ..."
Write-Output "Registering docker service ..."
. dockerd --register-service
} else {
Write-Host "Install-PackageProvider ..."
Write-Output "Install-PackageProvider ..."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Write-Host "Install-Module $docker_provider ..."
Install-Module -Name $docker_provider -Force
Write-Host "Install-Package version $docker_version ..."
Write-Output "Install-Module $docker_provider ..."
Install-Module -Name $docker_provider -Repository PSGallery -Force
Write-Output "Install-Package docker version $docker_version ..."
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
$ErrorActionStop = 'SilentlyContinue'
Install-Package -Name docker -ProviderName DockerProvider -RequiredVersion $docker_version -Force
Install-Package -Name docker -ProviderName $docker_provider -RequiredVersion $docker_version -Force
Set-PSRepository -InstallationPolicy Untrusted -Name PSGallery
}
$ErrorActionPreference = 'Stop'
Write-Host "Starting docker ..."
Write-Output "Starting docker ..."
Start-Service docker
......@@ -3,10 +3,10 @@
:: This fixes a problem with wrong exitcode 0 instead of custom exitcode in PowerShell 2.0
setlocal
if defined ProgramFiles(x86) (
set link=http://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438167_intl_x64_zip.exe
set link=https://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438167_intl_x64_zip.exe
set msufilename=%TEMP%\Windows6.1-KB2552055-x64.msu
) else (
set link=http://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438164_intl_i386_zip.exe
set link=https://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438164_intl_i386_zip.exe
set msufilename=%TEMP%\Windows6.1-KB2552055-x86.msu
)
set zipfilename=%TEMP%\KB2552055.zip
......
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe', 'C:\Windows\Temp\dotNetFx40.exe')" <NUL
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe', 'C:\Windows\Temp\dotNetFx40.exe')" <NUL
C:\Windows\Temp\dotNetFx40.exe /q /norestart /repair
......@@ -6,7 +6,7 @@ Write-Output "AutoStart: $AutoStart"
$is_64bit = [IntPtr]::size -eq 8
# setup openssh
$ssh_download_url = "http://www.mls-software.com/files/setupssh-7.1p1-1.exe"
$ssh_download_url = "https://www.mls-software.com/files/setupssh-7.1p1-1.exe"
if (!(Test-Path "C:\Program Files\OpenSSH\bin\ssh.exe")) {
Write-Output "Downloading $ssh_download_url"
......
# https://docs.microsoft.com/de-de/azure/virtual-machines/windows/prepare-for-upload-vhd-image
netsh winhttp reset proxy
"san policy=onlineall" | Out-File -Encoding Ascii $env:TEMP\diskpart.txt
& diskpart /s $env:TEMP\diskpart.txt
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation' -name "RealTimeIsUniversal" 1 -Type DWord
Set-Service -Name w32time -StartupType Automatic
powercfg /setactive SCHEME_MIN
Set-Service -Name bfe -StartupType Automatic
Set-Service -Name dhcp -StartupType Automatic
Set-Service -Name dnscache -StartupType Automatic
Set-Service -Name IKEEXT -StartupType Automatic
Set-Service -Name iphlpsvc -StartupType Automatic
Set-Service -Name netlogon -StartupType Manual
Set-Service -Name netman -StartupType Manual
Set-Service -Name nsi -StartupType Automatic
Set-Service -Name termService -StartupType Manual
Set-Service -Name MpsSvc -StartupType Automatic
Set-Service -Name RemoteRegistry -StartupType Automatic
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -Value 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "fDenyTSConnections" -Value 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "PortNumber" 3389 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "LanAdapter" 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "SecurityLayer" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "fAllowSecProtocolNegotiation" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "KeepAliveEnable" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "KeepAliveInterval" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "KeepAliveTimeout" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "fDisableAutoReconnect" 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "fInheritReconnectSame" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "fReconnectSame" 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "MaxInstanceCount" 4294967295 -Type DWord
Remove-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "SSLCertificateSHA1Hash"
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\DomainProfile' -name "EnableFirewall" -Value 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\PublicProfile' -name "EnableFirewall" -Value 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\Standardprofile' -name "EnableFirewall" -Value 1 -Type DWord
Enable-PSRemoting -force
netsh advfirewall firewall set rule dir=in name="Windows Remote Management (HTTP-In)" new enable=yes
netsh advfirewall firewall set rule dir=in name="Windows Remote Management (HTTP-In)" new enable=yes
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
netsh advfirewall firewall set rule dir=in name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes
bcdedit /set '{bootmgr}' integrityservices enable
bcdedit /set '{default}' device partition=C:
bcdedit /set '{default}' integrityservices enable
bcdedit /set '{default}' recoveryenabled Off
bcdedit /set '{default}' osdevice partition=C:
bcdedit /set '{default}' bootstatuspolicy IgnoreAllFailures
#Enable Serial Console Feature
bcdedit /set '{bootmgr}' displaybootmenu yes
bcdedit /set '{bootmgr}' timeout 10
bcdedit /set '{bootmgr}' bootems yes
bcdedit /ems '{current}' ON
bcdedit /emssettings EMSPORT:1 EMSBAUDRATE:115200
#Setup the Guest OS to collect a kernel dump on an OS crash event
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 2 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
#Setup the Guest OS to collect user mode dumps on a service crash event
mkdir c:\Crashdumps
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DumpFolder /t REG_EXPAND_SZ /d "c:\CrashDumps" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v CrashCount /t REG_DWORD /d 10 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DumpType /t REG_DWORD /d 2 /f
sc config WerSvc start= demand
winmgmt /verifyrepository
if not exist "C:\Windows\Temp\puppet.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.6.2.msi', 'C:\Windows\Temp\puppet.msi')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://downloads.puppetlabs.com/windows/puppet-3.8.7.msi', 'C:\Windows\Temp\puppet.msi')" <NUL
)
:: http://docs.puppetlabs.com/pe/latest/install_windows.html
......
rem install rsync
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
msiexec /qb /i C:\Windows\Temp\7z1900-x64.msi
pushd C:\Windows\Temp
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/rsync/rsync-3.1.0-1.tar.xz', 'C:\Windows\Temp\rsync-3.1.0-1.tar.xz')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar.xz"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar"
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://mirrors.kernel.org/sourceware/cygwin/x86_64/release/rsync/rsync-3.1.2-1.tar.xz', 'C:\Windows\Temp\rsync-3.1.2-1.tar.xz')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.2-1.tar.xz"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.2-1.tar"
copy /Y usr\bin\rsync.exe "C:\Program Files\OpenSSH\bin\rsync.exe"
rmdir /s /q usr
del rsync-3.1.0-1.tar
del rsync-3.1.2-1.tar
popd
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
msiexec /qb /x C:\Windows\Temp\7z1900-x64.msi
rem make symlink for c:/vagrant share
mklink /D "C:\Program Files\OpenSSH\vagrant" "C:\vagrant"
net stop tiledatamodelsvc
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:a:\unattend.xml
if exist a:\unattend.xml (
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:a:\unattend.xml
) else (
del /F \Windows\System32\Sysprep\unattend.xml
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /quiet
)
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "Start-Sleep 5 ; (New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z1900-x64.msi
if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
......@@ -15,7 +18,7 @@ if exist "C:\Users\vagrant\windows.iso" (
)
if not exist "C:\Windows\Temp\windows.iso" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/14.1.1/7528167/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://softwareupdate.vmware.com/cds/vmw-desktop/ws/15.1.0/13591040/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
rd /S /Q "C:\Program Files (x86)\VMWare"
......@@ -24,8 +27,8 @@ if not exist "C:\Windows\Temp\windows.iso" (
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
rd /Q "C:\Windows\Temp\vmware-tools.tar"
rd /Q "C:\Windows\Temp\windows.iso"
del /Q "C:\Windows\Temp\vmware-tools.tar"
del /Q "C:\Windows\Temp\windows.iso"
rd /S /Q "C:\Windows\Temp\VMware"
goto :done
......@@ -36,13 +39,11 @@ if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
)
if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.2.8/VBoxGuestAdditions_5.2.8.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.virtualbox.org/virtualbox/6.0.8/VBoxGuestAdditions_6.0.8.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256-r3.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
cmd /c for %%i in (C:\Windows\Temp\virtualbox\cert\vbox*.cer) do C:\Windows\Temp\virtualbox\cert\VBoxCertUtil add-trusted-publisher %%i --root %%i
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done
......@@ -56,4 +57,4 @@ if exist "C:\Users\vagrant\prl-tools-win.iso" (
)
:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
msiexec /qb /x C:\Windows\Temp\7z1900-x64.msi
......@@ -10,7 +10,7 @@ function LogWrite {
Param ([string]$logstring)
$now = Get-Date -format s
Add-Content $Logfile -value "$now $logstring"
Write-Host $logstring
Write-Output $logstring
}
function Check-ContinueRestartOrEnd() {
......@@ -31,10 +31,10 @@ function Check-ContinueRestartOrEnd() {
Install-WindowsUpdates
} elseif ($script:Cycles -gt $global:MaxCycles) {
LogWrite "Exceeded Cycle Count - Stopping"
Invoke-Expression "a:\enable-winrm.ps1"
& "a:\enable-winrm.ps1"
} else {
LogWrite "Done Installing Windows Updates"
Invoke-Expression "a:\enable-winrm.ps1"
& "a:\enable-winrm.ps1"
}
}
1 {
......@@ -64,7 +64,7 @@ function Install-WindowsUpdates() {
$CurrentUpdates = $SearchResult.Updates
while($script:i -lt $CurrentUpdates.Count -and $script:CycleUpdateCount -lt $MaxUpdatesPerCycle) {
$Update = $CurrentUpdates.Item($script:i)
if (($Update -ne $null) -and (!$Update.IsDownloaded)) {
if ($null -ne $Update) {
[bool]$addThisUpdate = $false
if ($Update.InstallationBehavior.CanRequestUserInput) {
LogWrite "> Skipping: $($Update.Title) because it requires user input"
......@@ -126,7 +126,7 @@ function Install-WindowsUpdates() {
LogWrite 'No updates available to install...'
$global:MoreUpdates=0
$global:RestartRequired=0
Invoke-Expression "a:\enable-winrm.ps1"
& "a:\enable-winrm.ps1"
break
}
......@@ -165,13 +165,7 @@ function Install-WindowsUpdates() {
function Check-WindowsUpdates() {
LogWrite "Checking For Windows Updates"
$Username = $env:USERDOMAIN + "\" + $env:USERNAME
New-EventLog -Source $ScriptName -LogName 'Windows Powershell' -ErrorAction SilentlyContinue
$Message = "Script: " + $ScriptPath + "`nScript User: " + $Username + "`nStarted: " + (Get-Date).toString()
Write-EventLog -LogName 'Windows Powershell' -Source $ScriptName -EventID "104" -EntryType "Information" -Message $Message
LogWrite $Message
LogWrite "Script: " + $ScriptPath + "`nScript User: " + $Username + "`nStarted: " + (Get-Date).toString()
$script:UpdateSearcher = $script:UpdateSession.CreateUpdateSearcher()
$script:successful = $FALSE
......
......@@ -8,6 +8,7 @@ $env:PACKER_AZURE_APP_ID="dummy"
$env:PACKER_AZURE_CLIENT_SECRET="dummy"
$env:PACKER_AZURE_RESOURCE_GROUP="dummy"
$env:PACKER_AZURE_STORAGE_ACCOUNT="dummy"
$env:AWS_S3_BUCKET="dummy"
$files = @(Get-ChildItem *.json)
......
# convert-vhd -Path C:\Users\packer\AppData\Local\Temp\packerhv238285888\WindowsServer2019Docker.vhdx -DestinationPath C:\Users\packer\Desktop\Win2019Docker.vhd -VHDType Fixed
# Install-Module -Name AzureRM
Import-Module AzureRM
# Connect to Azure with an interactive dialog for sign-in
# Connect-AzureRmAccount
# Select-AzureRmSubscription -Subscription "Microsoft Azure Sponsorship"
$resourceGroup = 'chocolateyfest-docker-workshop-images'
$location = 'WestUS2'
# New-AzureRmResourceGroup -Name $resourceGroup -Location $location
$storageaccount = 'chocolateyfestsa'
$storageType = 'Standard_LRS'
$containername = 'vhds'
New-AzureRmStorageAccount -ResourceGroupName $resourceGroup -Name $storageAccount -Location $location `
-SkuName $storageType -Kind "Storage"
$vhdName = 'windows_2019_docker_azure.vhd'
$urlOfUploadedImageVhd = ('https://' + $storageaccount + '.blob.core.windows.net/' + $containername + '/' + $vhdName)
Add-AzureRmVhd -ResourceGroupName $resourceGroup -Destination $urlOfUploadedImageVhd `
-LocalFilePath 'D:\work\output-hyperv-iso\Virtual Hard Disks\WindowsServer2019Docker.vhd'
$imageName="windows_2019_docker_17763"
$imageConfig = New-AzureRmImageConfig -Location $location
$imageConfig = Set-AzureRmImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized `
-BlobUri $urlOfUploadedImageVhd
$image = New-AzureRmImage -ImageName $imageName -ResourceGroupName $resourceGroup -Image $imageConfig
# $diskSizeGB = '128'
# $subnetName = 'mySubnet'
# $vnetName = 'myVnet'
# $ipName = 'myPip'
# $nicName = 'myNic'
# $nsgName = 'myNsg'
# $ruleName = 'myRdpRule'
# $computerName = 'myComputerName'
# $vmName = 'myVM'
# $vmSize = 'Standard_D4_v3'
# $cred = Get-Credential
# $singleSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
# $vnet = New-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroup -Location $location `
# -AddressPrefix 10.0.0.0/16 -Subnet $singleSubnet
# $pip = New-AzureRmPublicIpAddress -Name $ipName -ResourceGroupName $resourceGroup -Location $location `
# -AllocationMethod Dynamic
# $rdpRule = New-AzureRmNetworkSecurityRuleConfig -Name $ruleName -Description 'Allow RDP' -Access Allow `
# -Protocol Tcp -Direction Inbound -Priority 110 -SourceAddressPrefix Internet -SourcePortRange * `
# -DestinationAddressPrefix * -DestinationPortRange 3389
# $nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $resourceGroup -Location $location `
# -Name $nsgName -SecurityRules $rdpRule
# $nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $resourceGroup -Location $location `
# -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id -NetworkSecurityGroupId $nsg.Id
# $vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroup -Name $vnetName
# $vm = New-AzureRmVMConfig -VMName $vmName -VMSize $vmSize
# Set the VM image as source image for the new VM
# $vm = Set-AzureRmVMSourceImage -VM $vm -Id $image.Id
# Finish the VM configuration and add the NIC.
# $vm = Set-AzureRmVMOSDisk -VM $vm -DiskSizeInGB $diskSizeGB -CreateOption FromImage -Caching ReadWrite
# $vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $computerName -Credential $cred `
# -ProvisionVMAgent -EnableAutoUpdate
# $vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
# Create the VM
# New-AzureRmVM -VM $vm -ResourceGroupName $resourceGroup -Location $location
# $vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $computerName -Credential $cred `
# -ProvisionVMAgent -EnableAutoUpdate
# $vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
# Create the VM
# New-AzureRmVM -VM $vm -ResourceGroupName $resourceGroup -Location $location
......@@ -64,6 +64,6 @@ Vagrant.configure("2") do |config|
config.vm.provider "hyperv" do |v|
v.cpus = 2
v.maxmemory = 2048
v.differencing_disk = true
v.linked_clone = true
end
end
......@@ -43,7 +43,7 @@ Vagrant.configure("2") do |config|
v.vmx["sound.startconnected"] = "FALSE"
v.vmx["sound.present"] = "FALSE"
v.vmx["sound.autodetect"] = "TRUE"
v.vms["virtualhw.version"] = "11"
v.vmx["virtualhw.version"] = "14"
v.enable_vmrun_ip_lookup = false
v.whitelist_verified = true
v.vmx["hgfs.linkRootShare"] = "FALSE"
......
......@@ -34,7 +34,7 @@ Vagrant.configure("2") do |config|
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
v.vms["virtualhw.version"] = "11"
v.vmx["virtualhw.version"] = "14"
v.enable_vmrun_ip_lookup = false
v.whitelist_verified = true
v.vmx["hgfs.linkRootShare"] = "FALSE"
......@@ -56,6 +56,6 @@ Vagrant.configure("2") do |config|
config.vm.provider "hyperv" do |v|
v.cpus = 2
v.maxmemory = 2048
v.differencing_disk = true
v.linked_clone = true
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version ">= 1.6.2"
Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows-2019"
config.vm.box = "windows_2019"
config.vm.communicator = "winrm"
# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.provider :virtualbox do |v, override|
v.gui = true
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["modifyvm", :id, "--vram", 128]
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
end
config.vm.provider :vmware_fusion do |v, override|
#v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
v.vmx["virtualhw.version"] = "14"
v.enable_vmrun_ip_lookup = false
v.whitelist_verified = true
v.vmx["hgfs.linkRootShare"] = "FALSE"
end
config.vm.provider :vmware_workstation do |v, override|
#v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
v.enable_vmrun_ip_lookup = false
v.whitelist_verified = true
v.vmx["hgfs.linkRootShare"] = "FALSE"
end
config.vm.provider "hyperv" do |v|
v.cpus = 2
v.maxmemory = 2048
v.linked_clone = true
end
end
#!/bin/bash
for template in $(ls -1 *.json); do
echo $template
packer validate --only=vmware-iso --only=virtualbox-iso $template
done
......@@ -3,7 +3,7 @@
{
"boot_wait": "6m",
"communicator": "winrm",
"cpu": "2",
"cpus": "2",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
......@@ -20,7 +20,7 @@
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"ram_size": "2048",
"memory": "2048",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"switch_name": "{{user `switch_name`}}",
"type": "hyperv-iso",
......@@ -33,6 +33,8 @@
"boot_command": "",
"boot_wait": "6m",
"communicator": "winrm",
"cpus": 2,
"disk_adapter_type": "lsisas1068",
"disk_size": "{{user `disk_size`}}",
"disk_type_id": "{{user `disk_type_id`}}",
"floppy_files": [
......@@ -51,16 +53,14 @@
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"memory": 2048,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"type": "vmware-iso",
"version": 12,
"version": 14,
"vm_name": "windows_10",
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
"RemoteDisplay.vnc.port": "5900",
"memsize": "2048",
"numvcpus": "2",
"scsi0.virtualDev": "lsisas1068"
"RemoteDisplay.vnc.port": "5900"
},
"vmx_remove_ethernet_interfaces": true,
"vnc_port_max": 5980,
......@@ -73,6 +73,7 @@
"boot_command": "",
"boot_wait": "6m",
"communicator": "winrm",
"cpus": 2,
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
......@@ -91,22 +92,9 @@
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"memory": 2048,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
],
"vm_name": "windows_10",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
......@@ -167,10 +155,10 @@
"disk_size": "61440",
"disk_type_id": "1",
"headless": "false",
"iso_checksum": "3d39dd9bd37db5b3c80801ae44003802a9c770a7400a1b33027ca474a1a7c691",
"iso_checksum": "ab4862ba7d1644c27f27516d24cb21e6b39234eb3301e5f1fb365a78b22f79b3",
"iso_checksum_type": "sha256",
"iso_url": "http://care.dlservice.microsoft.com/dl/download/6/5/D/65D18931-F626-4A35-AD5B-F5DA41FE6B76/16299.15.170928-1534.rs3_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
"restart_timeout": "55m",
"iso_url": "https://software-download.microsoft.com/download/pr/18362.30.190401-1528.19h1_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
"restart_timeout": "5m",
"vhv_enable": "false",
"winrm_timeout": "6h"
}
......
{
"builders": [
{
"boot_command": "",
"boot_wait": "5s",
"communicator": "winrm",
"headless": false,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"source_path": "{{user `source_path`}}",
"type": "vmware-vmx",
"vm_name": "windows_10_docker",
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
"RemoteDisplay.vnc.port": "5900",
"memsize": "2048",
"numvcpus": "2",
"scsi0.virtualDev": "lsisas1068"
},
"vmx_remove_ethernet_interfaces": true,
"vnc_port_max": 5980,
"vnc_port_min": 5900,
"winrm_password": "vagrant",
"winrm_timeout": "15m",
"winrm_username": "vagrant"
}
],
"post-processors": [
{
"keep_input_artifact": false,
"output": "windows_10_docker_{{.Provider}}.box",
"type": "vagrant",
"vagrantfile_template": "vagrantfile-windows_10.template"
}
],
"provisioners": [
{
"scripts": [
"./scripts/docker/10/install-containers-feature.ps1"
],
"type": "powershell"
},
{
"type": "windows-restart"
},
{
"environment_vars": [
"docker_images={{user `docker_images`}}",
"docker_provider={{user `docker_provider`}}",
"docker_version={{user `docker_version`}}"
],
"scripts": [
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/install-docker.ps1",
"./scripts/docker/docker-pull.ps1",
"./scripts/docker/open-docker-insecure-port.ps1",
"./scripts/docker/open-docker-swarm-ports.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
"./scripts/docker/disable-windows-defender.ps1"
],
"type": "powershell"
},
{
"scripts": [
"./scripts/uac-enable.bat",
"./scripts/set-winrm-automatic.bat",
"./scripts/compact.bat"
],
"type": "windows-shell"
}
],
"variables": {
"docker_images": "microsoft/windowsservercore microsoft/nanoserver",
"docker_provider": "ce",
"docker_version": "17.10.0",
"source_path": "path-to.vmx"
}
}
......@@ -4,6 +4,8 @@
"boot_command": "",
"boot_wait": "6m",
"communicator": "winrm",
"cpus": 2,
"disk_adapter_type": "lsisas1068",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
......@@ -21,15 +23,13 @@
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"memory": 2048,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"type": "vmware-iso",
"version": 12,
"version": 14,
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
"RemoteDisplay.vnc.port": "5900",
"memsize": "2048",
"numvcpus": "2",
"scsi0.virtualDev": "lsisas1068"
"RemoteDisplay.vnc.port": "5900"
},
"vmx_remove_ethernet_interfaces": true,
"vnc_port_max": 5980,
......@@ -42,6 +42,7 @@
"boot_command": "",
"boot_wait": "6m",
"communicator": "winrm",
"cpus": 2,
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
......@@ -60,22 +61,9 @@
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"memory": 2048,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
],
"winrm_password": "vagrant",
"winrm_timeout": "2h",
"winrm_username": "vagrant"
......@@ -86,7 +74,7 @@
],
"boot_wait": "1s",
"communicator": "winrm",
"cpu": 2,
"cpus": 2,
"disk_size": "{{user `disk_size`}}",
"enable_secure_boot": true,
"enable_virtualization_extensions": true,
......@@ -95,7 +83,7 @@
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"ram_size": 2048,
"memory": 2048,
"secondary_iso_images": [
"./iso/windows_10_insider_unattend.iso"
],
......@@ -158,9 +146,9 @@
"variables": {
"autounattend": "./answer_files/10_insider/Autounattend.xml",
"disk_size": "61440",
"iso_checksum": "CA0715B5646FBD18376F9A370BB1A2DF8A94DDB3F1BF107843C357E7DAD417FF",
"iso_checksum": "2b913368e4b18460755d1cf591ead881278a725c99541a10df899437cce0e119",
"iso_checksum_type": "sha256",
"iso_url": "https://software-download.microsoft.com/pr/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_16251.iso",
"iso_url": "https://software-download.microsoft.com/db/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_18343.iso",
"manually_download_iso_from": "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewadvanced"
}
}
......
......@@ -2,6 +2,8 @@
"builders": [
{
"boot_wait": "2m",
"cpus": 2,
"disk_adapter_type": "lsisas1068",
"disk_size": 131072,
"floppy_files": [
"./answer_files/2008_r2/Autounattend.xml",
......@@ -14,7 +16,8 @@
"headless": true,
"iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5",
"iso_checksum_type": "md5",
"iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso",
"iso_url": "https://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",
"memory": 2048,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"ssh_password": "vagrant",
"ssh_username": "vagrant",
......@@ -23,10 +26,7 @@
"type": "vmware-iso",
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
"RemoteDisplay.vnc.port": "5900",
"memsize": "2048",
"numvcpus": "2",
"scsi0.virtualDev": "lsisas1068"
"RemoteDisplay.vnc.port": "5900"
},
"vmx_remove_ethernet_interfaces": true,
"vnc_port_max": 5980,
......@@ -34,6 +34,7 @@
},
{
"boot_wait": "2m",
"cpus": 2,
"disk_size": 131072,
"floppy_files": [
"./answer_files/2008_r2/Autounattend.xml",
......@@ -46,26 +47,13 @@
"headless": false,
"iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5",
"iso_checksum_type": "md5",
"iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso",
"iso_url": "https://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",
"memory": 2048,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"ssh_password": "vagrant",
"ssh_username": "vagrant",
"ssh_wait_timeout": "6h",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
"type": "virtualbox-iso"
}
],
"post-processors": [
......
......@@ -2,6 +2,8 @@
"builders":