tabs-not-spaces / Intune.USB.Creator

A module containing tools to assist with the creation of a bootable WinPE USB used to provision devices for enrollment to Intune.
GNU General Public License v3.0
132 stars 46 forks source link

Intune.USB.Creator

Build Status PowerShell Gallery PSGallery Downloads

⚠⚠⚠ BEFORE RAISING ANY ISSUES ⚠⚠⚠

Without a doubt the most common "issue" raised refers to the following error that people recieve while trying to capture the Autopilot config file.

WARNING: Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Please note, this is NOT an issue, but the way to resolve it is simple - you are missing the msal.ps module in the PowerShell 5.1 & Core module locations. Open up BOTH terminals and install the msal.ps module before attempting to use this tool.

Any issues raised regarding this "error" will be immediately closed moving forward.

Summary

A module containing tools to assist with the creation of a bootable WinPE USB used to provision devices for enrollment to Intune.

Pre-Reqs

How to use

Pretty simple one here.. Only one exposed function

$params = @{
    winPEPath = "https://githublfs.blob.core.windows.net/storage/WinPE.zip"
    windowsIsoPath = "C:\path\to\win10.iso"
    getAutopilotCfg = $true
    imageIndex = 5 # Optional parameter
    diskNum = 1 # Optional parameter
}
Publish-ImageToUSB @params

What happens

Running the Publish-ImageToUSB function will configure a USB with a copy of WinPE, Windows 10 & the required provisioning scripts.

Publish-ImageToUSB

Once you've configured a USB with the tool, using it as a boot device will launch WinPE and kick off "Invoke-Provision.ps1" to configure Windows 10 on the device and apply the Autopilot configuration file.

Invoke-Provision.ps1

Once the provisioning script has completed, removing the USB and rebooting the device will bring us to the Windows 10 OOBE and eventually the Autopilot enrollment screen from the configuration file we captured in the first step.

OOBE

What's next?

If time permits, I'm looking to add the following additions to the solution:

Caveat Emptor

I'm providing this solution as an educational tool to assist the IT-Pro community with absolutely ZERO warranties or guarantees - I know it works for me, but if it doesn't for you - read the code and fix it..

If you find a problem and want to contribute - please do! I love community involvement and will be as active as my schedule allows.

Lastly, I'm providing a copy of WinPE (which also includes the "Invoke-Provision.ps1" file) on a personal Azure storage account. This will stay up as long as it doesn't begin to cost me too much - if it does, I will take it down. If there are better options, please let me know.

Release Notes