mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
Fix USB creation when install.wim is read-only (#4910)
* fix: allow USB WIM splitting * test: guard USB WIM splitting fix
This commit is contained in:
@@ -241,6 +241,7 @@ function Invoke-WinUtilISOWriteUSB {
|
|||||||
$wimSizeMB = [math]::Round((Get-Item $installWim).Length / 1MB)
|
$wimSizeMB = [math]::Round((Get-Item $installWim).Length / 1MB)
|
||||||
if ($wimSizeMB -gt 3800) {
|
if ($wimSizeMB -gt 3800) {
|
||||||
Log "install.wim is $wimSizeMB MB - splitting for FAT32 compatibility... This will take several minutes."
|
Log "install.wim is $wimSizeMB MB - splitting for FAT32 compatibility... This will take several minutes."
|
||||||
|
Set-ItemProperty -LiteralPath $installWim -Name IsReadOnly -Value $false
|
||||||
$splitDest = Join-Path $usbDrive "sources\install.swm"
|
$splitDest = Join-Path $usbDrive "sources\install.swm"
|
||||||
New-Item -ItemType Directory -Path (Split-Path $splitDest) -Force
|
New-Item -ItemType Directory -Path (Split-Path $splitDest) -Force
|
||||||
Split-WindowsImage -ImagePath $installWim -SplitImagePath $splitDest -FileSize 3800 -CheckIntegrity
|
Split-WindowsImage -ImagePath $installWim -SplitImagePath $splitDest -FileSize 3800 -CheckIntegrity
|
||||||
|
|||||||
@@ -191,6 +191,18 @@ Describe "Win11 Creator setup media" {
|
|||||||
$confirmationIndex | Should -BeGreaterThan $guardIndex
|
$confirmationIndex | Should -BeGreaterThan $guardIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It "clears install.wim read-only attribute before FAT32 splitting" {
|
||||||
|
$splitGuardIndex = $script:writeUsbFunction.IndexOf('$wimSizeMB -gt 3800')
|
||||||
|
$readOnlyResetIndex = $script:writeUsbFunction.IndexOf(
|
||||||
|
'Set-ItemProperty -LiteralPath $installWim -Name IsReadOnly -Value $false'
|
||||||
|
)
|
||||||
|
$splitCommandIndex = $script:writeUsbFunction.IndexOf('Split-WindowsImage')
|
||||||
|
|
||||||
|
$splitGuardIndex | Should -BeGreaterThan -1
|
||||||
|
$readOnlyResetIndex | Should -BeGreaterThan $splitGuardIndex
|
||||||
|
$splitCommandIndex | Should -BeGreaterThan $readOnlyResetIndex
|
||||||
|
}
|
||||||
|
|
||||||
It "maps Windows edition names to setup edition IDs" {
|
It "maps Windows edition names to setup edition IDs" {
|
||||||
. ([scriptblock]::Create($script:editionIdFunction))
|
. ([scriptblock]::Create($script:editionIdFunction))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user