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
131 stars 43 forks source link

Injecting AutPilot Configuration file error #7

Closed Ezmoshow closed 4 years ago

Ezmoshow commented 4 years ago

Hey This is great stuff! I really dig this!

Although i had this running at one point successfully (using vanilla ISO from Microsoft), I am now running into a weird issue here unfortunately when using a sysprepped version of a wim file.

I am getting a "Could not find a part of the path 'W:\Windows\Provisioning\Autopilot\AutopilotConfigurationFile.json' when trying to inject the AutoPilot Configuration File...

Error at Line 433 of the invoke-provision.ps1 script...

Any suggestions here?

Thanks!

Ezmoshow commented 4 years ago

Just adding... the above still occurs, not sure why, but everythign seems to be working normally despite that ConfigFile.json injection error.

Ezmoshow commented 4 years ago

it turns out, Sysprepped images (Win10 1903 and 1909) will remove the Autopilot directory once "generalized"... Any chance we can "inject" that folder back in (via this script)?

tabs-not-spaces commented 4 years ago

Yeah we could just check if the path exists, if it doesn't create first.

Feel like giving it a go? It'd be an easy fix actually.

On Sat, 11 Jul 2020, 5:02 am Ezmoshow, notifications@github.com wrote:

it turns out, Sysprepped images (Win10 1903 and 1909) will remove the Autopilot directory once "generalized"... Any chance we can "inject" that folder back in (via this script)?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tabs-not-spaces/Intune.USB.Creator/issues/7#issuecomment-656836054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDA4LPRJD2SZPCZAN7ZR73R25QVNANCNFSM4OVC7NDQ .

Ezmoshow commented 4 years ago

I'm a totally n00b script kiddy, but i added to the "if" statement from line 431:

if (Test-Path "$PSScriptRoot\AutopilotConfigurationFile.json" -ErrorAction SilentlyContinue) { Write-Host "nInjecting AutoPilot configuration file.." -ForegroundColor Yellow if (test-path "$($usb.scRoot)Windows\Provisioning\Autopilot"){ Copy-Item "$PSScriptRoot\AutopilotConfigurationFile.json" -Destination "$($usb.scRoot)Windows\Provisioning\Autopilot\AutopilotConfigurationFile.json" -Force | Out-Null } else { New-Item -ItemType directory -Path "$($usb.scRoot)Windows\Provisioning\Autopilot" Copy-Item "$PSScriptRoot\AutopilotConfigurationFile.json" -Destination "$($usb.scRoot)Windows\Provisioning\Autopilot\AutopilotConfigurationFile.json" -Force | Out-Null } } ` ...it checks if Autopilot directory is there... if not, create it first and then copy over the AutopilotConfiguration JSON file.