Skip to content

Commit

Permalink
windows-7-enterprise-amd64 now uses bitsadmin to download cygwin
Browse files Browse the repository at this point in the history
  • Loading branch information
hh committed Jan 5, 2012
1 parent 05c6b61 commit 1ff67f6
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 185 deletions.
1 change: 1 addition & 0 deletions templates/windows-7-enterprise-amd64/Autounattend.xml
Expand Up @@ -87,6 +87,7 @@
<HideEULAPage>true</HideEULAPage>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
</OOBE>
<AutoLogon>
<Password>
Expand Down
137 changes: 10 additions & 127 deletions templates/windows-7-enterprise-amd64/README.md
Expand Up @@ -20,79 +20,18 @@ Size : 11,913,037,777 bytes
The operation completed successfully.
'''

Though I have also used "Windows 7 7600 AIO.ISO" from MSDN
file: Windows 7 7600 AIO.ISO
md5sum: ace6c61269613bf515fd59c62185bbcf


'''
PS C:\Users\Administrator> Dism /Get-WIMInfo /WimFile:d:\sources\install.wim

Deployment Image Servicing and Management tool
Version: 6.1.7600.16385

Details for image : d:\sources\install.wim

Index : 1
Name : Windows 7 STARTER
Description : Windows 7 STARTER
Size : 7,936,340,784 bytes

Index : 2
Name : Windows 7 HOMEBASIC
Description : Windows 7 HOMEBASIC
Size : 7,992,394,907 bytes

Index : 3
Name : Windows 7 HOMEPREMIUM
Description : Windows 7 HOMEPREMIUM
Size : 8,432,859,356 bytes

Index : 4
Name : Windows 7 PROFESSIONAL
Description : Windows 7 PROFESSIONAL
Size : 8,313,318,889 bytes

Index : 5
Name : Windows 7 ULTIMATE
Description : Windows 7 ULTIMATE
Size : 8,471,060,645 bytes

Index : 6
Name : Windows 7 Home Basic X64
Description : Windows 7 HOMEBASIC
Size : 11,500,789,302 bytes

Index : 7
Name : Windows 7 Home Premium X64
Description : Windows 7 HOMEPREMIUM
Size : 12,012,660,212 bytes

Index : 8
Name : Windows 7 Home Professional X64
Description : Windows 7 PROFESSIONAL
Size : 11,910,752,928 bytes

Index : 9
Name : Windows 7 Home Ultimate X64
Description : Windows 7 ULTIMATE
Size : 12,070,211,908 bytes

