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

Typo & Panther folder exists check #27

Closed devel1988wyc closed 3 years ago

devel1988wyc commented 3 years ago

I've Noticed the unatteded file didn't want to copy 1) folder did not exist. 2) typo in the looking for unattented.xml

region Copying over unattended.xml

Write-Host "`nLooking for unattended.xml.." -ForegroundColor Yellow
if (Test-Path "$($usb.winPESource)scripts\unattended.xml" -ErrorAction SilentlyContinue) {
    if(-not (Test-Path "$($usb.scRoot)Windows\Panther" -ErrorAction SilentlyContinue)){
        New-Item -Path "$($usb.scRoot)Windows\Panther" -ItemType Directory -Force | Out-Null
    }
    Write-Host "Found it! Copying over to scratch drive.." -ForegroundColor Green
    Copy-Item -Path "$($usb.winPESource)\scripts\unattended.xml" -Destination "$($usb.scRoot)Windows\Panther\unattended.xml" | Out-Null
}
else {
    Write-Host "Nothing found. Moving on.." -ForegroundColor Red
}
#endregion
jdvuyk commented 3 years ago

Agreed. This is really a bug in the implementation. I updated with the below.
NOTE: "unattend.xml" is the actual file name that is used in normal deployments

_#region Copying over unattend.xml Write-Host "`nLooking for unattend.xml.." -ForegroundColor Yellow if (Test-Path "$($usb.winPESource)scripts\unattend.xml" -ErrorAction SilentlyContinue) { Write-Host "Unattend file found! Copying over to scratch drive.." -ForegroundColor Green New-Item -Type dir "$($usb.scRoot)Windows\Panther" | Out-Null Copy-Item -Path "$($usb.winPESource)\scripts\unattend.xml" -Destination "$($usb.scRoot)Windows\Panther\unattend.xml" | Out-Null } else { Write-Host "Nothing found." -ForegroundColor Red }

endregion_