I’ll be showing how to add full WiFi support to WinPE in MDT for Dell systems. This will also include adding WiFi support even outside of WinPE so that the entire MDT task sequence can complete end to end. Massive props to Oliver Kieselbach on his blog post that started it all and has most of the steps we need. Definitely check it out! I’ve just modified it slightly and added additional steps to include OSDBuilder, Dell drivers, and full task sequence support. Before we start, here is a list of all the steps we will be doing from a high level:
- Use OSDBuilder to mount and update our WinPE (which is actually WinRE since that has the wireless modules we need)
- Add Dell wifi drivers (2 methods)
- Replace default MDT boot image with our updated WinRE one
- Create some additional “Extra Files” that will tie everything together
- wlan.cmd to initiate and connect to your wifi network
- unattend.xml to modify the startup sequence of the MDT boot image
- Slightly modified ztiutility.vbs file to make MDT support wireless
- Add a few extra command lines to our Task Sequence to get wifi to automatically connect after the system reboots from WinPE
- Customized unattend.xml for the Task Sequence so Wifi automatically connects in administrator account
- Latest MDT installed (I tested with 8456)
- Windows 10 ISO from VLSC or MSDN
- Dell hardware, preferably ones with Intel Wifi cards
- Ready to have some fun
Create updated WinRE
Fpr this, we’ll be using OSDBuilder which will automate the updating and creation of WinPE, including using the WinRE version which has Wireless support. Native WinPE from ADK does not.
Launch an administrative Powershell window
Type Install-Module -Name OSDBuilder -Force
Type “Y” when prompted to install Nuget.
I’ll be using the WinRE from Win10 1809 media downloaded from Microsoft Volume Licensing site. Mount the ISO.
Type Import-OSMedia. It should scan and find your mounted Win10 media. Select the appropriate edition (if applicable) and click ok.
Media will be imported.
Once complete it will show you the path where your mounted OS media is stored.
Optional: Run Update-OSMedia -Download -Execute. This will download necessary updates for both the OS and winpe/winre and then apply to the image. This isn’t required to do but always a good idea. It can take quite some time though so be patient. For more info go here: https://www.osdeploy.com/osdbuilder/docs/basics/update-osmedia.
While that is running, download Dell WiFi drivers. Most of the Dell enterprise platforms should use similar WiFi cards (usually Intel) and thus you can most likely pick one of the newer models you have in your environment and it should work with most. I had pretty good luck using the Win10 X64 driver CAB for Latitude E7470. Wifi worked on the following systems once injected into WinPE.
- Dell Latitude 7490
- Dell Latitude 7480
- XPS 13 9360
- XPS 13 9365
- Precision 5510
Try one set and see if it works, you can always inject more later. You will also want to download the standard WinPE 10 driver CAB. These are all located here:
You have 2 ways to inject drivers:
Option 1 – Import into MDT
The main reasons for doing it this way is if you already have your system drivers imported into MDT, you can simply add the network ones to WinPE via the Workbench. It also gives you a visual way of managing them.
Download the CAB(s) (If you don’t want to do this manually, use this awesome tool! https://gallery.technet.microsoft.com/scriptcenter/Driver-Tool-Automate-9ddcc010). In my case I’m just using the Dell E7470 driver cab.
Use 7zip to extract to a folder.
Create a folder for the model you downloaded in the Out of Box drivers section.
Right click the model and click Import Drivers.
Click Next, Next and Finish to wizard and import.
Repeat for WinPE 10 drivers.
In Deployment Console, expand “Advanced Configuration > Selection profiles”.
Select your Model(s) along with WinPE 10.
Click next, next and then finish.
Go to properties of Deployment share and then Windows PE.
Click on “Drivers and Patches” tab and select the selection profile we just created. (Ensure you are on the x64 boot image). Select the two boxes for Including all “network” and “mass storage” drivers.
When we update the Deployment Share later on, the network and storage drivers will be injected into the WinPE image.
Option 2 – Use OSDBuilder
If you don’t want to manage or mess with importing drivers into MDT, you can use OSDBuilder to inject them as part of the PE build process. Simple copy the network folder inside the driver CAB to c:\OSDBuilder\Content\Drivers. I named folders for each and then put them inside:
The driver injection process will recurse each of the the folders to get all of the subfolders.
Now we need to create a new PE build task by running this command:
New-PEBuildTask -SourceWim WinRE -TaskName “WinPE Wireless” -MDTDeploymentShare “C:\MDTBuildLab” -ContentWinPEDrivers -WinPEAutoExtraFiles.
Note: The “WinPEAutoExtraFiles” switch includes a lot of useful things from the media that was imported. In some versions of WinPE this may be required to get WiFi working due to DLLs being missing. The two DLLs are:
However, on updated 1803 WinRE media (10.0.17763.503), I was able to get WiFi working without adding these DLLs at all. But might as well add them as there are a bunch of other handy tools as well!
Select media when prompted and click ok.
It identifies the drivers we placed in C:\OSDBuilder\Content\Drivers. Select them and click ok.
When ready, do New-PEBuild -Execute and select the PEBuild Task we created in the step above:
The process will complete in a few minutes.
Once complete, you can go to c:\osdbuilder\pebuilds\os\sources\boot.wim or “C:\OSDBuilder\PEBuilds\WinPE Wireless 17763.107\LiteTouchPE_x64.wim” to find your boot image
Now we need to copy this to our default MDT boot image location (Windows 10 ADK install directory) so that any time you update your Deployment Share, it will use this image.
Browse to C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us.
Rename the existing boot image.
Copy the newly create boot image and rename it winpe.wim
Now we need to create a few additional files to enable MDT boot image to automatically connect to you wifi network before starting the task sequence.
Wifi Network XML and wlan.cmd
You’ll need to export your WiFi network from a device that has it properly connected. Generally these need to be WPA/WPA2 networks with pre-shared keys. Technically WinPE supports 802.1x and so it could be possible to connect to that type of network and so if you figure out how, let me know! In my case, my network is called Mockingjay.
netsh wlan export profile name=Mockingjay key=clear
This will create file called Wi-Fi-Mockingjay.xml. Note that this will have the pre-shared key in plain text.
Next let’s create a script called wlan.cmd which will do the actual connecting to the wifi network when WinPE loads. This will start wlan service, load Wi-Fi-Mockingjay.xml, connect to Wifi, and then loop until a valid IP is established and you can ping out to an address. Feel free to adjust the hostname accordingly.
@echo off cd %~dp0 net start wlansvc netsh wlan add profile filename=Wi-Fi-Mockingjay.xml netsh wlan connect name=Mockingjay ssid=Mockingjay Echo pinging google.com :loop (ping -n 1 www.google.com | find "TTL=") || goto :loop echo Success!
This will ensure we call wlan.cmd before the MDT process kicks off (LiteTouch.wsf) once WinPE is loaded.
Create a new file and call it Unattend.xml
Copy and paste the below content inside and save it. You’ll notice we added wlan.cmd as the first “RunSynchronousCommand” before LiteTouch launches.
<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="https://schemas.microsoft.com/WMIConfig/2002/State"> <Display> <ColorDepth>32</ColorDepth> <HorizontalResolution>1024</HorizontalResolution> <RefreshRate>60</RefreshRate> <VerticalResolution>768</VerticalResolution> </Display> <RunSynchronous> <RunSynchronousCommand wcm:action="add"> <Description>Start Wireless</Description> <Order>1</Order> <Path>wlan.cmd</Path> </RunSynchronousCommand> <RunSynchronousCommand wcm:action="add"> <Description>Lite Touch PE</Description> <Order>2</Order> <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path> </RunSynchronousCommand> </RunSynchronous> </component> </settings> </unattend>
Modifying this script is required so that MDT is able to properly use our Wifi connection as by default this is not supported. Again, big thanks to Oliver on his blog for figuring this out.
Browse to your MDT Deployment share > Scripts and find ZTIUtility.vbs. Copy and paste this file to make a backup of the original.
On line 2921, comment out the first 3 lines and then add a few more:
We need to add these extra files into our boot image when MDT builds it. The easiest way to do that is to use the “Extra Files” section. First though we need to make the extra files folder.
I like to put this in the root of my deployment share. So I’ve created C:\MDTBuildLab\ExtraFiles.
Put the unattend.xml directly in the root of this folder. Then create a new folder called “Windows”
Inside of the “Windows” folder create a “System32” folder
Then inside of that place your wlan.cmd and Wi-Fi-Mockingjay.xml
I’ll show you how to add these to MDT, but you can also use ExtraFiles in OSDBuilder by adding the content to C:\OSDBuilder\Content\ExtraFiles.
Go to the properties of your Deployment Share and click on Windows PE tab. Select x64 as your platform.
Paste (or browse to it) your ExtraFiles directory here:
Right click your Deployment Share and click “Update Deployment Share”
Select “Completely regenerate the boot images”
Click Next and complete the wizard.
Once complete, you’ll need to create a bootable USB with the ISO exported to C:\MDTBuildLab\Boot. If you already have a bootable USB, just update the boot.wim file in D:\Sources\boot.wim. Or use this script:
xcopy “C:\MDTBuildLab\Boot\LiteTouchPE_x64.wim” g:\sources\boot.wim /f /y
Now let’s boot a test device to see if it works:
Add Wifi connection to Task Sequence
Great we have wireless working in WinPE! But if we don’t also ensure that our task sequence connects to Wifi after the system reboots out of WinPE, then the last half of the TS won’t complete and the build will fail (unless you want to manually connect).
In my Task Sequence, I’ve created two “Run Command Line” steps after the “Install Operating System” step.
Copy Wifi Script
xcopy x:\windows\system32\wlan.cmd %OSDISK%\Temp\
Copy Wifi XML
xcopy x:\windows\system32\Wi-Fi-Mockingjay.xml %OSDISK%\Temp\
Ok one last step to do! We need to ensure Windows connects to this network automatically before the task sequence runs after it has logged into the administrator account. To do this we need to modify the unattend.xml that is associated with the Task Sequence. Note that this is a different unattend.xml than the one we created for WinPE.
Browse to your Deployment Share > Control > Folder of your task sequence ID. In my case it’s just called “1809”
Edit this Unattend.xml (also a good idea to make a backup copy of this in case you make a mistake). Toward the bottom you will see a “FirstLogonCommands” section. We need add a new section BEFORE the Lite Touch new OS one.
Easiest way to do this is to duplicate the whole section (CTRL+D if you are using Notepad++) <SynchronousCommand>stuff </SynchronousCommand>, name it Wifi, and for the command use cmd /c C:\Temp\wlan.cmd. Also ensure that the order is set to 1.
Change the order of the wscript.exe %SystemDrive%\LTIBootstrap.vbs step to be 2.
Save the unattend.xml. Since this lives on the Deployment Share and outside of the boot image, there is no need to regenerate the boot image.
And that’s it! Enjoy your MDT now over glorious WiFi.