Friday, January 6, 2017

Building an Unattened ISO for Windows Server 2012



Found a great article on creating an unattended xml and creating an ISO from Ezra Undag post at:
https://medium.com/tech-jobs-academy/creating-a-windows-server-2012-r2-core-unattended-installation-iso-ab8071c03279#.dzuri1h35


The steps are as follows, but for more details, take a look at his post.

Procedure

I. Install Windows ADK
  1. Download and install Windows ADK for Windows 8.1. This works with Windows 8.1 and Windows Server 2012 R2.
  2. Start the installation process. Leave everything selected by default but make sure that Deployment Tools and Windows Preinstallation Environment(Windows PE) are selected.
Select the features you want to install Window Dialog
3. Finish the installation.
II. Create an answer file
  1. Open Windows System Image Manager by going to Start Menu > Apps List or by hitting Windows key + S combination keys and typing in “Windows System Image Manager”.
2. Mount the ISO file by double-clicking it or opening it via File Explorer. It displays a new drive indicated by a letter.
3. Go to sources directory and copy install.wim to a local drive, such as D.
4. Switch back to Windows System Image Manager. Click File Menu > Select Windows Image, locate the install.wim you copied.
5. Select the Windows Distribution to build an answer file for. We select Windows Server 2012 R2 SERVERDATACENTERCORE.
Select an image in the Windows image file
6. The Windows Image pane is populated with Components and Packages folders. Expand Components and scroll through until amd64_Microsoft-Windows-International-Core-WinPE_6.3.9600.16384_neutral. [..6.3.9600.16384_neutral] may differ on other Windows distributions. Right click on amd64_Microsoft-Windows-International-Core-WinPE_6.3.9600.16384_neutral and click Add Setting to Pass 1.
7. Under Answer File pane, collapse Components > 1 windowsPE and select amd64_Microsoft-Windows-International-Core-WinPE. Configure settings according to your requirements or the image shown below.
8. Collapse Components > 1 windowsPE > amd64_Microsoft-Windows-International-Core-WinPE and select SetupUILanguage. Configure settings according to your needed language or the image shown below. In this case, we use en-US(US English).
9. In this step, we configure disk partitions by scrolling through Windows Image pane under Components until amd64_Microsoft-Windows-Setup_6.3.9600.17031_neutral is found. [_6.3.9600.17031_neutral] may differ in other Windows distributions. Right click on amd64_Microsoft-Windows-Setup_6.3.9600.17031_neutral and click Add Setting to Pass 1.
10. Under Answer File pane, collapse Components > 1 windowsPE > amd64_Microsoft-Windows-Setup_neutral.
11. Under amd64_Microsoft-Windows-Setup_neutral, find DiskConfiguration and right click on it and select Insert New Disk.
12. In DiskConfiguration > Disk, right click on CreatePartitions and select Insert New CreatePartition. Configure the partition as shown in the image below. This partition becomes the System Reserved Partition which contains hardware-related files and the Boot folder that tell a computer where to look to start Windows. In Windows 7 and Windows Server 2008, the partition is 100MB. In Windows 8 and Windows Server 2012, it is 350MB.
13. Right click on CreatePartitions and select Insert New CreatePartition to create a second partition then set Extend to true. This means that the partition takes up the rest of the disk. This becomes our logical partition where the Operating System is installed.
14. Click on Disk under Disconfiguration. Set DiskID to 0 and WillWipeDisk to true. Disk 0 is generally the first disk in most computer systems where the Operating System resides.
15. Modify the System Reserved Partition by right-clicking on ModifyPartitions and selecting Insert New ModifyPartition. Configure settings as shown in the image below.
16. Modify the logical partition by right-clicking on ModifyPartitions and selecting Insert New ModifyPartition. Configure settings as shown in the image below.
17. Select ImageInstall and configure settings as shown in the image below. This means we do not install to the available partition because we are specifying it later.
18. Specify the OS to install. Collapse OSImage, right-click on InstallFrom and select Insert New MetaData. Collapse InstallFrom and select Metadata. Configure the settings as shown in the image below. Key field can be set to /IMAGE/NAME , /IMAGE/INDEX, or /IMAGE/DESCRIPTION. In this case, we use /IMAGE/NAME to correspond to the name of the Windows Distribution selected in step 5.
19. Set the Disk and Partition where OS will be installed. Select InstallTo and configure settings as shown in the image below.
20. Bypass EULA Dialog. Scroll down to find UserData and select it. Configure settings as shown in the image below. Fill up FullName and Organization if desired.
21. Configure UserData > ProductKey. This is not where we provide the product key. Leave empty as shown in the image below.
22. Set Computer name, product key, organization name and timezone. Scroll through Windows Image pane and find amd64_Microsoft-Windows-Shell-Setup_6.3.9600.17031_neutral, (6.3.9600.17031 may differ in other Window distributions) right-click on it and select Add Setting to Pass 4 specialize.
23. In Answer File pane, collapse 4 specialize and select amd64_Microsoft-Windows-Shell-Setup_neutral configure settings as shown in the image below. If desired to set random computer name during installation, set [ * ] (asterisk symbol) to ComputerName field. By default, TimeZone is set to Pacific Standard Time.
In this case, we are using an evaluation copy for Windows so we are leaving ProductKey empty.
24. In Windows Image pane, right-click on amd64_Microsoft-Windows-Shell-Setup_6.3.9600.17031_neutral and select Add Setting to Pass 7 oobeSystem to specify Out of Box Experience (oobe) settings.
25. In Answer File pane, select amd64_Microsoft-Windows-Shell-Setup_neutral and configure settings as shown below.
26. Collapse amd64_Microsoft-Windows-Shell-Setup_neutral, select AutoLogon and configure settings. Set LogonCount to 2 so that image build process goes quicker and in case administrator password is not configured in the answer file, we can reset it during the first two reboots.
27. Collapse AutoLogon, select Password and type in the the password which is automatically encrypted during installation. In this case, we type in a sample password. Please provide a more secure password.
28. In Answer File pane, scroll down to find UserAccounts and collapse it. Select AdministratorPassword and provide the same password as in the step 26.
29. Validate answer file. Click Tools menu, and select Validate Answer file. Make sure there are no errors in the Messages pane. Validation warnings are fine and normal.
30. Save answer file as autounattend.xml. This is placed in the root directory of our ISO image as instructed in the next section.
II. Generate an unattended installation ISO
  1. In the previous section step 2, we mounted the ISO image that created a new DVD drive F. Copy and paste all the contents in DVD drive F to a folder in the computer’s disk. In this case, we created drive ISO folder in local drive E. Put autounattend.xml file to the ISO folder as shown in the image below.
2. In the sources directory, delete install.wim and replace it with the install.wim we copied and pasted to local drive D in the previous section step 3.
3. Launch Deployment and Imaging Tools Environment (included in Windows ADK).
4. Generate a new bootable ISO for unattended installation. Use oscdimg.exe command as in the image below. Update the paths accordingly.
Usage: oscdimg.exe [options]
oscdimg.exe -bE:\ISO\boot\etfsboot.com -u2 -h -m -lWIN_SERVER_2012_R2-CORE E:\ISO E:\WinServer2012Core_unattend2.iso
–b points to the etfsboot.com file which is necessary for bootable media such as CDs and DVDs. This file will be written to the boot sector of the disk.
–u2 this option is used to produce an image that has only the UDF file system on it.
-h this option will include all hidden files and directories under the source path for this image.
–m specifies that the file size can be larger than the maximum size limit.
–l is the label of the media that will be created.

5. Locate new ISO in drive E with file name WinServer2012Core_unattend2.iso. Configure a VM using Hyper-V or physical server to boot from it and verify that there are no prompts or errors during the installation process. Note that the disk configuration and data will be wiped during the seamless unattended installation process.

1 comment:

  1. Make sure you name the XML file as autounattend.xml

    Easy to miss....

    ReplyDelete