diff --git a/answer_files/10_insider/Autounattend.xml b/answer_files/10_insider/Autounattend.xml new file mode 100644 index 00000000..a601af53 --- /dev/null +++ b/answer_files/10_insider/Autounattend.xml @@ -0,0 +1,209 @@ + + + + + + + + + + 1 + Primary + true + + + + + false + NTFS + C + 1 + 1 + + + + 0 + true + + OnError + + + true + Vagrant + Vagrant + + + + + 0 + 1 + + OnError + false + + + + + + en-US + + en-US + en-US + en-US + en-US + en-US + + + + + false + + + + + + + vagrant + true</PlainText> + </AdministratorPassword> + <LocalAccounts> + <LocalAccount wcm:action="add"> + <Password> + <Value>vagrant</Value> + <PlainText>true</PlainText> + </Password> + <Description>Vagrant User</Description> + <DisplayName>vagrant</DisplayName> + <Group>administrators</Group> + <Name>vagrant</Name> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Home</NetworkLocation> + <ProtectYourPC>1</ProtectYourPC> + </OOBE> + <AutoLogon> + <Password> + <Value>vagrant</Value> + <PlainText>true</PlainText> + </Password> + <Username>vagrant</Username> + <Enabled>true</Enabled> + </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>cmd.exe /c reg add "HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine> + <Description>Network prompt</Description> + <Order>3</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\fixnetwork.ps1</CommandLine> + <Description>Fix public network</Description> + <Order>4</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>5</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>6</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>7</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>8</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>9</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>10</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>11</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>12</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> + <ShowWindowsLive>false</ShowWindowsLive> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> + <OEMInformation> + <HelpCustomized>false</HelpCustomized> + </OEMInformation> + <!-- Rename computer here. --> + <ComputerName>vagrant-10</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-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> + <SkipAutoActivation>true</SkipAutoActivation> + </component> + </settings> + <cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="catalog:d:/sources/install_windows 7 ENTERPRISE.clg"/> +</unattend> diff --git a/build_windows_10.sh b/build_windows_10.sh index 9cb25d9a..87ba986b 100755 --- a/build_windows_10.sh +++ b/build_windows_10.sh @@ -2,4 +2,10 @@ #packer build --only=vmware-iso windows_10.json # my own license -packer build --only=vmware-iso --var iso_url=~/packer_cache/Win10_1607_English_x64.iso --var iso_checksum=99fd8082a609997ae97a514dca22becf20420891 --var autounattend=./tmp/10/Autounattend.xml windows_10.json +#packer build --only=vmware-iso --var iso_url=~/packer_cache/Win10_1607_English_x64.iso --var iso_checksum=99fd8082a609997ae97a514dca22becf20420891 --var autounattend=./tmp/10/Autounattend.xml windows_10.json + +# Windows 10 Insider 15002 +# packer build --only=vmware-iso --var iso_url=~/packer_cache/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_15002.iso --var iso_checksum=86fdf5c4061edde17a6aece0590225e6880b39ee --var autounattend=./tmp/10_insider/Autounattend.xml windows_10.json + +# Windows 10 Insider 15025 +packer build --only=vmware-iso --var iso_url=~/packer_cache/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_15025.iso windows_10_insider.json diff --git a/windows_10_insider.json b/windows_10_insider.json new file mode 100644 index 00000000..50932526 --- /dev/null +++ b/windows_10_insider.json @@ -0,0 +1,139 @@ +{ + "builders": [ + { + "type": "vmware-iso", + "communicator": "winrm", + "iso_url": "{{user `iso_url`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_checksum": "{{user `iso_checksum`}}", + "headless": false, + "boot_wait": "6m", + "boot_command": "", + "winrm_username": "vagrant", + "winrm_password": "vagrant", + "winrm_timeout": "2h", + "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", + "guest_os_type": "windows8srv-64", + "disk_size": "{{user `disk_size`}}", + "vnc_port_min": 5900, + "vnc_port_max": 5980, + "version": 11, + "floppy_files": [ + "{{user `autounattend`}}", + "./floppy/WindowsPowershell.lnk", + "./floppy/PinTo10.exe", + "./scripts/fixnetwork.ps1", + "./scripts/disable-screensaver.ps1", + "./scripts/disable-winrm.ps1", + "./scripts/enable-winrm.ps1", + "./scripts/microsoft-updates.bat", + "./scripts/win-updates.ps1" + ], + "vmx_data": { + "RemoteDisplay.vnc.enabled": "false", + "RemoteDisplay.vnc.port": "5900", + "memsize": "2048", + "numvcpus": "2", + "scsi0.virtualDev": "lsisas1068" + } + }, + { + "type": "virtualbox-iso", + "communicator": "winrm", + "iso_url": "{{user `iso_url`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_checksum": "{{user `iso_checksum`}}", + "headless": false, + "boot_wait": "6m", + "boot_command": "", + "winrm_username": "vagrant", + "winrm_password": "vagrant", + "winrm_timeout": "2h", + "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", + "guest_os_type": "Windows81_64", + "guest_additions_mode": "disable", + "disk_size": "{{user `disk_size`}}", + "floppy_files": [ + "{{user `autounattend`}}", + "./floppy/WindowsPowershell.lnk", + "./floppy/PinTo10.exe", + "./scripts/fixnetwork.ps1", + "./scripts/disable-screensaver.ps1", + "./scripts/disable-winrm.ps1", + "./scripts/enable-winrm.ps1", + "./scripts/microsoft-updates.bat", + "./scripts/win-updates.ps1", + "./scripts/oracle-cert.cer" + ], + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "2048" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "2" + ] + ] + } + ], + "provisioners": [ + { + "type": "windows-shell", + "remote_path": "/tmp/script.bat", + "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"", + "scripts": [ + "./scripts/vm-guest-tools.bat", + "./scripts/enable-rdp.bat" + ] + }, + { + "type": "powershell", + "scripts": [ + "./scripts/debloat-windows.ps1" + ] + }, + { + "type": "windows-restart" + }, + { + "type": "powershell", + "execute_command": "powershell \"& { {{.Vars}}{{.Path}}; exit $LastExitCode}\"", + "scripts": [ + "./scripts/set-powerplan.ps1", + "./scripts/docker/disable-windows-defender.ps1" + ] + }, + { + "type": "windows-shell", + "remote_path": "/tmp/script.bat", + "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"", + "scripts": [ + "./scripts/pin-powershell.bat", + "./scripts/compile-dotnet-assemblies.bat", + "./scripts/set-winrm-automatic.bat", + "./scripts/compact.bat" + ] + } + ], + "post-processors": [ + { + "type": "vagrant", + "keep_input_artifact": false, + "output": "windows_10_insider_{{.Provider}}.box", + "vagrantfile_template": "vagrantfile-windows_10.template" + } + ], + "variables": { + "manually_download_iso_from": "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewadvanced", + "iso_url": "https://software-download.microsoft.com/pr/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_15025.iso", + "iso_checksum_type": "sha1", + "iso_checksum": "801a0b25fa1e97587c9b2c2f7a6f9832bd61bb82", + "autounattend": "./answer_files/10_insider/Autounattend.xml", + "disk_size": "61440" + } +}