forked from StefanScherer/packer-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request StefanScherer#259 from StefanScherer/add-windows-2004
Add Windows Server, version 2004
- Loading branch information
Showing
4 changed files
with
384 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<unattend xmlns="urn:schemas-microsoft-com:unattend"> | ||
<settings pass="windowsPE"> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<SetupUILanguage> | ||
<UILanguage>en-US</UILanguage> | ||
</SetupUILanguage> | ||
<InputLocale>en-US</InputLocale> | ||
<SystemLocale>en-US</SystemLocale> | ||
<UILanguage>en-US</UILanguage> | ||
<UILanguageFallback>en-US</UILanguageFallback> | ||
<UserLocale>en-US</UserLocale> | ||
</component> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<DiskConfiguration> | ||
<Disk wcm:action="add"> | ||
<CreatePartitions> | ||
<CreatePartition wcm:action="add"> | ||
<Type>Primary</Type> | ||
<Order>1</Order> | ||
<Size>350</Size> | ||
</CreatePartition> | ||
<CreatePartition wcm:action="add"> | ||
<Order>2</Order> | ||
<Type>Primary</Type> | ||
<Extend>true</Extend> | ||
</CreatePartition> | ||
</CreatePartitions> | ||
<ModifyPartitions> | ||
<ModifyPartition wcm:action="add"> | ||
<Active>true</Active> | ||
<Format>NTFS</Format> | ||
<Label>boot</Label> | ||
<Order>1</Order> | ||
<PartitionID>1</PartitionID> | ||
</ModifyPartition> | ||
<ModifyPartition wcm:action="add"> | ||
<Format>NTFS</Format> | ||
<Label>Windows 2004</Label> | ||
<Letter>C</Letter> | ||
<Order>2</Order> | ||
<PartitionID>2</PartitionID> | ||
</ModifyPartition> | ||
</ModifyPartitions> | ||
<DiskID>0</DiskID> | ||
<WillWipeDisk>true</WillWipeDisk> | ||
</Disk> | ||
</DiskConfiguration> | ||
<ImageInstall> | ||
<OSImage> | ||
<InstallFrom> | ||
<MetaData wcm:action="add"> | ||
<Key>/IMAGE/INDEX</Key> | ||
<Value>2</Value> | ||
</MetaData> | ||
</InstallFrom> | ||
<InstallTo> | ||
<DiskID>0</DiskID> | ||
<PartitionID>2</PartitionID> | ||
</InstallTo> | ||
</OSImage> | ||
</ImageInstall> | ||
<UserData> | ||
<ProductKey> | ||
<!-- enter product key --> | ||
<Key></Key> | ||
<WillShowUI>OnError</WillShowUI> | ||
</ProductKey> | ||
<AcceptEula>true</AcceptEula> | ||
<FullName>Vagrant</FullName> | ||
<Organization>Vagrant</Organization> | ||
</UserData> | ||
</component> | ||
</settings> | ||
<settings pass="specialize"> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<OEMInformation> | ||
<HelpCustomized>false</HelpCustomized> | ||
</OEMInformation> | ||
<ComputerName>vagrant-2004</ComputerName> | ||
<TimeZone>Pacific Standard Time</TimeZone> | ||
<RegisteredOwner/> | ||
</component> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> | ||
</component> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<IEHardenAdmin>false</IEHardenAdmin> | ||
<IEHardenUser>false</IEHardenUser> | ||
</component> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> | ||
</component> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<SkipAutoActivation>true</SkipAutoActivation> | ||
</component> | ||
</settings> | ||
<settings pass="oobeSystem"> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<AutoLogon> | ||
<Password> | ||
<Value>vagrant</Value> | ||
<PlainText>true</PlainText> | ||
</Password> | ||
<Enabled>true</Enabled> | ||
<Username>vagrant</Username> | ||
</AutoLogon> | ||
<FirstLogonCommands> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine> | ||
<Description>Set Execution Policy 64 Bit</Description> | ||
<Order>1</Order> | ||
<RequiresUserInput>true</RequiresUserInput> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine> | ||
<Description>Set Execution Policy 32 Bit</Description> | ||
<Order>2</Order> | ||
<RequiresUserInput>true</RequiresUserInput> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\disable-winrm.ps1</CommandLine> | ||
<Description>Disable WinRM</Description> | ||
<Order>3</Order> | ||
<RequiresUserInput>true</RequiresUserInput> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> | ||
<Order>4</Order> | ||
<Description>Show file extensions in Explorer</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine> | ||
<Order>5</Order> | ||
<Description>Enable QuickEdit mode</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine> | ||
<Order>6</Order> | ||
<Description>Show Run command in Start Menu</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine> | ||
<Order>7</Order> | ||
<Description>Show Administrative Tools in Start Menu</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine> | ||
<Order>8</Order> | ||
<Description>Zero Hibernation File</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine> | ||
<Order>9</Order> | ||
<Description>Disable Hibernation Mode</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine> | ||
<Order>10</Order> | ||
<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> | ||
<Description>Enable Microsoft Updates</Description> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\disable-screensaver.ps1</CommandLine> | ||
<Description>Disable Screensaver</Description> | ||
<Order>99</Order> | ||
<RequiresUserInput>true</RequiresUserInput> | ||
</SynchronousCommand> | ||
<SynchronousCommand wcm:action="add"> | ||
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1</CommandLine> | ||
<Description>Install Windows Updates</Description> | ||
<Order>100</Order> | ||
<RequiresUserInput>true</RequiresUserInput> | ||
</SynchronousCommand> | ||
<!-- END WITH WINDOWS UPDATES --> | ||
</FirstLogonCommands> | ||
<OOBE> | ||
<HideEULAPage>true</HideEULAPage> | ||
<HideLocalAccountScreen>true</HideLocalAccountScreen> | ||
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> | ||
<HideOnlineAccountScreens>true</HideOnlineAccountScreens> | ||
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> | ||
<NetworkLocation>Home</NetworkLocation> | ||
<ProtectYourPC>1</ProtectYourPC> | ||
</OOBE> | ||
<UserAccounts> | ||
<AdministratorPassword> | ||
<Value>vagrant</Value> | ||
<PlainText>true</PlainText> | ||
</AdministratorPassword> | ||
<LocalAccounts> | ||
<LocalAccount wcm:action="add"> | ||
<Password> | ||
<Value>vagrant</Value> | ||
<PlainText>true</PlainText> | ||
</Password> | ||
<Group>administrators</Group> | ||
<DisplayName>Vagrant</DisplayName> | ||
<Name>vagrant</Name> | ||
<Description>Vagrant User</Description> | ||
</LocalAccount> | ||
</LocalAccounts> | ||
</UserAccounts> | ||
<RegisteredOwner/> | ||
</component> | ||
</settings> | ||
<settings pass="offlineServicing"> | ||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | ||
<EnableLUA>false</EnableLUA> | ||
</component> | ||
</settings> | ||
<cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="wim:c:/wim/install.wim#Windows Server 2016 SERVERSTANDARD"/> | ||
</unattend> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
#!/bin/bash | ||
packer build --only=vmware-iso --var iso_url=~/Downloads/17763.1.180914-1434.rs5_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso windows_10.json | ||
|
||
packer build --only=vmware-iso \ | ||
--var iso_url=~/packer_cache/msdn/de_windows_10_consumer_editions_version_2004_x64_dvd_7efdffc7.iso \ | ||
--var iso_checksum=908bca712c7f5ec5655882237aa447dde446e9a5e5178e2202ebae0157fd0d29 \ | ||
--var autounattend=tmp/10_pro_de/Autounattend.xml \ | ||
windows_10_insider.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"boot_wait": "60s", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_size": "{{user `disk_size`}}", | ||
"enable_secure_boot": true, | ||
"enable_virtualization_extensions": true, | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./floppy/WindowsPowershell.lnk", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/enable-winrm.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"guest_additions_mode": "disable", | ||
"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\"", | ||
"switch_name": "{{user `hyperv_switchname`}}", | ||
"type": "hyperv-iso", | ||
"vm_name": "WindowsServer2004", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
}, | ||
{ | ||
"boot_wait": "60s", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_adapter_type": "lsisas1068", | ||
"disk_size": "{{user `disk_size`}}", | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./floppy/WindowsPowershell.lnk", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/enable-winrm.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"guest_os_type": "windows9srv-64", | ||
"headless": "{{user `headless`}}", | ||
"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": 14, | ||
"vm_name": "WindowsServer2004", | ||
"vmx_data": { | ||
"RemoteDisplay.vnc.enabled": "false", | ||
"RemoteDisplay.vnc.port": "5900", | ||
"vhv.enable": "{{user `vhv_enable`}}" | ||
}, | ||
"vmx_remove_ethernet_interfaces": true, | ||
"vnc_port_max": 5980, | ||
"vnc_port_min": 5900, | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
}, | ||
{ | ||
"boot_wait": "60s", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_size": "{{user `disk_size`}}", | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./floppy/WindowsPowershell.lnk", | ||
"./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`}}", | ||
"memory": 2048, | ||
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", | ||
"type": "virtualbox-iso", | ||
"vm_name": "WindowsServer2004", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
} | ||
], | ||
"post-processors": [ | ||
{ | ||
"keep_input_artifact": false, | ||
"output": "windows_server_2004_{{.Provider}}.box", | ||
"type": "vagrant", | ||
"vagrantfile_template": "vagrantfile-windows_2019_core.template" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"", | ||
"scripts": [ | ||
"./scripts/vm-guest-tools.bat", | ||
"./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/set-winrm-automatic.bat", | ||
"./scripts/compile-dotnet-assemblies.bat", | ||
"./scripts/uac-enable.bat", | ||
"./scripts/compact.bat" | ||
], | ||
"type": "windows-shell" | ||
} | ||
], | ||
"variables": { | ||
"autounattend": "./answer_files/server_2004/Autounattend.xml", | ||
"disk_size": "61440", | ||
"disk_type_id": "1", | ||
"headless": "false", | ||
"iso_checksum": "f420a9b743b562382e9adadcff2b8b7e860ddcbbf23e2103544b160f4d1686fc", | ||
"iso_checksum_type": "sha256", | ||
"iso_url": "https://download.my.visualstudio.com/db/en_windows_server_version_2004_x64_dvd_765aeb22.iso", | ||
"manually_download_iso_from": "https://my.visualstudio.com/Downloads?q=Windows%20Server,%20version%202004", | ||
"restart_timeout": "5m", | ||
"vhv_enable": "false", | ||
"winrm_timeout": "2h" | ||
} | ||
} | ||
|