Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

add Packer template for Windows XP #266

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions answer_files/xp/WINNT.SIF
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[Data]
Autopartition=1
MsDosInitiated=0
UnattendedInstall="Yes"

[Unattended]
Repartition=Yes
UnattendMode=FullUnattended
UnattendSwitch="Yes"
OemPreinstall="Yes"
OemSkipEula="Yes"
FileSystem=*
WaitForReboot="No"
NoWaitAfterTextMode=1
NoWaitAfterGUIMode=1
DriverSigningPolicy=Ignore
NonDriverSigningPolicy=Ignore

[GuiUnattended]
EncryptedAdminPassword="No"
AutoLogon="Yes"
AdminPassword="vagrant"
TimeZone=020
OEMSkipRegional=1
OemSkipWelcome=1

[Components]

[UserData]
ProductKey=""
ComputerName=vagrant
FullName="vagrant"
OrgName="vagrant"

[RegionalSettings]
LanguageGroup=1
Language="0409"

[Networking]
InstallDefaultComponents="Yes"

[Identification]
JoinWorkgroup="WORKGROUP"

[GuiRunOnce]
Command0="cmd /c mkdir c:\temp"
Command1="cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v forceguest /t REG_DWORD /d 0 /f"
Command2="cmd /c cscript a:\extract_wget_zip.vbs"
Command3="cmd /c c:\temp\bin\wget https://download.microsoft.com/download/0/8/c/08c19fa4-4c4f-4ffb-9d6c-150906578c9e/NetFx20SP1_x86.exe -O c:\temp\dotnet.exe --no-check-certificate"
Command4="cmd /c start /w c:\temp\dotnet.exe /passive /norestart"
Command5="cmd /c c:\temp\bin\wget https://download.microsoft.com/download/E/C/E/ECE99583-2003-455D-B681-68DB610B44A4/WindowsXP-KB968930-x86-ENG.exe -O c:\temp\winrm.exe --no-check-certificate"
Command6="cmd /c start /w c:\temp\winrm.exe /passive /norestart"
Command7="cmd /c a:\setup_winrm.bat"
17 changes: 17 additions & 0 deletions scripts/extract_wget_zip.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'The location of the zip file.
ZipFile="a:\wget-win32-static.zip"
'The folder the contents should be extracted to.
ExtractTo="c:\temp\"

'If the extraction location does not exist create it.
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If

'Extract the contants of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
14 changes: 14 additions & 0 deletions scripts/setup_winrm.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmd.exe /c winrm quickconfig -q
cmd.exe /c winrm quickconfig -transport:http
cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
cmd.exe /c winrm set winrm/config/winrs @{MaxConcurrentUsers="100"}
cmd.exe /c winrm set winrm/config/winrs @{MaxProcessesPerShell="100"}
cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="1024"}
cmd.exe /c winrm set winrm/config/winrs @{MaxShellsPerUser="100"}
cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}
cmd.exe /c winrm set winrm/config/client @{AllowUnencrypted="true"}
cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}
cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}
cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}

reg add "HKLM\SYSTEM\CurrentControlSet\services\WinRM" /v DelayedAutostart /t REG_DWORD /d 0 /f
Binary file added scripts/wget-win32-static.zip
Binary file not shown.
76 changes: 76 additions & 0 deletions winxp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"builders": [
{
"type": "qemu",
"accelerator": "kvm",
"vm_name": "winxp",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": true,
"skip_compaction": true,
"boot_wait": "2m",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_password": "vagrant",
"winrm_timeout": "8h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"disk_size": 20000,
"disk_interface": "ide",
"net_device": "rtl8139",
"http_directory": "http",
"http_port_min": 8500,
"http_port_max": 8500,
"qemuargs": [
[ "-smp", "2,sockets=1,cores=2,threads=1" ],
[ "-m", "1024" ]
],
"floppy_files": [
"{{user `autounattend`}}",
"scripts/wget-win32-static.zip",
"scripts/extract_wget_zip.vbs",
"scripts/setup_winrm.bat"
]
},
{
"type": "vmware-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": "{{user `headless`}}",
"boot_wait": "2m",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "8h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "winxppro",
"tools_upload_flavor": "windows",
"disk_adapter_type": "ide",
"disk_size": "{{user `disk_size`}}",
"vnc_port_min": 5900,
"vnc_port_max": 5980,
"floppy_files": [
"{{user `autounattend`}}",
"scripts/wget-win32-static.zip",
"scripts/extract_wget_zip.vbs",
"scripts/setup_winrm.bat"
],
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
"RemoteDisplay.vnc.port": "5900",
"memsize": "{{user `memory_size`}}",
"numvcpus": "{{user `cpus`}}"
}
}
],
"variables": {
"cpus": "2",
"memory_size": "2048",
"disk_size": "65535",
"headless": "true",
"iso_url": "",
"iso_checksum_type": "sha256",
"iso_checksum": "",
"autounattend": "answer_files/xp/WINNT.SIF"
}
}