diff --git a/templates/windows-2008-amd64/Autounattend.xml b/templates/windows-2008-amd64/Autounattend.xml
index b6537fa0..f4f3d1fc 100644
--- a/templates/windows-2008-amd64/Autounattend.xml
+++ b/templates/windows-2008-amd64/Autounattend.xml
@@ -102,11 +102,22 @@
Install Win RM
1
+
+
+
+
+
- cmd.exe /c a:install-chefclient.bat
- Install Chef Client
+ cmd.exe /c a:install-cygwin-sshd.bat
+ Install Cygwin SSHD
2
+
+
+
+
+
+
false
diff --git a/templates/windows-2008-amd64/cygwin-setup.exe b/templates/windows-2008-amd64/cygwin-setup.exe
new file mode 100644
index 00000000..b2c5a583
Binary files /dev/null and b/templates/windows-2008-amd64/cygwin-setup.exe differ
diff --git a/templates/windows-2008-amd64/definition.rb b/templates/windows-2008-amd64/definition.rb
index 596eb123..1a277969 100644
--- a/templates/windows-2008-amd64/definition.rb
+++ b/templates/windows-2008-amd64/definition.rb
@@ -21,26 +21,34 @@
:memory_size=> '384',
:disk_size => '20280', :disk_format => 'VDI', :hostiocache => 'off',
+
+ #:kickstart_port => "7122",
+ #:kickstart_ip => self.local_ip, we could set this manually, I wish we could push this to the
+ #:kickstart_timeout => 1000,
+ #:kickstart_file => ["VBoxWindowsAdditions-amd64.exe"],
+
:floppy_files => [
"Autounattend.xml", # automate install and setup winrm
- "cygwin-setup.exe",
- "install-cygwin-sshd.bat",
"install-winrm.bat",
- "oracle-cert.cer"],
+ "install-cygwin-sshd.bat",
+ "install-guest-additions.bat",
+ "cygwin-setup.exe",
+ "oracle-cert.cer"
+ ],
- :boot_wait => "40",
+ :boot_wait => "50",
# after 40 seconds, hit these keys to not enter a product key and fully automate the install
# if your machine is slower it may take more time
:boot_cmd_sequence => [
'',
'',
''
- ]
+ ],
:ssh_login_timeout => "10000",
# Actively attempt to ssh in for 10000 seconds
:ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
- :ssh_host_port => "7222", :ssh_guest_port => "22",
+ :ssh_host_port => "7233", :ssh_guest_port => "22",
# And run postinstall.sh for up to 10000 seconds
:postinstall_timeout => "10000",
:postinstall_files => ["postinstall.sh"],
diff --git a/templates/windows-2008-amd64/install-cygwin-sshd.bat b/templates/windows-2008-amd64/install-cygwin-sshd.bat
new file mode 100644
index 00000000..fb6ed7c6
--- /dev/null
+++ b/templates/windows-2008-amd64/install-cygwin-sshd.bat
@@ -0,0 +1,38 @@
+REM http://webcache.googleusercontent.com/search?q=cache:SjoPPpuQxuoJ:www.tcm.phy.cam.ac.uk/~mr349/cygwin_install.html+install+cygwin+ssh+commandline&cd=2&hl=nl&ct=clnk&gl=be&source=www.google.be
+
+REM create the cygwin directory
+cmd /c mkdir %SystemDrive%\cygwin
+copy a:cygwin-setup.exe %SystemDrive%\cygwin
+
+REM goto a temp directory
+cd %SystemDrive%\windows\temp
+
+REM run the installation
+cmd /c a:/cygwin-setup.exe -q -R %SystemDrive%\cygwin -P openssh,openssl,curl,cygrunsrv,wget,rebase,vim -s http://cygwin.mirrors.pair.com
+
+%SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin cygrunsrv -R sshd'
+
+REM /bin/ash is the right shell for this command
+cmd /c %SystemDrive%\cygwin\bin\ash -c /bin/rebaseall
+
+cmd /c %SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin mkgroup -l'>%SystemDrive%\cygwin\etc\group
+
+cmd /c %SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin mkpasswd -l'>%SystemDrive%\cygwin\etc\passwd
+
+%SystemDrive%\cygwin\usr\bin\sleep 1
+
+%SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/ssh-host-config -y -c "ntsecbinmode tty" -w "abc&&123!!" '
+
+%SystemDrive%\cygwin\usr\bin\sleep 2
+
+cmd /c if exist %Systemroot%\system32\netsh.exe netsh advfirewall firewall add rule name="SSHD" dir=in action=allow program="c:\cygwin\usr\sbin\sshd.exe" SSHD enable=yes
+
+cmd /c if exist %Systemroot%\system32\netsh.exe netsh advfirewall firewall add rule name="ssh" dir=in action=allow protocol=TCP localport=22
+
+%SystemDrive%\cygwin\usr\bin\sleep 2
+
+net start sshd
+
+# Fix corrupt recycle bin
+# http://www.winhelponline.com/blog/fix-corrupted-recycle-bin-windows-7-vista/
+cmd /c rd /s /q c:\$Recycle.bin
diff --git a/templates/windows-2008-amd64/install-guest-additions.bat b/templates/windows-2008-amd64/install-guest-additions.bat
new file mode 100644
index 00000000..ef0298ed
--- /dev/null
+++ b/templates/windows-2008-amd64/install-guest-additions.bat
@@ -0,0 +1,5 @@
+# with this, we can open the iso, and extract the VBoxWindowsAdditions.exe!
+# http://downloads.sourceforge.net/sevenzip/7z920.exe
+cmd /c certutil -addstore -f "TrustedPublisher" a:oracle-cert.cer
+cmd /c c:\cygwin\bin\wget https://s3-ap-southeast-1.amazonaws.com/vboxfan/4.1.8/VBoxWindowsAdditions-amd64.exe --no-check-certificate
+cmd /c .\VBoxWindowsAdditions-amd64.exe /S
diff --git a/templates/windows-2008-amd64/install-winrm.bat b/templates/windows-2008-amd64/install-winrm.bat
index 6eb4ab69..3e729c41 100644
--- a/templates/windows-2008-amd64/install-winrm.bat
+++ b/templates/windows-2008-amd64/install-winrm.bat
@@ -1,6 +1,11 @@
cmd /c winrm quickconfig -q
-cmd /c winrm quickconfig -transport:https
+cmd /c winrm quickconfig -transport:http
+cmd /c winrm set winrm/config @{MaxTimeoutms="1800000"}
cmd /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
cmd /c winrm set winrm/config/service @{AllowUnencrypted="true"}
cmd /c winrm set winrm/config/service/auth @{Basic="true"}
+cmd /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
cmd /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
+cmd /c netsh firewall add portopening TCP 5985 "Port 5985"
+cmd /c net stop winrm
+cmd /c net start winrm