Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Bob Tanner
packer-windows
Commits
d3cf867d
Unverified
Commit
d3cf867d
authored
Sep 03, 2017
by
Stefan Scherer
Browse files
Shutdown windows_2016 with sysprep
parent
e88c9a83
Changes
4
Hide whitespace changes
Inline
Side-by-side
README-shutdown_command.md
View file @
d3cf867d
...
...
@@ -12,4 +12,19 @@ Replace it with
"shutdown_command"
:
"c:/windows/system32/sysprep/sysprep.exe /generalize /oobe /quiet /shutdown /unattend:a:/unattend.xml"
,
```
and on the first
`vagrant up`
the box will boot with an out-of-box-experience (OOBE)
Also make sure to add the
`./scripts/unattend.xml`
file to the
`floppy_files`
.
On the first
`vagrant up`
the box will boot with an out-of-box-experience (OOBE)
## Windows Server 2016
On newer systems like Windows 10 and Windows Server 2016 this shutdown_command is not enough.
We also have to stop the "tiledatamodelsvc" service to make sysprep work. So we use a small cmd script.
```
json
"shutdown_command"
:
"a:/sysprep.bat"
```
Also make sure to add the files
`./scripts/unattend.xml`
and
`./scripts/sysprep.bat`
to the
`floppy_files`
.
On the first
`vagrant up`
the box will boot with an out-of-box-experience (OOBE)
scripts/sysprep.bat
0 → 100644
View file @
d3cf867d
net
stop
tiledatamodelsvc
c
:\windows\system32\sysprep\sysprep.exe
/generalize /oobe /shutdown /unattend
:a
:\unattend.xml
scripts/unattend.xml
View file @
d3cf867d
...
...
@@ -34,7 +34,7 @@
</settings>
<settings
pass=
"specialize"
>
<component
name=
"Microsoft-Windows-Shell-Setup"
processorArchitecture=
"amd64"
publicKeyToken=
"31bf3856ad364e35"
language=
"neutral"
versionScope=
"nonSxS"
xmlns:wcm=
"http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<ComputerName>
vagrant
-2012
</ComputerName>
<ComputerName>
vagrant
</ComputerName>
<CopyProfile>
false
</CopyProfile>
</component>
</settings>
...
...
windows_2016.json
View file @
d3cf867d
...
...
@@ -11,25 +11,27 @@
"iso_checksum"
:
"{{user `iso_checksum`}}"
,
"floppy_files"
:
[
"{{user `autounattend`}}"
,
"./floppy/WindowsPowershell.lnk"
,
"./floppy/PinTo10.exe"
,
"./scripts/disable-screensaver.ps1"
,
"./scripts/disable-winrm.ps1"
,
"./scripts/enable-winrm.ps1"
,
"./scripts/microsoft-updates.bat"
,
"./scripts/unattend.xml"
,
"./scripts/sysprep.bat"
,
"./scripts/win-updates.ps1"
],
"communicator"
:
"winrm"
,
"winrm_username"
:
"vagrant"
,
"winrm_password"
:
"vagrant"
,
"winrm_timeout"
:
"
4
h"
,
"shutdown_command"
:
"
shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"winrm_timeout"
:
"
2
h"
,
"shutdown_command"
:
"
a:/sysprep.bat
"
,
"ram_size"
:
2048
,
"cpu"
:
2
,
"switch_name"
:
"{{user `hyperv_switchname`}}"
,
"enable_secure_boot"
:
true
"enable_secure_boot"
:
true
,
"enable_virtualization_extensions"
:
true
},
{
"vm_name"
:
"WindowsServer2016"
,
"type"
:
"vmware-iso"
,
"communicator"
:
"winrm"
,
"iso_url"
:
"{{user `iso_url`}}"
,
...
...
@@ -39,8 +41,8 @@
"boot_wait"
:
"2m"
,
"winrm_username"
:
"vagrant"
,
"winrm_password"
:
"vagrant"
,
"winrm_timeout"
:
"
6
h"
,
"shutdown_command"
:
"
shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"winrm_timeout"
:
"
2
h"
,
"shutdown_command"
:
"
a:/sysprep.bat
"
,
"guest_os_type"
:
"windows9srv-64"
,
"disk_size"
:
61440
,
"vnc_port_min"
:
5900
,
...
...
@@ -48,12 +50,12 @@
"version"
:
11
,
"floppy_files"
:
[
"{{user `autounattend`}}"
,
"./floppy/WindowsPowershell.lnk"
,
"./floppy/PinTo10.exe"
,
"./scripts/disable-screensaver.ps1"
,
"./scripts/disable-winrm.ps1"
,
"./scripts/enable-winrm.ps1"
,
"./scripts/microsoft-updates.bat"
,
"./scripts/unattend.xml"
,
"./scripts/sysprep.bat"
,
"./scripts/win-updates.ps1"
],
"vmx_data"
:
{
...
...
@@ -65,6 +67,7 @@
}
},
{
"vm_name"
:
"WindowsServer2016"
,
"type"
:
"virtualbox-iso"
,
"communicator"
:
"winrm"
,
"iso_url"
:
"{{user `iso_url`}}"
,
...
...
@@ -74,20 +77,20 @@
"boot_wait"
:
"2m"
,
"winrm_username"
:
"vagrant"
,
"winrm_password"
:
"vagrant"
,
"winrm_timeout"
:
"
6
h"
,
"shutdown_command"
:
"
shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"winrm_timeout"
:
"
2
h"
,
"shutdown_command"
:
"
a:/sysprep.bat
"
,
"guest_os_type"
:
"Windows2012_64"
,
"guest_additions_mode"
:
"disable"
,
"disk_size"
:
61440
,
"floppy_files"
:
[
"{{user `autounattend`}}"
,
"./floppy/WindowsPowershell.lnk"
,
"./floppy/PinTo10.exe"
,
"./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"
,
"./scripts/oracle-cert.cer"
],
"vboxmanage"
:
[
...
...
@@ -128,7 +131,6 @@
"type"
:
"windows-shell"
,
"execute_command"
:
"{{ .Vars }} cmd /c
\"
{{ .Path }}
\"
"
,
"scripts"
:
[
"./scripts/pin-powershell.bat"
,
"./scripts/set-winrm-automatic.bat"
,
"./scripts/compile-dotnet-assemblies.bat"
,
"./scripts/uac-enable.bat"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment