Commit 69e106bb authored by Stefan Scherer's avatar Stefan Scherer
Browse files

Switch to WinRM

parent 2a4400a2
...@@ -29,8 +29,22 @@ ...@@ -29,8 +29,22 @@
</DiskConfiguration> </DiskConfiguration>
<UserData> <UserData>
<AcceptEula>true</AcceptEula> <AcceptEula>true</AcceptEula>
<FullName>Vagrant Administrator</FullName> <FullName>Vagrant</FullName>
<Organization>Vagrant Inc.</Organization> <Organization>Vagrant</Organization>
<!--
NOTE: If you are re-configuring this for use of a retail key
and using a retail ISO, you need to adjust the <ProductKey> block
below to look like this:
<ProductKey>
<Key>33PXH-7Y6KF-2VJC9-XBBR8-HVTHH</Key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
Notice the addition of the `<Key>` element.
-->
<!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx --> <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
<ProductKey> <ProductKey>
<WillShowUI>Never</WillShowUI> <WillShowUI>Never</WillShowUI>
...@@ -129,125 +143,52 @@ ...@@ -129,125 +143,52 @@
<RequiresUserInput>true</RequiresUserInput> <RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c winrm quickconfig -q</CommandLine> <CommandLine>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\disable-winrm.ps1</CommandLine>
<Description>winrm quickconfig -q</Description> <Description>Disable WinRM</Description>
<Order>5</Order> <Order>5</Order>
<RequiresUserInput>true</RequiresUserInput> <RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c winrm quickconfig -transport:http</CommandLine>
<Description>winrm quickconfig -transport:http</Description>
<Order>6</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>7</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>8</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>9</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>10</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>11</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>12</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>13</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>14</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c net stop winrm </CommandLine>
<Description>Stop Win RM Service </Description>
<Order>15</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>16</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c net start winrm</CommandLine>
<Description>Start Win RM Service</Description>
<Order>17</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add"> <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> <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine>
<Order>18</Order> <Order>6</Order>
<Description>Show file extensions in Explorer</Description> <Description>Show file extensions in Explorer</Description>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine> <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f</CommandLine>
<Order>19</Order> <Order>7</Order>
<Description>Enable QuickEdit mode</Description> <Description>Enable QuickEdit mode</Description>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <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> <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f</CommandLine>
<Order>20</Order> <Order>8</Order>
<Description>Show Run command in Start Menu</Description> <Description>Show Run command in Start Menu</Description>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <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> <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f</CommandLine>
<Order>21</Order> <Order>9</Order>
<Description>Show Administrative Tools in Start Menu</Description> <Description>Show Administrative Tools in Start Menu</Description>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine> <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f</CommandLine>
<Order>22</Order> <Order>10</Order>
<Description>Zero Hibernation File</Description> <Description>Zero Hibernation File</Description>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine> <CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f</CommandLine>
<Order>23</Order> <Order>11</Order>
<Description>Disable Hibernation Mode</Description> <Description>Disable Hibernation Mode</Description>
</SynchronousCommand> </SynchronousCommand>
<SynchronousCommand wcm:action="add"> <SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine> <CommandLine>cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE</CommandLine>
<Order>24</Order> <Order>12</Order>
<Description>Disable password expiration for vagrant user</Description> <Description>Disable password expiration for vagrant user</Description>
</SynchronousCommand> </SynchronousCommand>
<!-- WITHOUT WINDOWS UPDATES --> <!-- WITHOUT WINDOWS UPDATES -->
<!-- <!--
<SynchronousCommand wcm:action="add"> <SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine> <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\enable-winrm.ps1</CommandLine>
<Description>Install OpenSSH</Description> <Description>Enable WinRM</Description>
<Order>99</Order> <Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand> </SynchronousCommand>
--> -->
<!-- END WITHOUT WINDOWS UPDATES --> <!-- END WITHOUT WINDOWS UPDATES -->
......
...@@ -2,26 +2,27 @@ ...@@ -2,26 +2,27 @@
"builders": [ "builders": [
{ {
"type": "vmware-iso", "type": "vmware-iso",
"iso_url": "http://care.dlservice.microsoft.com/dl/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO", "communicator": "winrm",
"iso_checksum_type": "sha1", "iso_url": "{{user `iso_url`}}",
"iso_checksum": "56ab095075be28a90bc0b510835280975c6bb2ce", "iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false, "headless": false,
"boot_wait": "2m", "boot_wait": "2m",
"ssh_username": "vagrant", "winrm_username": "vagrant",
"ssh_password": "vagrant", "winrm_password": "vagrant",
"ssh_wait_timeout": "2h", "winrm_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "windows8srv-64", "guest_os_type": "windows8srv-64",
"tools_upload_flavor": "windows",
"disk_size": 61440, "disk_size": 61440,
"vnc_port_min": 5900, "vnc_port_min": 5900,
"vnc_port_max": 5980, "vnc_port_max": 5980,
"floppy_files": [ "floppy_files": [
"./answer_files/10/Autounattend.xml", "{{user `autounattend`}}",
"./scripts/fixnetwork.ps1", "./scripts/fixnetwork.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat", "./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1", "./scripts/win-updates.ps1"
"./scripts/openssh.ps1"
], ],
"vmx_data": { "vmx_data": {
"RemoteDisplay.vnc.enabled": "false", "RemoteDisplay.vnc.enabled": "false",
...@@ -33,23 +34,26 @@ ...@@ -33,23 +34,26 @@
}, },
{ {
"type": "virtualbox-iso", "type": "virtualbox-iso",
"iso_url": "http://care.dlservice.microsoft.com/dl/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO", "communicator": "winrm",
"iso_checksum_type": "sha1", "iso_url": "{{user `iso_url`}}",
"iso_checksum": "56ab095075be28a90bc0b510835280975c6bb2ce", "iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false, "headless": false,
"boot_wait": "2m", "boot_wait": "2m",
"ssh_username": "vagrant", "winrm_username": "vagrant",
"ssh_password": "vagrant", "winrm_password": "vagrant",
"ssh_wait_timeout": "2h", "winrm_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows81_64", "guest_os_type": "Windows81_64",
"guest_additions_mode": "disable",
"disk_size": 61440, "disk_size": 61440,
"floppy_files": [ "floppy_files": [
"./answer_files/10/Autounattend.xml", "{{user `autounattend`}}",
"./scripts/fixnetwork.ps1", "./scripts/fixnetwork.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat", "./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1", "./scripts/win-updates.ps1",
"./scripts/openssh.ps1",
"./scripts/oracle-cert.cer" "./scripts/oracle-cert.cer"
], ],
"vboxmanage": [ "vboxmanage": [
...@@ -70,13 +74,16 @@ ...@@ -70,13 +74,16 @@
], ],
"provisioners": [ "provisioners": [
{ {
"type": "shell", "type": "windows-restart"
},
{
"type": "windows-shell",
"remote_path": "/tmp/script.bat", "remote_path": "/tmp/script.bat",
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat", "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [ "scripts": [
"./scripts/vm-guest-tools.bat", "./scripts/vm-guest-tools.bat",
"./scripts/vagrant-ssh.bat",
"./scripts/enable-rdp.bat", "./scripts/enable-rdp.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/compact.bat" "./scripts/compact.bat"
] ]
} }
...@@ -88,5 +95,11 @@ ...@@ -88,5 +95,11 @@
"output": "windows_10_{{.Provider}}.box", "output": "windows_10_{{.Provider}}.box",
"vagrantfile_template": "vagrantfile-windows_10.template" "vagrantfile_template": "vagrantfile-windows_10.template"
} }
] ],
"variables": {
"iso_url": "http://care.dlservice.microsoft.com/dl/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO",
"iso_checksum_type": "sha1",
"iso_checksum": "56ab095075be28a90bc0b510835280975c6bb2ce",
"autounattend": "./answer_files/10/Autounattend.xml"
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment