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

Commit

Permalink
add Packer template for Windows XP
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Tarral committed May 4, 2018
1 parent c4a111f commit f092def
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 0 deletions.
52 changes: 52 additions & 0 deletions answer_files/xp/WINNT.SIF
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[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="QW4HD-DQCRG-HM64M-6GJRK-8K83T"
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 cscript a:\extract_wget_zip.vbs"
Command2="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"
Command3="cmd /c start /w c:\temp\dotnet.exe /passive /norestart"
Command4="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"
Command5="cmd /c start /w c:\temp\winrm.exe /passive /norestart"
Command6="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
11 changes: 11 additions & 0 deletions scripts/setup_winrm.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
powershell.exe -Command "Enable-PSRemoting -Force"

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/service/auth @{Basic="true"}

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.
42 changes: 42 additions & 0 deletions winxp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"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": "vagrant",
"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"
]
}
],
"variables": {
"iso_url": "iso/en_windows_xp_professional_sp3_Nov_2013_Incl_SATA_Drivers.iso",
"iso_checksum_type": "sha256",
"iso_checksum": "3855a4049663edb2c7b7b11b448a86e01274a4d1a9bb49392420bdb61f830a0e",
"autounattend": "answer_files/xp/WINNT.SIF"
}
}

0 comments on commit f092def

Please sign in to comment.