mirror of
https://github.com/ntdevlabs/tiny11builder.git
synced 2025-12-18 09:24:12 +00:00
Improve image index input validation in tiny11maker.ps1
- Added validation to ensure the entered index is valid by checking against available indices in the Windows image file. - Introduced a loop to repeatedly prompt the user until a valid index is provided.
This commit is contained in:
parent
d37e3e1b01
commit
0241e51814
1 changed files with 7 additions and 1 deletions
|
|
@ -87,7 +87,13 @@ Start-Sleep -Seconds 2
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Getting image information:"
|
Write-Host "Getting image information:"
|
||||||
Get-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim
|
Get-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim
|
||||||
$index = Read-Host "Please enter the image index"
|
|
||||||
|
$index = Read-Host "Please enter the image index : "
|
||||||
|
$ImagesIndex = (Get-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim).ImageIndex
|
||||||
|
while ($ImagesIndex -notcontains $index) {
|
||||||
|
$index = Read-Host "Please enter a valide image index : "
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Mounting Windows image. This may take a while."
|
Write-Host "Mounting Windows image. This may take a while."
|
||||||
$wimFilePath = "$ScratchDisk\tiny11\sources\install.wim"
|
$wimFilePath = "$ScratchDisk\tiny11\sources\install.wim"
|
||||||
& takeown "/F" $wimFilePath
|
& takeown "/F" $wimFilePath
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue