Creates a single Windows Server 2016 ISO with autounattend.xml for unattended installation.
The ISO will be created at {ksAttuneBaseDir}/kickstart_{kickstartedNode.fqn}.iso.
For both BIOS and UEFI kickstarts.
For BIOS kickstarts please set isWinServerBios to the string 'true'.
For UEFI kickstarts please set isWinServerUefi to the string 'true'.
Please set isWinPEKickstart to the string 'false'.
This blueprint assumes the drivers drop in directory is at {automationWorkerLinuxBaseDirectory}/drivers-{newOsNode.fqn} and has the correct drivers dropped in.
Contents
Create Windows Server 2016 (Win2016) autounattend Single ISO on macOS or Linux Worker
Step 2 - Check if IP Address is in Subnet on macOS or Linux
Step 3 - Check if Gateway IP Address is in Subnet on macOS or Linux
Step 4 - Clean Up Build Files and ISOs on macOS or Linux Worker
Step 5 - Deploy Win2016 DVD ISO on macOS or Linux Worker
Step 6 - Extract Windows boot.img on macOS or Linux Worker
Step 7 - Extract Windows ISO on macOS or Linux Worker
Step 8 - Deploy Post Setup PowerShell Script on macOS or Linux
Step 9 - Deploy Windows Unattended Config on macOS or Linux
Step 10 - Copy Drivers Drop in Folder on macOS or Linux Worker
Step 11 - Copy efisys_noprompt.bin into efisys.bin on macOS or Linux Worker
Automate This
Use the Attune GUI for your Scripts
You've automated: Create Windows Server 2016 (Win2016) autounattend Single ISO on macOS or Linux Worker
Get the most out of automation with our get started videos, product demonstrations, and more.
The following steps will guide you through the manual process.
Checks if at least one of isWinServerBios or isWinServerUefi is set tot true.
Connect via ssh:
ssh {automationworkerlinuxuser}@{automationworkerlinuxnode}
Execute the following script:
if ! {isWinServerBios} && ! {isWinServerUefi}
then
echo "Please set one of 'isWinServerBios' or 'isWinServerUefi' to true to install Windows Server 2016, 2019 or 2022."
exit 1
else
echo "Ok."
fi
echos to debug.ANDed with the netmask octet.ORed with the wildcard octet.Subnet Cheat Sheet - 24 Subnet Mask, 30, 26, 27, 29, and other IP Address CIDR Network References
Execute the following script:
echo "IP address={newOsNode.ip}"
echo "subnet={newOsNodeSubnet.subnet}"
echo "netmask={newOsNodeSubnet.netmask}"
#echo "i, IP_OCTET, SUBNET_OCTET, NETMASK_OCTET, WILDCARD_MASK, OCTET_MIN, OCTET_MAX"
for i in $(seq 1 1 4)
do
IP_OCTET=$(echo "{newOsNode.ip}" | awk -F'.' "{print \$$i}")
SUBNET_OCTET=$(echo "{newOsNodeSubnet.subnet}" | awk -F'.' "{print \$$i}")
NETMASK_OCTET=$(echo "{newOsNodeSubnet.netmask}" | awk -F'.' "{print \$$i}")
OCTET_MIN=$((SUBNET_OCTET & NETMASK_OCTET))
WILDCARD_MASK=$((255 - NETMASK_OCTET))
OCTET_MAX=$((SUBNET_OCTET | WILDCARD_MASK))
#echo "$i. $IP_OCTET, $SUBNET_OCTET, $NETMASK_OCTET, $WILDCARD_MASK, $OCTET_MIN, $OCTET_MAX"
if [ "$IP_OCTET" -ge "$OCTET_MIN" ] &&
[ "$IP_OCTET" -le "$OCTET_MAX" ]
then
echo "Octet number $i, $OCTET_MIN <= $IP_OCTET <= $OCTET_MAX, ok."
else
echo "Octet number $i, $OCTET_MIN <= $IP_OCTET <= $OCTET_MAX is false. Not in range of the subnet mask."
false
fi
done
echos to debug.ANDed with the netmask octet.ORed with the wildcard octet.Subnet Cheat Sheet - 24 Subnet Mask, 30, 26, 27, 29, and other IP Address CIDR Network References
Execute the following script:
echo "gateway IP address={newOsNodeSubnet.gateway}"
echo "subnet={newOsNodeSubnet.subnet}"
echo "netmask={newOsNodeSubnet.netmask}"
#echo "i, GATEWAY_OCTET, SUBNET_OCTET, NETMASK_OCTET, WILDCARD_MASK, OCTET_MIN, OCTET_MAX"
for i in $(seq 1 1 4)
do
GATEWAY_OCTET=$(echo "{newOsNodeSubnet.gateway}" | awk -F'.' "{print \$$i}")
SUBNET_OCTET=$(echo "{newOsNodeSubnet.subnet}" | awk -F'.' "{print \$$i}")
NETMASK_OCTET=$(echo "{newOsNodeSubnet.netmask}" | awk -F'.' "{print \$$i}")
OCTET_MIN=$((SUBNET_OCTET & NETMASK_OCTET))
WILDCARD_MASK=$((255 - NETMASK_OCTET))
OCTET_MAX=$((SUBNET_OCTET | WILDCARD_MASK))
#echo "$i. $GATEWAY_OCTET, $SUBNET_OCTET, $NETMASK_OCTET, $WILDCARD_MASK, $OCTET_MIN, $OCTET_MAX"
if [ "$GATEWAY_OCTET" -ge "$OCTET_MIN" ] &&
[ "$GATEWAY_OCTET" -le "$OCTET_MAX" ]
then
echo "Octet number $i, $OCTET_MIN <= $GATEWAY_OCTET <= $OCTET_MAX, ok."
else
echo "Octet number $i, $OCTET_MIN <= $GATEWAY_OCTET <= $OCTET_MAX is false. Not in range of the subnet mask."
false
fi
done
Deletes the build files and kickstart ISO.
Execute the following script:
DIR="{automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}"
[[ -d ${DIR} ]] && rm -rf ${DIR} && echo "Removed ${DIR}" || \
echo "No directory to remove."
ISO={automationWorkerLinuxBaseDirectory}/*{newOsNode.fqn}.iso
[[ -f ${ISO} ]] && rm -fv ${ISO} || echo "No ISO to remove."
Deploys Windows Server 2016 ISO to {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}.
Download from https://www.microsoft.com/en-us/evalcenter/download-windows-server-2016.
Copy the File(s) Win2016_ISO.tar to the target node.
Deploy the File(s) here:
{automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}, relative to the home directory
Extracts the boot.img from the ISO. This is required for passing to mkisofs to regenerate a bootable BIOS ISO.
Only applies to BIOS kickstarts so if any of these parameters are set the string true:
Execute the following script:
if {isWin10Bios} || {isWinServerBios}
then
# Extract the boot.img out of the WinPE ISO
cd {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}
# Case insensitve globbing
shopt -s nocaseglob
# Set the filename of the ISO
F=$(ls *.iso)
# Get the Boot image offset
OFFSET=`isoinfo -d -i $F | grep Bootoff | cut -c21-`
# Extract the boot.img.
dd if=$F of=boot.img bs=2048 count=8 skip=$OFFSET
else
echo "Skipping for UEFI ISO creation."
fi
Extracts the Windows ISO.
Execute the following script:
cd {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}
# Case insensitve globbing
shopt -s nocaseglob
if ls | grep -q *iso
then
ISO="$(echo *iso)"
echo "ISO is $ISO"
7z x "${ISO}"
rm -v "${ISO}"
else
echo "ISO is already extracted."
fi
Deploys the post install setup PowerShell script post_install_setup.ps1 to {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}.
This file is called by the "
This script is run once post installation of the WIndows operating system.
Copy the File(s) Post_Install_Setup_PowerShell_Script.tar to the target node.
{automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}/post_install_wim, relative to the home directory
Deploys the generic autounattend.xml.
Set one of these true depending on whether you want Windows Desktop 10 or Windows Server for BIOS or UEFI boot methods.
isWin10BiosisWin10UefiisWinServerBiosisWinServerUefiSet isWinPEKickstart to true for WinPE kickstarts.
For these Windows versions: * WIndows Desktop 10 * WIndows Server 2016 * WIndows Server 2019 * WIndows Server 2022
For these boot methods: * BIOS * UEFI
Copy the File(s) Windows_Unattended_config.tar to the target node.
{automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}, relative to the home directory
Copies the contents of the drivers drop in folder at {automationWorkerLinuxBaseDirectory}/drivers-{newOsNode.fqn} to {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}/drivers.
Execute the following script:
cd {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}
DRIVERS_DROP_IN_FOLDER="{automationWorkerLinuxBaseDirectory}/drivers-{newOsNode.fqn}"
DESTINATION_DRIVERS_FOLDER="drivers"
mkdir --verbose "${DESTINATION_DRIVERS_FOLDER}"
if [ -d "${DRIVERS_DROP_IN_FOLDER}" ]
then
cp --verbose --recursive "${DRIVERS_DROP_IN_FOLDER}"/* \
"${DESTINATION_DRIVERS_FOLDER}"
else
echo "Drivers drop in folder ${DRIVERS_DROP_IN_FOLDER} does not exist. No drivers copied."
fi
From https://serverfault.com/questions/353826/windows-boot-iso-file-without-press-any-key this disables the "Press any key To boot from CD or DVD . . . .".
Execute the following script:
if {isWin10Uefi} || {isWinServerUefi}
then
cd {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}
cd efi/microsoft/boot/
cp --verbose efisys_noprompt.bin efisys.bin
else
echo "Skipping for BIOS ISO creation."
fi
Creates a BIOS bootable Windows ISO called kickstart_{newOsNode.fqn}.iso from the contents in folder {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}.
Only applies BIOS kickstarts so if any of these parameters are set the string true'`:
isWin10BiosisWinServerBiosExecute the following script:
cd "{automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}"
if {isWin10Bios} || {isWinServerBios}
then
if uname | \
grep -iq "darwin"
then
echo "is macOS"
export PATH="${HOME}/Parallels/homebrew/bin:$PATH"
echo "Using $(which xorriso)"
xorriso -as mkisofs \
-b boot.img \
-no-emul-boot \
-c BOOT.CAT \
-iso-level 3 \
-udf \
-joliet-long \
-relaxed-filenames \
-J \
-full-iso9660-filenames \
-disable-deep-relocation \
-omit-version-number \
-V "KS_WIN" \
-o {automationWorkerLinuxBaseDirectory}/kickstart_{newOsNode.fqn}.iso \
.
else
echo "not macOS"
mkisofs \
-b boot.img \
-no-emul-boot \
-c BOOT.CAT \
-iso-level 3 \
-udf \
-joliet-long \
-relaxed-filenames \
-allow-limited-size \
-J \
-full-iso9660-filenames \
-disable-deep-relocation \
-omit-version-number \
-V "KS_WIN" \
-o {automationWorkerLinuxBaseDirectory}/kickstart_{newOsNode.fqn}.iso \
.
fi
else
echo "Skipping for UEFI boot."
fi
Creates a UEFI bootable Windows ISO called kickstart_{newOsNode.fqn}.iso from the contents in folder {automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}.
Only applies UEFI kickstarts so if any of these parameters are set the string true:
https://unix.stackexchange.com/questions/531012/how-to-modify-an-installation-iso-and-keep-it-bootable
Execute the following script:
if {isWin10Uefi} || {isWinServerUefi}
then
cd "{automationWorkerLinuxBaseDirectory}/build-{newOsNode.fqn}"
if uname | \
grep -iq "darwin"
then
echo "is macOS"
export PATH="${HOME}/Parallels/homebrew/bin:$PATH"
echo "Using $(which xorriso)"
xorriso -as mkisofs \
-allow-limited-size \
-iso-level 4 \
-full-iso9660-filenames \
-rock \
-b boot/etfsboot.com \
-no-emul-boot \
-boot-load-seg 0 \
-boot-load-size 8 \
-hide boot.catalog \
-eltorito-alt-boot \
-no-emul-boot \
-b efi/microsoft/boot/efisys.bin \
-boot-load-size 1 \
-udf \
-untranslated-filenames \
-disable-deep-relocation \
-o {automationWorkerLinuxBaseDirectory}/kickstart_{newOsNode.fqn}.iso \
.
else
echo "not macOS"
mkisofs \
-allow-limited-size \
-iso-level 4 \
-full-iso9660-filenames \
-rock \
-b boot/etfsboot.com \
-no-emul-boot \
-boot-load-seg 0 \
-boot-load-size 8 \
-hide boot.catalog \
-eltorito-alt-boot \
-no-emul-boot \
-b efi/microsoft/boot/efisys.bin \
-boot-load-size 1 \
-udf \
-untranslated-filenames \
-disable-deep-relocation \
-o {automationWorkerLinuxBaseDirectory}/kickstart_{newOsNode.fqn}.iso \
.
fi
else
echo "Skipping for BIOS boot."
fi
You have completed this instruction.
Join our Discord channel and connect with like-minded individuals who share your passion. Engage in lively discussions, gain valuable insights, and stay updated on the latest trends in our industry. Don't miss out on this opportunity to network, learn, and grow together.
Click the link below and become a part of our vibrant community on Discord today!