The operation completed successfully.
'''

- place it in a directory called iso

The installation uses the Standard way for Windows Unattended installation. The XML file was created using the Windows AIK kit, but the file can also be edited by hand.
The installation uses the Standard way for Windows Unattended installation.
The XML file was created using the Windows AIK kit, but the file can also be edited by hand.

To edit the Autounattend.xml and validate it:

You can download The Windows® Automated Installation Kit (AIK) for Windows® 7:
url: http://www.microsoft.com/download/en/details.aspx?id=5753
file: KB3AIK_EN.iso
md5sum: 1e73b24a89eceab9d50585b92db5482f



- Building the machine creates a floppy that contains:
- AutoUnattend.xml (that will configure the windows)
- winrm-install.bat (activates the http and https listener + punches the firewall hole)
Expand All @@ -102,68 +41,12 @@ AIK also includes dism, which will allow you to choose a specific version:
If you want to install a different version, edit Autoattended.xml and replace the /IMAGE/NAME value with
one of the names listed in the sources/install.wim on the install DVD .iso

# <InstallFrom>
# <MetaData wcm:action="add">
# <Key>/IMAGE/NAME</Key>
# <Value>Windows Server 2008 R2 SERVERSTANDARD</Value>
# </MetaData>
# </InstallFrom>


This gets us nearly there, but we still need a winrm provisioner, as I don't like having to install cygwin.

Expose the winrm port:

<pre>
$ gem install chef
$ gem install knife-windows
#Create a tunnel
$ ssh -p 7222 -L5985:localhost:5985 vagrant@localhost
$ knife bootstrap windows winrm localhost -x Administrator -P 'vagrant'
</pre>


- http://wiki.opscode.com/display/chef/Knife+Windows+Bootstrap
- https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-shell.erb

- https://github.com/zenchild/WinRM

- http://devopscloud.net/2011/04/17/managing-chef-from-windows-7/
- http://devopscloud.net/2011/04/28/powershell-userdata-to-start-a-chef-run/
- http://devopscloud.net/2011/03/23/dissection-of-a-chef-recipe-or-two-for-windows/
- https://github.com/pmorton/chef-windows-installer

==
https://github.com/zenchild/WinRM/issues/unreads#issue/1
http -> requires unencryptedwinrm quickconfig (said yes to enable firewall)
winrm p winrm/config/service @{AllowUnencrypted="true"}
winrm set winrm/config/service/auth @{Basic="true"}netsh advfirewall firewall set rule group="remote administration" new enable=yes

- http://forums.citrix.com/thread.jspa?messageID=1535826
- http://support.microsoft.com/kb/2019527

winrm get winrm/config

The purpose of configuring WinRM for HTTPS is to encrypt the data being sent across the wire.

WinRM HTTPS requires a local computer "Server Authentication" certificate with a CN matching the hostname, that is not expired, revoked, or self-signed to be installed.

To install or view certificates for the local computer:

- click Start, run, MMC, "File" menu, "Add or Remove Snap-ins" select "Certificates" and click "Add". Go through the wizard selecting "Computer account".

- Install or view the certificates under:
Certificates (Local computer)
Personal
Certificates

If you do not have a Sever Authenticating certificate consult your certicate administrator. If you have a microsoft Certificate server you may be abel to request a certificate using the web certificate template from HTTPS://<MyDomainCertificateServer>/certsrv

Once the certificate is installed type the following to configure WINRM to listen on HTTPS:

winrm quickconfig -transport:https

If you do not have an appropriate certificate you can run the following with the authentication methods configured for WinRM however the data will not be encrypted.

winrm quickconfig

# Use the Name : from 'Dism.exe /Get-WIMInfo /WimFile:d:\sources\install.wim'
# <InstallFrom>
# <MetaData wcm:action="add">
# <Key>/IMAGE/NAME</Key>
# <Value>Windows 7 ENTERPRISE</Value>
# </MetaData>
# </InstallFrom>
Binary file not shown.
15 changes: 7 additions & 8 deletions templates/windows-7-enterprise-amd64/definition.rb
Expand Up @@ -7,9 +7,9 @@
# The 90-day Trial is offered for a limited time and in limited quantity.
# The download will be available through June 30th, 2012, while supplies last.
:iso_file => "7600.16385.090713-1255_x64fre_enterprise_en-us_EVAL_Eval_Enterprise-GRMCENXEVAL_EN_DVD.iso",
:iso_src => "http://wb.dlservice.microsoft.com/dl/download/release/Win7/3/b/a/3bac7d87-8ad2-4b7a-87b3-def36aee35fa/7600.16385.090713-1255_x64fre_enterprise_en-us_EVAL_Eval_Enterprise-GRMCENXEVAL_EN_DVD.iso?lcid=1033",
:iso_src => "http://wb.dlservice.microsoft.com/dl/download/release/Win7/3/b/a/3bac7d87-8ad2-4b7a-87b3-def36aee35fa/7600.16385.090713-1255_x64fre_enterprise_en-us_EVAL_Eval_Enterprise-GRMCENXEVAL_EN_DVD.iso",
:iso_md5 => "1d0d239a252cb53e466d39e752b17c28",
:iso_download_timeout => "10000",
:iso_download_timeout => "100000",

:cpu_count => '1',
:memory_size=> '512',
Expand All @@ -18,14 +18,13 @@
:floppy_files => [
"Autounattend.xml",
"install-winrm.bat",
"install-chefclient.bat"
"oracle-cert.cer",
"install-cygwin-sshd.bat"
],


:boot_wait => "660", #ten minutes, ten seconds
:boot_cmd_sequence => [
'<Tab><Spacebar><Tab><Tab><Tab><Spacebar>'
],
:boot_wait => "1", #12 minutes
:boot_cmd_sequence => [''],


:ssh_login_timeout => "10000",
Expand All @@ -38,5 +37,5 @@
# No sudo on windows
:sudo_cmd => "sh '%f'",
# Shutdown is different as well
:shutdown_cmd => "shutdown /p /t 60 /c \"Vagrant Shutdown\" /f /d p:4:1",
:shutdown_cmd => "shutdown /s /t 60 /c \"Vagrant Shutdown\" /f /d p:4:1",
})
44 changes: 0 additions & 44 deletions templates/windows-7-enterprise-amd64/install-chefclient.bat

This file was deleted.

7 changes: 3 additions & 4 deletions templates/windows-7-enterprise-amd64/install-cygwin-sshd.bat
Expand Up @@ -2,13 +2,14 @@ REM http://webcache.googleusercontent.com/search?q=cache:SjoPPpuQxuoJ:www.tcm.ph

REM create the cygwin directory
cmd /c mkdir %SystemDrive%\cygwin
copy a:\cygwin-setup.exe %SystemDrive%\cygwin

cmd /c bitsadmin /transfer CygwinSetupExe /download /priority normal http://www.cygwin.com/setup.exe %SystemDrive%\cygwin\cygwin-setup.exe

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
cmd /c %SystemDrive%\cygwin\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'

Expand Down Expand Up @@ -37,5 +38,3 @@ net start sshd
# http://www.winhelponline.com/blog/fix-corrupted-recycle-bin-windows-7-vista/
cmd /c rd /s /q c:\$Recycle.bin

copy a:\sudo %SystemDrive%\cygwin\usr\local\bin
cmd /c %SystemDrive%\cygwin\bin\chmod 755 %SystemDrive%\cygwin\usr\local\bin\sudo
3 changes: 3 additions & 0 deletions templates/windows-7-enterprise-amd64/install-winrm.bat
Expand Up @@ -9,3 +9,6 @@ cmd /c netsh advfirewall firewall set rule group="remote administration" new ena
cmd /c netsh firewall add portopening TCP 5985 "Port 5985"
cmd /c net stop winrm
cmd /c net start winrm

cmd /c reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f
cmd /c reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveIsSecure /t REG_SZ /d 0 /f
2 changes: 0 additions & 2 deletions templates/windows-7-enterprise-amd64/postinstall.sh
Expand Up @@ -67,8 +67,6 @@ chmod 755 /bin/sudo
# Mounting a directory
net.exe use '\\vboxsvr\veewee-validation'

reg add "HKEY_CURRENT_USER\Control Panel\Desktop" ScreenSaveActive /t REG_SZ /d 0 /f
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" ScreenSaveIsSecure /t REG_SZ /d 0 /f

# Reboot
# http://www.techrepublic.com/blog/datacenter/restart-windows-server-2003-from-the-command-line/245
Expand Down

0 comments on commit 1ff67f6

Please sign in to comment.