Useful Tips for IT Administrators: Deploying Various OSes Using Windows Deployment Services

Original author: Gary Williams
  • Transfer
  • Tutorial
My colleague Gary Williams, a system administrator with extensive experience, shared tips on how to use Windows Deployment Services to deploy more than just Windows. And today I offer his recommendations to your attention.

Windows Deployment Services (WDS) is a useful addition to the Windows platform. To deploy virtual machines with a guest Windows OS, this tool can be used directly out of the box. And after several clever hand movements, he is quite able to cope with the task of deploying Linux and VMware servers using the Preboot eXecution Environment (PXE) boot menu.

Among these manipulations is a couple of commands launched from the command line. You just need to switch the PXE bootloader used by Windows to the bootloader for Linux. As a result, a menu item will be created that allows you to switch the boot from Linux PXE to that for Windows if necessary, and IIS will be used to operate the web interface for downloading the Linux configuration.

I use customized WDS to deploy Windows, CentOS, and ESXi, which I will cover in this post. I think that users of other platforms will find ideas for their deployment here.


For our example, let's take a clean Windows server with a C: drive of 60 GB under the OS and a 300 GB WDS drive for various WIM files that we need to install Windows and Linux.

Stage 1: Deploy WDS Server


  1. Install Windows Deployment Services and IIS on the server. This can be done through Server Manager or using PowerShell:

    Install-WindowsFeature –name Web-server -includemanagementtools
    Install-Windowsfeature –name WDS -includemanagementtools
    
  2. Then you need to make changes to the DHCP pool. In particular, you can add another NIC to our server and configure a dedicated network, but I usually do not, but instead configure the main DHCP server - specify additional WDS DHCP attributes. Here are the settings I use:



    - Boot Server Host Name - enter the IP address of the WDS server.
    - Bootfile Name - I specify the WDS executable file that I want to run on the client.

    The remaining 3 settings have default values ​​for DHCP.
  3. On the WDS server, run the configuration wizard and complete the configuration.
  4. A couple of changes that I can recommend to make to the setup:

    - You can integrate the server with Active Directory, because at this stage we set the Windows settings, but I prefer a stand-alone server:



    According to the specified setting, it will respond to requests from client machines and will not require any “dances” with AD:



    - Usually I change the path from C: \ RemoteInstall to E: \ RemoteInstall , where E: is the second disk mentioned above, which I intended for WIM, Linux files, etc.


  5. Then you need to make changes to the PXE menu - for this you will need to run the WDS installation UI, right-click on our server and in its properties on the Boot tab change the Require the user to press F12 key to continue the PXE boot option to Always continue the PXE boot :


  6. After that, you can add .WIM files to our WDS server. We take the boot.wim and install.wim files with the Windows 2016 ISO - and our server is prepared for the deployment of Windows machines.

Now you can boot the virtual machine using PXE after seeing the standard Windows WDS boot screen. This is worth doing in order to make sure that everything works, as we will continue to make changes to the basic functionality of WDS.

Stage 2: replacing the Windows Deployment Services bootloader


So, our WDS server is ready to deploy Windows images, but we want Linux images to be deployable as well. To do this, we will change the WDS bootloader to Linux PXE.

First, we need a copy of sysLinux .

Important! The version should not exceed 3.86, otherwise it will not work with ESXi (since its installer is already based on 3.26).

Unpack sysLinux 3.86. zip to a temporary directory and then follow these steps:

  1. Checking the presence of

    core \ pxeLinux.0
    com32 \ menu \ vesamenu.c32
    com32 \ modules \ chain.c32 files
  2. Rename the pxeLinux.0 file to pxeLinux.com .
  3. Copy the files to the directories remoteinstall \ boot \ x64 and remoteinstall \ boot \ x86 .
  4. In the x86 and x64 directories , rename pxeboot.n12 to pxeboot.0
  5. Then, from the command line, run the following commands to change the bootloader on the Linux PXE loader:

    wdsutil /set-server /bootprogram:boot\x86\pxeLinux.com /architecture:x86
    wdsutil /set-server /N12bootprogram:boot\x86\pxeLinux.com /architecture:x86
    wdsutil /set-server /bootprogram:boot\x64\pxeLinux.com /architecture:x64
    wdsutil /set-server /N12bootprogram:boot\x64\pxeLinux.com /architecture:x64
    
  6. After that, in the x86 and x64 directories, create a subdirectory named pxeLinux.cfg , and in it create a file called default and copy the following into it:

    Boot menu settings
    DEFAULT vesamenu.c32
    PROMPT 0
    NOESCAPE 0
    ALLOWOPTIONS 0
    # Timeout in units of 1/10 s
    TIMEOUT 0
    MENU MARGIN 10
    MENU ROWS 16
    MENU TABMSGROW 21
    MENU TIMEOUTROW 26
    MENU COLOR BORDER 30;44 #20ffffff #00000000 none
    MENU COLOR SCROLLBAR 30;44 #20ffffff #00000000 none
    MENU COLOR TITLE 0 #ffffffff #00000000 none
    MENU COLOR SEL 30;47 #40000000 #20ffffff
    MENU BACKGROUND flow.jpg
    MENU TITLE PXE Boot Menu
    #---
    LABEL wds
    MENU LABEL Windows Deployment Services
    MENU DEFAULT
    KERNEL pxeboot.0
    #---
    LABEL CentOS68
    MENU LABEL CentOS 6.8
    KERNEL /web/CentOS/6.8/images/pxeboot/vmlinuz
    append initrd=/web/CentOS/6.8/images/pxeboot/initrd.img root=/dev/ram0 init=/Linuxrc ramdisk_size=100000 ks=https://[IP of your WDS server]/CentOS/6.8/centos-base-ks.cfg
    #---
    LABEL CentOS72
    MENU LABEL CentOS 7.2
    KERNEL /web/CentOS/7.2/images/pxeboot/vmlinuz
    append initrd=/web/CentOS/7.2/images/pxeboot/initrd.img
    #---
    LABEL VMWare500U3
    MENU LABEL VMWare 5.0.0 U3
    KERNEL /web/VMWare/5.0.0/U3/mboot.c32
    APPEND -c /web/VMWare/5.0.0/U3/boot.cfg
    #---
    LABEL VMWare553b
    MENU LABEL VMWare 5.5 U3b
    KERNEL /web/VMWare/5.5.0/U3b/mboot.c32
    APPEND -c /web/VMWare/5.5.0/U3b/boot.cfg
    #---
    LABEL VMWare60
    MENU LABEL VMWare 6.0
    KERNEL /web/VMWare/6.0/mboot.c32
    APPEND -c /web/VMWare/6.0/boot.cfg
    #---
    LABEL VMWare65
    MENU LABEL VMWare 6.5
    KERNEL /web/VMWare/6.5/mboot.c32
    APPEND -c /web/VMWare/6.5/boot.cfg
    #---
    LABEL Abort
    MENU LABEL AbortPXE
    Kernel abortpxe.0
    #---
    LABEL local
    MENU LABEL Boot from Harddisk
    LOCALBOOT 0
    Type 0x80


Step 3: edit IIS settings


We need IIS for the CentOS and ESXi installation files. I usually create this file structure of a web server on VMDK with data:

- E: \ web - the root folder that IIS points to
- E: \ web \ centos \ 7.x \ 7.1 - CentOS 7.1 installation files
- E: \ web \ vmware \ 6.5 - VMware 6.5 installation files

In IIS settings, you need to enable the option to view the file structure so that Linux and VMware installers can access the corresponding files.

To do this, launch the IIS management console, select the desired server, select its Default site and enable Directory browsing with the Enable command .



You can also enable HTTPS.

Stage 4: add Linux


Now you can add the ability to install Linux. I usually follow these steps:

  1. Download the “lightest” version of ISO from CentOS, mount the ISO and copy the contents to the directory E: \ web \ centos \ 7.x \ 7. [version] (or another with the same friendly name).
  2. After that it will be possible to add, for example, a kickstart file for greater automation. For example, I personally add this piece to the default pxeLinux.cfg file :

    LABEL CentOS72
    MENU LABEL CentOS 7.2
    KERNEL /web/CentOS/7.2/images/pxeboot/vmlinuz
    append initrd=/web/CentOS/7.2/images/pxeboot/initrd.img inst.repo=[IP of your WDS server]/CentOS/7.2 ks=[IP of your WDS server]/CentOS/7.2/centos-base-ks.cfg
    

Step 5: Add VMware


In conclusion, let's add the ability to install ESXi 6.5.

  1. Similar to step 4, you need to copy all the files from the VMware ISO image to the appropriate directory on our WDS server.
  2. Then you need to edit the boot.cfg file in the VMware directory and remove the spaces. The file will eventually look like this:



Conclusion


Perhaps, for some, this whole procedure will seem unnecessary - but its result will allow you to use the PXE menu to switch to WDS and select any Windows OS that supports the WIM file. In addition, it can also be used to install Linux and VMware. You can also use other programs to your taste, for example, GParted or Memtest.

Also popular now: