Deploying Nano Server with the Windows Assessment and Deployment Kit (ADK) RC for Windows 10

    This article was written by Mikhail Komarov, MVP in the direction of Hyper-V .


    The purpose of this article is to demonstrate the ability to use the ADK to deploy Microsoft Nano Server, which will further enable the use of the standard Windows Deployment Service for mass deployment. All actions can be carried out under the operating system Windows 8.1 or higher. If you plan to deploy to Hyper-V, you must enable the Hyper-V role or use a real computer. In this article, I used Windows 8.1 with the Hyper-V role enabled and the HP Microserver Gen 8.

    In May 2015, a revolutionary product was introduced at the Microsoft Ignite conference - Microsoft Nano Server. This product is a fully redesigned version of Windows with a minimum code size and only the necessary functions. Server roles and additional features reside outside of Nano Server. Stand-alone packages are installed as applications. The key roles and functions of the product are Hyper-V, storage systems (SoFS) and clustering, as well as support for the CLR kernel, ASP.NET 5 and PaaS. The size of the distribution package with installed packages does not exceed 1GB and can be located on the SD card.

    The deployment process consists of several steps.
    Let's start with the first step.. We need the distribution of Windows Server Technical Preview 2, the links are at the end of the article. After we downloaded the distribution kit as an ISO file, we need to open it and extract the NanoServer directory from the root.



    Next, we need to download the Windows Assessment and Deployment Kit (ADK) RC for Windows 10. The product is downloaded as a small executable file, when launched, you can select the necessary components or complete download, after which you can start the installation. We do not need the entire package for this work, we select only the options for deployment.



    After installing this package, run the “Deployment and Imaging tool Environment” shortcut with administrator rights



    and run the command “ copype amd64 W: \ WinPE_64 ”. СopypeIt is not a Windows command, but a script that comes bundled with the ADK. The meaning of this command is to copy the Windows Preinstallation Environment files to W: \ WinPE_64. On my machine for additional data, I use the W disk, in your case it can be any disk and any directory.



    After creating the directory with the Windows Preinstallation Environment (Windows PE) files, the first step is completed.

    On the second stepwe need to figure out how the machine will boot from Nano Server. This is important because we will deploy Nano Server from scratch. So, we have two options for loading our machine: using the classic BIOS or modern UEFI. There are also two options for Hyper-V that depend on the type of virtual machine. The following is an example for Hyper-V.



    Ordinary modern computer.



    This issue is of key importance for us, since it depends on how we will partition the disk.

    Let's start with the classic BIOS. By default, partitions on the disk look like this:



    However, there is another option for disk layout, which is usually used in client operating systems for OEM deployments. Recovery Image is an image of the operating system plus utilities that allow you to deploy the operating system again to the Windows partition after an accident.



    In our case, we restrict ourselves to a simple case, using a simple version of the script. A link to the original Microsoft article with extended script versions and comments is provided at the end.

    select disk 0
    clean
    create partition primary size=350
    format quick fs=ntfs label="System"
    assign letter="S"
    active
    create partition primary
    format quick fs=ntfs label="Windows"
    assign letter="W"
    exit
    

    Pay attention to the letters of the volumes. These letters are used only during operations when the machine is loaded with Windows PE. The final appearance of partitions and volumes after applying the script, applying the image and rebooting looks like this.





    Let's move on to modern UEFI. The MBR was replaced by the GPT with its own partitions. One reason for upgrading to UEFI is that support for boot volumes larger than 2TB. By default, disk layout looks like this:



    However, there is another variant of disk layout, which is typically used in client operating systems for OEM deployments. Recovery Image is an image of the operating system plus utilities that allow you to deploy the operating system again to the Windows partition after an accident.



    In our case, we restrict ourselves to a simple case, using a simple version of the script. A link to the original Microsoft article with extended script versions and comments is provided at the end.

    select disk 0
    clean
    convert gpt
    create partition primary size=300
    format quick fs=ntfs label="Windows RE tools"
    assign letter="T"
    create partition efi size=100
    rem == Note: for Advanced Format Generation One drives, change to size=260.
    format quick fs=fat32 label="System"
    assign letter="S"
    create partition msr size=128
    create partition primary
    format quick fs=ntfs label="Windows"
    assign letter="W"

    As in the previous case, these letters are used only during operations when the machine is loaded with Windows PE. The final appearance of partitions and volumes after applying the script, applying the image and rebooting looks like this.





    In this article I will not dwell on what these sections are for. For those who are interested, there is a link to the materials at the end. Now we can create two text files Bios_Partition_Structure.txt and UEFI_Partition_Structure.txt , in which our scripts will lie. In the future, we will run the diskpart / s Bios_Partition_Structure.txt or diskpart / s UEFI_Partition_Structure.txt command . The choice of the team that will create the partitions is determined by the type of download.

    The third step is to create an answer file and a script that will run after installation. A sample unattend.xml response file is from “ Getting Started with Nano Server ”. You can change the values ​​of the ComputerName , Value , RegisteredOwner , RegisteredOrganization tags .

    <ComputerName>NanoServer1503</ComputerName>
    <AdministratorPassword>
     <Value>P@ssw0rd</Value>
     <PlainText>true</PlainText>
     </AdministratorPassword>
    <RegisteredOwner>Mikhail Komarov</RegisteredOwner>
     <RegisteredOrganization>Virtual Lab</RegisteredOrganization>

    Regarding the script after installation - first you need to create the
    md W: \ Windows \ Setup directory , then put the SetupComplete.cmd file there with the following contents:

    ping 127.0.0.1 -n 4
    hostname
    ipconfig
    netsh advfirewall set domainprofile state off
    netsh advfirewall set privateprofile state off
    netsh advfirewall set publicprofile state off
    netsh advfirewall set currentprofile state off
    

    From the contents it is clear that we will receive the IP address via DHCP and turn off the firewall.

    The fourth step is to create the resulting scripts that will deploy the image, add packages and apply the answer file. So, we’ll create two files whose name makes it clear what they are for: Apply_on_Hardware.bat and Apply_on_Hyper-V_VM.bat . These two files will have a common part.

    Deploy the image to disk.

    dism /Apply-Image /ImageFile:d:\NanoServer\nanoserver.wim /Index:1 /ApplyDir:W:\

    Add packages (there will be a different composition for the files).
    dism /Add-Package

    Add a response file.
    dism /Apply-Unattend:d:\NanoServer\unattend/image:W:\

    Space for additional logs.
    md W:\Windows\panther

    Copy the answer file.
    copy d:\NanoServer\unattend.xml W:\Windows\panther\

    Create a directory to run scripts after installation.
    md W:\Windows\Setup

    Copy the answer file.
    copy d:\NanoServer\SetupComplete.cmd W:\Windows\Setup\Scripts\

    Create a boot record.
    bcdboot W:\Windows

    The difference in files is due to differences in platforms.



    Therefore, the following packages will be in the Apply_on_Hardware.bat file :

    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-Compute-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-Compute-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-OneCore-ReverseForwarders-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-OneCore-ReverseForwarders-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-Storage-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-Storage-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-OEM-Drivers-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-OEM-Drivers-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-FailoverCluster-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-FailoverCluster-Package.cab /Image:W:\
    

    And in the file Apply_on_Hyper-V_VM.bat there will be the following packages:
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-Guest-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-Guest-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-OneCore-ReverseForwarders-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-OneCore-ReverseForwarders-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-Storage-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-Storage-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\Microsoft-NanoServer-FailoverCluster-Package.cab /Image:W:\
    dism /Add-Package /PackagePath:d:\NanoServer\Packages\en-us\Microsoft-NanoServer-FailoverCluster-Package.cab /Image:W:\
    

    As a result, we get a set of files that we put in the directory with Nano Server.



    In the fifth step, we need to decide how Windows PE will boot and where our files and Nano Server files will be located. There are several ways, for example, to make a bootable USB sticker and download and install from it, or, for example, to make a bootable ISO, and put the Nano Server files on USB and install on a real computer. Or make an ISO image in which there will be Windows PE and Nano Server files. We will go this way. Copy the NanoServer directory to W: \ WinPE_64 \ media \ . After that, create an ISO-image with the command MakeWinPEMedia / ISO W: \ WinPE_64 W: \ WinPE_64.iso Note that MakeWinPEMedia- This is a script in the ADK, and if you change the key, it will just as well make a bootable USB sticker.



    At the end of this procedure, we get the WinPE_64.iso image file , in which Windows PE is prepared and the Nano Server files are located.

    The sixth step is to boot from the image on the newly created virtual machine or physical computer, after which we get to the command line where you need to go to the directory on the d: \ nanoServer drive . If drive D is empty or you did not find the directory, try the following:
    Attention !!! We execute only on the Windows PE command line:

    Diskpart
    (we call the section editor)
    Select disk 0
    (select 0 drive)
    Clean
    (delete all partitions from this disk)
    Exit
    (exit the section editor)
    exit
    (after this command the computer will restart)

    Next, try changing to the d: \ nanoserver directory . Then run diskpart / s Bios_Partition_Structure.txt or diskpart / s UEFI_Partition_Structure.txt . The choice of the team that will create the partitions is determined by the type of download. We discussed the contents of Bios_Partition_Structure.txt and UEFI_Partition_Structure.txt at the end of the second section.

    After creating the sections, run the Apply_on_Hardware_Bios.bat or Apply_on_Hyper-V_VM.bat script, depending on the type of machine. After the script finishes, the machine will go into reboot. After a reboot, nothing appears on the screen for a long time, anyway, control from the screen will not be available.

    The seventh final step is connecting to the Nano Server. Let's look at our DHCP server, which gave us the address, and remember it. Run PowerShell as administrator on the local machine:

    $ip = "192.168.10.105" 
    $user = "Administrator"Set-Item WSMAN:\\localhost\client\TrustedHosts $ip -Force
    chcp 65001
    Enter-PSSession -ComputerName $ip -Credential $user
    

    enter the password and run cmdlet get-process



    Resources:
    Windows Assessment and Deployment Kit (ADK) RC for Windows 10
    Microsoft Ignite 2015 (video from the conference)
    Windows Server Technical Preview 2
    Sample: Configure UEFI / GPT-Based Hard Drive Partitions by Using Windows PE and DiskPart
    Sample: Configure BIOS / MBR-Based Hard Disk Partitions by Using Windows PE and DiskPart
    Creating Partition Structure in GPT Partitioning on PC with UEFI
    Getting Started with Nano Server

    Also popular now: