...
 
Commits (27)
.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.
......@@ -31,13 +31,13 @@ The following Windows versions are known to work (built with VMware Fusion Pro
* Windows 10 1803 -> Vagrant Cloud box [StefanScherer/windows_10](https://app.vagrantup.com/StefanScherer/boxes/windows_10)
* Windows 10 Insider
* Windows Server 2016 Desktop -> Vagrant Cloud box [StefanScherer/windows_2016](https://app.vagrantup.com/StefanScherer/boxes/windows_2016)
* Windows Server 2019 Desktop (Insider Preview)
* 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 -> 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 without and with Docker
* Windows Server 1803 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.
......
......@@ -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>
......
......@@ -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>6XBNX-4JQGW-QX6QG-74P76-72V67</Key>
<!-- <Key>6XBNX-4JQGW-QX6QG-74P76-72V67</Key> -->
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
......
#!/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 \
......@@ -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_17744.iso \
--var iso_url=~/downloads/17763.1.180914-1434.rs5_release_SERVER_EVAL_x64FRE_en-us.iso \
windows_2019.json
......@@ -3,6 +3,6 @@
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_vNext_en-us_17744.iso \
--var "docker_images=mcr.microsoft.com/nanoserver-insider:10.0.17744.1001 mcr.microsoft.com/windowsservercore-insider:10.0.17744.1001 mcr.microsoft.com/windows-insider:10.0.17744.1001" \
--var iso_url=~/downloads/17763.1.180914-1434.rs5_release_SERVER_EVAL_x64FRE_en-us.iso \
--var "docker_images=mcr.microsoft.com/nanoserver:sac2019 mcr.microsoft.com/windowsservercore:ltsc2019 mcr.microsoft.com/windows:ltsc2019" \
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
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('http://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
......@@ -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 $_
}
# 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
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
)
......@@ -18,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('https://softwareupdate.vmware.com/cds/vmw-desktop/ws/14.1.3/9474260/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.0.0/10134415/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"
......@@ -39,7 +39,7 @@ 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.16/VBoxGuestAdditions_5.2.16.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.2.18/VBoxGuestAdditions_5.2.18.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"
......
......@@ -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
......@@ -183,9 +183,9 @@
"disk_size": "61440",
"disk_type_id": "1",
"headless": "false",
"iso_checksum": "27e4feb9102f7f2b21ebdb364587902a70842fb550204019d1a14b120918e455",
"iso_checksum": "a37718a13ecff4e8497e8feef50e4c91348e97c6bfe93474e364c9d03ad381a2",
"iso_checksum_type": "sha256",
"iso_url": "https://software-download.microsoft.com/download/pr/17134.1.180410-1804.rs4_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
"iso_url": "https://software-download.microsoft.com/download/pr/17763.1.180914-1434.rs5_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
"restart_timeout": "5m",
"vhv_enable": "false",
"winrm_timeout": "6h"
......
{
"builders": [
{
"boot_wait": "2m",
"communicator": "winrm",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1",
"./scripts/unattend.xml",
"./scripts/sysprep.bat"
],
"guest_additions_mode": "disable",
"guest_os_type": "Windows2016_64",
"headless": "{{user `headless`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"shutdown_command": "a:/sysprep.bat",
"format": "ova",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
],
"vm_name": "WindowsServer2016",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"winrm_username": "vagrant"
}
],
"post-processors": [
{
"keep_input_artifact": false,
"output": "windows_2016_{{.Provider}}.box",
"type": "vagrant",
"vagrantfile_template": "vagrantfile-windows_2016.template"
},
{
"type": "amazon-import",
"only": ["virtualbox-iso"],
"access_key": "",
"secret_key": "",
"region": "",
"ami_name": "packer_windows_2016",
"s3_bucket_name": "{{user `aws_s3_bucket_name`}}",
"keep_input_artifact": false,
"license_type": "BYOL",
"tags":
{
"Description": "packer-windows 2016 amazon-import {{timestamp}}"
}
}
],
"provisioners": [
{
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/enable-rdp.bat"
],
"type": "windows-shell"
},
{
"scripts": [
"./scripts/debloat-windows.ps1"
],
"type": "powershell"
},
{
"restart_timeout": "{{user `restart_timeout`}}",
"type": "windows-restart"
},
{
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/pin-powershell.bat",
"./scripts/set-winrm-automatic.bat",
"./scripts/uac-enable.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/dis-updates.bat",
"./scripts/compact.bat"
],
"type": "windows-shell"
}
],
"variables": {
"autounattend": "./answer_files/2016/Autounattend.xml",
"disk_size": "61440",
"disk_type_id": "1",
"headless": "false",
"iso_checksum": "70721288BBCDFE3239D8F8C0FAE55F1F",
"iso_checksum_type": "md5",
"iso_url": "https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO",
"restart_timeout": "5m",
"winrm_timeout": "4h",
"aws_s3_bucket_name": "{{env `AWS_S3_BUCKET`}}"
}
}
{
"builders": [
{
"boot_wait": "2m",
"communicator": "winrm",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
"guest_additions_mode": "disable",
"guest_os_type": "Windows2016_64",
"headless": "{{user `headless`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"format": "ova",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
],
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"winrm_username": "vagrant"
}
],
"post-processors": [
{
"keep_input_artifact": false,
"output": "windows_2016_core_{{.Provider}}.box",
"type": "vagrant",
"vagrantfile_template": "vagrantfile-windows_2016_core.template"
},
{
"type": "amazon-import",
"only": ["virtualbox-iso"],
"access_key": "",
"secret_key": "",
"region": "",
"ami_name": "packer_windows_2016_core",
"s3_bucket_name": "{{user `aws_s3_bucket_name`}}",
"keep_input_artifact": false,
"license_type": "BYOL",
"tags":
{
"Description": "packer-windows 2016 core amazon-import {{timestamp}}"
}
}
],
"provisioners": [
{
"scripts": [
"./scripts/enable-rdp.bat"
],
"type": "windows-shell"
},
{
"scripts": [
"./scripts/debloat-windows.ps1"
],
"type": "powershell"
},
{
"scripts": [
"./scripts/set-winrm-automatic.bat",
"./scripts/uac-enable.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/dis-updates.bat",
"./scripts/compact.bat"
],
"type": "windows-shell"
}
],
"variables": {
"autounattend": "./answer_files/2016_core/Autounattend.xml",
"disk_size": "61440",
"disk_type_id": "1",
"headless": "false",
"iso_checksum": "70721288BBCDFE3239D8F8C0FAE55F1F",
"iso_checksum_type": "md5",
"iso_url": "https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO",
"winrm_timeout": "6h",
"aws_s3_bucket_name": "{{env `AWS_S3_BUCKET`}}"
}
}
......@@ -156,9 +156,9 @@
"disk_type_id": "1",
"headless": "false",
"hyperv_switchname": "{{env `hyperv_switchname`}}",
"iso_checksum": "4dae6fed7bbb9a30a4e1453020bbaa39e88f37a2962bdf7bb81705cd9318f695",
"iso_checksum": "dbb0ffbab5d114ce7370784c4e24740191fefdb3349917c77a53ff953dd10f72",
"iso_checksum_type": "sha256",
"iso_url": "https://software-download.microsoft.com/db/Windows_InsiderPreview_Server_vNext_en-us_17744.iso",
"iso_url": "https://software-download.microsoft.com/download/pr/17763.1.180914-1434.rs5_release_SERVER_EVAL_x64FRE_en-us.iso",
"manually_download_iso_from": "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewserver",
"restart_timeout": "5m",
"winrm_timeout": "2h"
......
......@@ -138,9 +138,9 @@
"disk_size": "61440",
"disk_type_id": "1",
"headless": "false",
"iso_checksum": "4dae6fed7bbb9a30a4e1453020bbaa39e88f37a2962bdf7bb81705cd9318f695",
"iso_checksum": "dbb0ffbab5d114ce7370784c4e24740191fefdb3349917c77a53ff953dd10f72",
"iso_checksum_type": "sha256",
"iso_url": "https://software-download.microsoft.com/db/Windows_InsiderPreview_Server_vNext_en-us_17744.iso",
"iso_url": "https://software-download.microsoft.com/download/pr/17763.1.180914-1434.rs5_release_SERVER_EVAL_x64FRE_en-us.iso",
"manually_download_iso_from": "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewserver",
"winrm_timeout": "6h"
}
......
......@@ -170,13 +170,13 @@
"autounattend": "./answer_files/2019_core/Autounattend.xml",
"disk_size": "61440",
"disk_type_id": "1",
"docker_images": "mcr.microsoft.com/nanoserver-insider:10.0.17744.1001 mcr.microsoft.com/windowsservercore-insider:10.0.17744.1001 mcr.microsoft.com/windows-insider:10.0.17744.1001",
"docker_images": "mcr.microsoft.com/windows/nanoserver:1809 mcr.microsoft.com/windows/servercore:ltsc2019",
"docker_provider": "ee",
"docker_version": "18-03-1-ee-3",
"headless": "false",
"iso_checksum": "4dae6fed7bbb9a30a4e1453020bbaa39e88f37a2962bdf7bb81705cd9318f695",
"iso_checksum": "dbb0ffbab5d114ce7370784c4e24740191fefdb3349917c77a53ff953dd10f72",
"iso_checksum_type": "sha256",
"iso_url": "https://software-download.microsoft.com/db/Windows_InsiderPreview_Server_vNext_en-us_17744.iso",
"iso_url": "https://software-download.microsoft.com/download/pr/17763.1.180914-1434.rs5_release_SERVER_EVAL_x64FRE_en-us.iso",
"manually_download_iso_from": "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewserver",
"restart_timeout": "5m",
"vhv_enable": "false",
......
{
"builders": [
{
"boot_wait": "0s",
"communicator": "winrm",
"cpu": 2,
"differencing_disk": false,
"disk_size": "{{user `disk_size`}}",
"enable_secure_boot": true,
"enable_virtualization_extensions": true,
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/sysprep.bat",
"./scripts/win-updates.ps1"
],
"generation": 1,
"guest_additions_mode": "disable",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"ram_size": 2048,
"shutdown_command": "a:/sysprep.bat",
"skip_compaction": true,
"skip_export": true,
"switch_name": "{{user `hyperv_switchname`}}",
"type": "hyperv-iso",
"use_fixed_vhd_format": true,
"vm_name": "WindowsServer2019Docker",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"winrm_username": "vagrant"
}
],
"post-processors": [],
"provisioners": [
{
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/enable-rdp.bat"
],
"type": "windows-shell"
},
{
"scripts": [
"./scripts/debloat-windows.ps1",
"./scripts/docker/set-winrm-automatic.ps1"
],
"type": "powershell"
},
{
"restart_timeout": "{{user `restart_timeout`}}",
"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/wait-for-tiworker.ps1",
"./scripts/docker/open-docker-swarm-ports.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
"./scripts/docker/disable-windows-defender.ps1"
],
"type": "powershell"
},
{
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/pin-powershell.bat",
"./scripts/set-winrm-automatic.bat",
"./scripts/uac-enable.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/dis-updates.bat"
],
"type": "windows-shell"
},
{
"scripts": [
"./scripts/docker/chocolatey-and-tools.ps1",
"./scripts/prepare-for-upload-vhd-image.ps1"
],
"type": "powershell"
}
],
"variables": {
"autounattend": "./answer_files/2019/Autounattend.xml",
"disk_size": "51200",
"disk_type_id": "1",
"docker_images": "mcr.microsoft.com/windows/nanoserver:1809 mcr.microsoft.com/windows/servercore:ltsc2019",
"docker_provider": "ee",
"docker_version": "18-03-1-ee-3",
"headless": "false",
"hyperv_switchname": "{{env `hyperv_switchname`}}",
"iso_checksum": "dbb0ffbab5d114ce7370784c4e24740191fefdb3349917c77a53ff953dd10f72",
"iso_checksum_type": "sha256",
"iso_url": "https://software-download.microsoft.com/download/pr/17763.1.180914-1434.rs5_release_SERVER_EVAL_x64FRE_en-us.iso",
"manually_download_iso_from": "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewserver",
"restart_timeout": "5m",
"winrm_timeout": "2h"
}
}