Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Bob Tanner
packer-windows
Commits
06730010
Commit
06730010
authored
Nov 26, 2015
by
Stefan Scherer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to WinRM, install docker automatically
parent
45db7603
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
191 additions
and
138 deletions
+191
-138
answer_files/2016/Autounattend.xml
answer_files/2016/Autounattend.xml
+42
-96
scripts/2016/enable-winrm.ps1
scripts/2016/enable-winrm.ps1
+26
-0
scripts/install-containers.bat
scripts/install-containers.bat
+0
-9
scripts/install-docker.bat
scripts/install-docker.bat
+0
-11
scripts/install-docker.ps1
scripts/install-docker.ps1
+89
-0
scripts/set-winrm-automatic.bat
scripts/set-winrm-automatic.bat
+2
-0
windows_2016.json
windows_2016.json
+32
-22
No files found.
answer_files/2016/Autounattend.xml
View file @
06730010
<?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"
>
<component
name=
"Microsoft-Windows-International-Core-WinPE"
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"
>
<SetupUILanguage>
<UILanguage>
en-US
</UILanguage>
</SetupUILanguage>
...
...
@@ -11,7 +11,7 @@
<UILanguageFallback>
en-US
</UILanguageFallback>
<UserLocale>
de-DE
</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"
>
<component
name=
"Microsoft-Windows-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"
>
<DiskConfiguration>
<Disk
wcm:action=
"add"
>
<CreatePartitions>
...
...
@@ -66,7 +66,7 @@
<!-- Do not uncomment the Key element if you are using trial ISOs -->
<!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs -->
<!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>-->
<WillShowUI>
Neve
r
</WillShowUI>
<WillShowUI>
OnErro
r
</WillShowUI>
</ProductKey>
<AcceptEula>
true
</AcceptEula>
<FullName>
Vagrant
</FullName>
...
...
@@ -75,7 +75,7 @@
</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"
>
<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"
>
<OEMInformation>
<HelpCustomized>
false
</HelpCustomized>
</OEMInformation>
...
...
@@ -83,22 +83,41 @@
<TimeZone>
W. Europe 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"
>
<component
name=
"Microsoft-Windows-ServerManager-SvrMgrNc"
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"
>
<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"
>
<component
name=
"Microsoft-Windows-IE-ESC"
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"
>
<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"
>
<component
name=
"Microsoft-Windows-OutOfBoxExperience"
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"
>
<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"
>
<component
name=
"Microsoft-Windows-Security-SPP-UX"
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"
>
<SkipAutoActivation>
true
</SkipAutoActivation>
</component>
<component
name=
"Microsoft-Windows-Deployment"
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"
>
<RunSynchronous>
<RunSynchronousCommand
wcm:action=
"add"
>
<Order>
1
</Order>
<Description>
Set Execution Policy 64 Bit
</Description>
<Path>
cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"
</Path>
</RunSynchronousCommand>
<RunSynchronousCommand
wcm:action=
"add"
>
<Order>
2
</Order>
<Description>
Set Execution Policy 32 Bit
</Description>
<Path>
cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"
</Path>
</RunSynchronousCommand>
<RunSynchronousCommand
wcm:action=
"add"
>
<Order>
3
</Order>
<Description>
Disable WinRM
</Description>
<Path>
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\disable-winrm.ps1
</Path>
</RunSynchronousCommand>
</RunSynchronous>
</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"
>
<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"
>
<AutoLogon>
<Password>
<Value>
vagrant
</Value>
...
...
@@ -121,125 +140,52 @@
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm quickconfig -q
</CommandLine>
<Description>
winrm quickconfig -q
</Description>
<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>
cmd.exe /c winrm quickconfig -transport:http
</CommandLine>
<Description>
winrm quickconfig -transport:http
</Description>
<Order>
4
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
</CommandLine>
<Description>
Win RM MaxTimoutms
</Description>
<Order>
5
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="800"}
</CommandLine>
<Description>
Win RM MaxMemoryPerShellMB
</Description>
<Order>
6
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}
</CommandLine>
<Description>
Win RM AllowUnencrypted
</Description>
<Order>
7
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}
</CommandLine>
<Description>
Win RM auth Basic
</Description>
<Order>
8
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}
</CommandLine>
<Description>
Win RM client auth Basic
</Description>
<Order>
9
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
</CommandLine>
<Description>
Win RM listener Address/Port
</Description>
<Order>
10
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
</CommandLine>
<Description>
Win RM adv firewall enable
</Description>
<Order>
11
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985"
</CommandLine>
<Description>
Win RM port open
</Description>
<Order>
12
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c net stop winrm
</CommandLine>
<Description>
Stop Win RM Service
</Description>
<Order>
13
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c sc config winrm start= auto
</CommandLine>
<Description>
Win RM Autostart
</Description>
<Order>
14
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c net start winrm
</CommandLine>
<Description>
Start Win RM Service
</Description>
<Order>
15
</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>
16
</Order>
<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>
17
</Order>
<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>
18
</Order>
<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>
19
</Order>
<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>
20
</Order>
<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>
21
</Order>
<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>
22
</Order>
<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:\
openssh.ps1 -AutoStart
</CommandLine>
<Description>
Install OpenSSH
</Description>
<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>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
-->
<!-- END WITHOUT WINDOWS UPDATES -->
...
...
@@ -284,13 +230,13 @@
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<RegisteredOwner/>
<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"
>
<component
name=
"Microsoft-Windows-LUA-Settings"
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"
>
<EnableLUA>
false
</EnableLUA>
</component>
</settings>
<cpi:offlineImage
xmlns:cpi=
"urn:schemas-microsoft-com:cpi"
cpi:source=
"wim:c:/wim/install.wim#Windows Server 201
6
SERVERSTANDARD"
/>
<cpi:offlineImage
cpi:source=
"wim:c:/wim/install.wim#Windows Server 201
2 R2
SERVERSTANDARD"
xmlns:cpi=
"urn:schemas-microsoft-com:cpi"
/>
</unattend>
scripts/2016/enable-winrm.ps1
0 → 100644
View file @
06730010
Enable-PSRemoting
-Force
winrm
quickconfig
-q
winrm
quickconfig
-transport
:
http
winrm
set
winrm/config
'@{MaxTimeoutms="1800000"}'
winrm
set
winrm/config/winrs
'@{MaxMemoryPerShellMB="800"}'
winrm
set
winrm/config/service
'@{AllowUnencrypted="true"}'
winrm
set
winrm/config/service/auth
'@{Basic="true"}'
winrm
set
winrm/config/client/auth
'@{Basic="true"}'
winrm
set
winrm/config/listener
?
Address
=*+
Transport
=
HTTP
'@{Port="5985"}'
# Set-Service winrm -startuptype "auto"
# Restart-Service winrm
Write-Host
"Install Containers"
Install-WindowsFeature
-Name
Containers
Write-Host
"Install Hyper-V"
Install-WindowsFeature
-Name
Hyper-V
Stop-Service
winrm
.
sc.exe
config
winrm
start
=
delayed-auto
Sleep
30
netsh
advfirewall
firewall
set
rule
group
=
"Windows Remote Administration"
new
enable
=
yes
netsh
advfirewall
firewall
set
rule
name
=
"Windows Remote Management (HTTP-In)"
new
enable
=
yes
action
=
allow
Restart-Computer
scripts/install-containers.bat
deleted
100644 → 0
View file @
45db7603
powershell
.exe
-Command
"Install-WindowsFeature -Name Containers"
powershell
.exe
-Command
"Install-WindowsFeature -Name Hyper-V"
shutdown
/r /t
5
/f /d
p
:4:1
/c
"Reboot for Containters"
net
stop
winrm
net
stop
OpenSSHd
echo
Sleeping
while
restart
in
progress
ping
127
.0.0.1
-n
60
>
nul
scripts/install-docker.bat
deleted
100644 → 0
View file @
45db7603
rem https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/inplace_setup
powershell
.exe
-Command
"wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost-1.ps1"
rem patch the install script, see https://github.com/Microsoft/Virtualization-Documentation/pull/90
powershell
.exe
-Command
"cat C:\Install-ContainerHost-1.ps1 |
%%
{$_ -replace 'qfe =','qfe = 0 #'} | Set-Content C:\Install-ContainerHost.ps1"
powershell
.exe
-File
"C:\Install-ContainerHost.ps1"
-HyperV
echo
Done
with
%
0
rem https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/manage_docker
scripts/install-docker.ps1
0 → 100644
View file @
06730010
Set-Service
winrm
-startuptype
"auto"
# https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/inplace_setup
wget
-uri
https://aka.ms/tp4/Install-ContainerHost
-OutFile
C:\Install-ContainerHost-1.ps1
# patch the install script, see https://github.com/Microsoft/Virtualization-Documentation/pull/90
cat
C:\Install-ContainerHost-1.ps1
|
%
{
$_
-replace
'qfe ='
,
'qfe = 0 #'
}
|
Set-Content
C:\Install-ContainerHost.ps1
# create a Task Scheduler task which is also able to run in battery mode due
# to host notebooks working in battery mode. This complicates the whole script
# from a one liner to a fat XML - good heaven.
function
Run-Interactive
{
param
(
[
string
]
$commandline
)
$xml
=
@"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2014-03-27T13:53:05</Date>
<Author>vagrant</Author>
</RegistrationInfo>
<Triggers>
<TimeTrigger>
<StartBoundary>2014-03-27T00:00:00</StartBoundary>
<Enabled>true</Enabled>
</TimeTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>vagrant</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>powershell.exe</Command>
<Arguments>-Command
$commandline
</Arguments>
</Exec>
</Actions>
</Task>
"@
$XmlFile
=
$
env
:
Temp
+
"\InstallContainerHost.xml"
Write-Host
"Write Task '
$commandline
' to
$XmlFile
"
$xml
|
Out-File
$XmlFile
&
schtasks
/Delete
/F
/TN
InstallContainerHost
&
schtasks
/Create
/TN
InstallContainerHost
/XML
$XmlFile
&
schtasks
/Run
/TN
InstallContainerHost
Write-Host
"Waiting until Scheduled Task InstallContainerHost task is no longer running"
do
{
Start-Sleep
-Seconds
5
}
while
(
(
&
schtasks
/query
/tn
InstallContainerHost
|
Select-String
-Pattern
"InstallContainerHost"
-SimpleMatch
)
-like
"*Running*"
)
if
((
&
schtasks
/query
/tn
InstallContainerHost
|
Select-String
-Pattern
"InstallContainerHost"
-SimpleMatch
)
-like
"*Could not start*"
)
{
Write-Error
"Scheduled Task InstallContainerHost could not start!"
}
else
{
Write-Host
"Scheduled Task InstallContainerHost '
$commandline
' finished"
}
&
schtasks
/Delete
/F
/TN
InstallContainerHost
}
Run-Interactive
-commandline
"C:\Install-ContainerHost.ps1 -HyperV"
Run-Interactive
-commandline
"C:\Install-ContainerHost.ps1 -h"
# https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/manage_docker
scripts/set-winrm-automatic.bat
0 → 100644
View file @
06730010
echo
Set
WinRM
start
type
to
auto
sc
config
winrm
start
=
auto
windows_2016.json
View file @
06730010
...
...
@@ -2,26 +2,27 @@
"builders"
:
[
{
"type"
:
"vmware-iso"
,
"communicator"
:
"winrm"
,
"iso_url"
:
"https://aka.ms/tp4/serveriso"
,
"iso_checksum_type"
:
"md5"
,
"iso_checksum"
:
"935ba77651210bd1bd71a114c92b0caa"
,
"headless"
:
false
,
"boot_wait"
:
"6m"
,
"boot_command"
:
[
"<tab><enter>"
],
"
ssh
_username"
:
"vagrant"
,
"
ssh
_password"
:
"vagrant"
,
"
ssh_wait
_timeout"
:
"6h"
,
"
winrm
_username"
:
"vagrant"
,
"
winrm
_password"
:
"vagrant"
,
"
winrm
_timeout"
:
"6h"
,
"shutdown_command"
:
"shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"guest_os_type"
:
"windows8srv-64"
,
"tools_upload_flavor"
:
"windows"
,
"disk_size"
:
61440
,
"vnc_port_min"
:
5900
,
"vnc_port_max"
:
5980
,
"floppy_files"
:
[
"./answer_files/2016/Autounattend.xml"
,
"./scripts/disable-winrm.ps1"
,
"./scripts/2016/enable-winrm.ps1"
,
"./scripts/microsoft-updates.bat"
,
"./scripts/win-updates.ps1"
,
"./scripts/openssh.ps1"
"./scripts/win-updates.ps1"
],
"vmx_data"
:
{
"RemoteDisplay.vnc.enabled"
:
"false"
,
...
...
@@ -35,22 +36,26 @@
},
{
"type"
:
"virtualbox-iso"
,
"communicator"
:
"winrm"
,
"iso_url"
:
"https://aka.ms/tp4/serveriso"
,
"iso_checksum_type"
:
"md5"
,
"iso_checksum"
:
"935ba77651210bd1bd71a114c92b0caa"
,
"headless"
:
false
,
"boot_wait"
:
"2m"
,
"ssh_username"
:
"vagrant"
,
"ssh_password"
:
"vagrant"
,
"ssh_wait_timeout"
:
"6h"
,
"boot_wait"
:
"6m"
,
"boot_command"
:
[
"<tab><enter>"
],
"winrm_username"
:
"vagrant"
,
"winrm_password"
:
"vagrant"
,
"winrm_timeout"
:
"6h"
,
"shutdown_command"
:
"shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"guest_os_type"
:
"Windows2012_64"
,
"guest_additions_mode"
:
"disable"
,
"disk_size"
:
61440
,
"floppy_files"
:
[
"./answer_files/2016/Autounattend.xml"
,
"./scripts/disable-winrm.ps1"
,
"./scripts/2016/enable-winrm.ps1"
,
"./scripts/microsoft-updates.bat"
,
"./scripts/win-updates.ps1"
,
"./scripts/openssh.ps1"
,
"./scripts/oracle-cert.cer"
],
"vboxmanage"
:
[
...
...
@@ -71,24 +76,29 @@
],
"provisioners"
:
[
{
"type"
:
"shell"
,
"remote_path"
:
"/tmp/script.bat"
,
"execute_command"
:
"{{.Vars}} cmd /c C:/Windows/Temp/script.bat"
,
"type"
:
"windows-shell"
,
"execute_command"
:
"{{ .Vars }} cmd /c
\"
{{ .Path }}
\"
"
,
"scripts"
:
[
"./scripts/set-winrm-automatic.bat"
,
"./scripts/vm-guest-tools.bat"
,
"./scripts/vagrant-ssh.bat"
,
"./scripts/enable-rdp.bat"
,
"./scripts/install-containers.bat"
,
"./scripts/sleep.bat"
,
"./scripts/enable-rdp.bat"
]
},
{
"type"
:
"windows-restart"
},
{
"type"
:
"windows-shell"
,
"execute_command"
:
"{{ .Vars }} cmd /c
\"
{{ .Path }}
\"
"
,
"scripts"
:
[
"./scripts/wait-for-uplink.bat"
,
"./scripts/install-docker.bat"
,
"./scripts/uac-enable.bat"
]
},
{
"type"
:
"shell"
,
"
inline
"
:
[
"
rm -rf /tmp/*
"
"type"
:
"
power
shell"
,
"
scripts
"
:
[
"
./scripts/install-docker.ps1
"
]
}
],
...
...
Write
Preview
Markdown
is supported
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