BYOD Set Up Script

I’d been tasked with thinking about the operating system situation for our students’ various new BYOD Windows Devices. I could have created an SOE based on Windows Enterprise (we have KMS set-up upstream) and have them all domain joined so I could administrate them with GPOs. This would be fine except when they leave our school and they need to be re-imaged to their pre-installed operating system (mostly Home edition), it could get messy. As the students fully own the devices and are at the senior (and mostly more responsible) end of the school I opted instead to leave the existing operating system installed and besides tightening up our network security use our ICT Acceptable Use policy as a guide to deter misuse.

So now the situation where I have boxes and boxes (and did I mention boxes) of various notebooks in my office to configure. Since it’s 2020 I probably should have made this a PowerShell script but I instead opted for the tried and simpler (to me) route of a batch file. Here it is with sensitive information removed:

echo off
echo:
echo:
echo:
echo Hello, this one will install Wi-Fi, move the Adobe installer to the desktop, install Teams, install Office, set the KMS servers and restart.
echo:
echo:
echo:
timeout 5
cls
D:
ENCU /Ssid=####### /Unattend /Eaptls /CertificateName=D:\ENCU\######\######.pfx /CertificatePassword=###### /DoNotWaitForWireless
echo:
echo:
echo:
echo Wi-Fi should be done now.
echo:
echo:
echo:
timeout 5
echo:
echo:
echo:
echo Now let's put the Adobe installer on the desktop.
echo:
echo:
echo:
xcopy "D:\Adobe Installer" "C:\users\%username%\Desktop\Adobe Installer" /E/I
cls
echo:
echo:
echo:
echo Now for Teams
echo:
echo:
echo:
timeout 5
Teams_windows_x64
cls
echo:
echo:
echo:
echo It looks like nothing is happening but it is. Wait a minute. Also did you uninstall the preinstalled Office?
echo:
echo:
pause
cd "Office 19 and Visio"
setup /configure Office_Visio_2019.xml
cls
echo:
echo:
echo Now it's installed, we need to tell it where to look for the KMS servers.
echo:
echo:
timeout 5
slmgr -skms #######
cscript "C:\Program Files\Microsoft Office\Office16\ospp.vbs" /sethst:#######
cls
echo:
echo:
echo Restarting to apply the KMS server settings.
echo:
echo:
timeout 5
shutdown /r /t 0

Simple but effective. First it turns echo off so everything looks cleaner. It displays a welcome message for 5 seconds before running the connection utility (it installs the Root certificate, Wi-Fi certificate, creates a Wi-Fi network profile then connects to the network) – it’s just easier to invoke the utility than do it manually. Once the Wi-Fi is connected there is another 5 second delay before it starts copying the Adobe Suite installer files to the desktop. I did this because they will need to enter their own credentials to complete the installation and some might not want or need the Adobe suite. After this it clears the screen (cls command) and advises it’s going to install Microsoft Teams. 5 second delay and it installs but pauses.

I used a pause instead of a timeout because some of the computers come with Office installed already which will make the installation fail. The installation of Office invokes an .xml configuration I wrote so it will work with KMS. After another 5 second time out the script adds the KMS server to the operating system, then visual basic script from the Office directory to update the KMS server inside Office. After another 5 seconds the computer restarts immediately.

After the restart I open Word and make sure it’s activated against the KMS and the computer is ready to go. Yeah the script is messy and not optimized but it works.

Leave a comment

Your email address will not be published. Required fields are marked *