Download Windows ISO
https://www.microsoft.com/en-us/software-download/windows11
Export Autopilot
Open Powershell as Administrator
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name WindowsAutopilotIntune -MinimumVersion 5.4.0 -Force
Install-Module -Name Microsoft.Graph.Groups -Force
Install-Module -Name Microsoft.Graph.Authentication -Force
Install-Module Microsoft.Graph.Identity.DirectoryManagement -Force
Import-Module -Name WindowsAutopilotIntune -MinimumVersion 5.4
Import-Module -Name Microsoft.Graph.Groups
Import-Module -Name Microsoft.Graph.Authentication
Import-Module -Name Microsoft.Graph.Identity.DirectoryManagement
Connect to Entra in Powershell
Connect-MgGraph -Scopes "Device.ReadWrite.All", "DeviceManagementManagedDevices.ReadWrite.All", "DeviceManagementServiceConfig.ReadWrite.All", "Domain.ReadWrite.All", "Group.ReadWrite.All", "GroupMember.ReadWrite.All", "User.Read"
Export all autopilot profiles
Connect-MgGraph -Scopes "Device.ReadWrite.All", "DeviceManagementManagedDevices.ReadWrite.All", "DeviceManagementServiceConfig.ReadWrite.All", "Domain.ReadWrite.All", "Group.ReadWrite.All", "GroupMember.ReadWrite.All", "User.Read"
$AutopilotProfile = Get-AutopilotProfile
$targetDirectory = "C:\Autopilot"
$AutopilotProfile | ForEach-Object {
New-Item -ItemType Directory -Path "$targetDirectory\$($_.displayName)"
$_ | ConvertTo-AutopilotConfigurationJSON | Set-Content -Encoding Ascii "$targetDirectory\$($_.displayName)\AutopilotConfigurationFile.json"
}
Export drivers
Export-WindowsDriver –Online -Destination C:\DATA\Drivers
Insert data in to iso
Get the info from the original iso file, this one is mounted on your pc.
Dism /get-wiminfo /wimfile:"E:\sources\install.wim"
Create the wim file from the selected version
Dism /export-image /SourceImageFile:"E:\sources\install.wim" /SourceIndex:6 /DestinationImageFile:C:\DATA\WIM\install.wim /Compress:max /CheckIntegrity
Lets mount the wim file
Dism /mount-wim /wimfile:"C:\DATA\WIM\install.wim" /index:1 /mountdir:C:\DATA\Mount
Insert autopiltfile
After WIM is mounted – Copy AutopilotConfigurationFile.json to: %MountDir%\Windows\Provisioning\Autopilot\
Insert drivers
dism /image:C:\DATA\Mount /add-driver /driver:C:\temp\drivers\ /recurse
WIM file commit and unmount
Dism /Commit-Image /MountDir:C:\DATA\Mount
Dism /Unmount-Image /MountDir:C:\DATA\Mount /commit
Split file size to USB
Dism /Split-Image /ImageFile:"C:\DATA\WIM\install.wim" /SWMFile:"C:\DATA\SWM\install.SWM" /FileSize:3800
Copy SWM files to sources (USB)
Troubelshooting – OOBE Problems
Shift-F10
MDMDiagnosticsTool.exe -area Autopilot;TPM -cab c:\autopilot.cab
Sources
https://www.simsenblog.dk/2022/02/06/bootable-windows-11-incl-autopilot-json-file/
https://learn.microsoft.com/en-us/autopilot/tutorial/existing-devices/setup-autopilot-profile