I made an app in Visual Basic. And I want to run it in Windows PE - the stock PE you can get from Microsoft, not any distro such as BartPE. WindowsPE doesn't support .NET by default, but I think there has to be a way to install all libraries. I'm using 32-bit version of Windows PE 4.0 (Based on Windows 8.0) but I can also use the newest Windows PE 10.0.14393.0. Should I? The priority is to get the VB.NET app running. Thanks everyone!


This will work with any modern version of Windows PE (so the Windows 8 one is fine, as is the edition for Windows 10). I've personally used the Windows 8.1 ADK with success. In the feature selection stage of the installer, make sure you have Deployment Tools and of course WinPE.

Then you can run an appropriately modified version of this batch script as an administrator from the "Deployment and Imaging Tools Environment":

@echo off
set _=%CD%
set PF=C:\Program Files
if exist "C:\Program Files (x86)\" set PF=C:\Program Files (x86)
echo Preparing PE workspace...
call copype.cmd x86 scratch\ > nul
cd %_%
echo Mounting image...
dism /Mount-Wim /WimFile:scratch\media\sources\boot.wim /index:1 /MountDir:scratch\mount > nul
echo Injecting WMI packages...
dism /image:scratch\mount /Add-Package /PackagePath:"%PF%\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-WMI.cab" > nul
dism /image:scratch\mount /Add-Package /PackagePath:"%PF%\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-WMI_en-us.cab" > nul
echo Injecting .NET packages...
dism /image:scratch\mount /Add-Package /PackagePath:"%PF%\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-NetFX.cab" > nul
dism /image:scratch\mount /Add-Package /PackagePath:"%PF%\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-NetFx_en-us.cab" > nul
echo Adding files...
REM: Add commands to copy in the appropriate files here
REM: Or insert a "pause" so you can manually do it in Explorer
echo Unmounting image...
dism /Unmount-Wim /MountDir:scratch\mount /Commit > nul
echo Finishing up...
move scratch\media\sources\boot.wim boot.wim > nul
rmdir /s /q scratch > nul

The %PF% stuff is there so it can automatically detect where the Windows Kits folder is, which depends on the bitness of the technician computer. If you use a different version of the ADK, change all the instances of 8.1 to the folder name of your kit. The important part is where it adds the WMI and .NET packages. (The .NET one depends on WMI.) The final boot.wim file produced will be able to run .NET applications that are the same bitness as the WinPE environment.

  • You're awesome, thank you very much! – PetrMolek Nov 18 '16 at 14:19
  • @PetrMolek Glad I could help! If my answer completely solved the problem, you can click the check mark next to it to indicate to future readers that this is the solution. – Ben N Nov 18 '16 at 16:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.