new parameter and improvement

- Updated script parameters to include a new $p_IsoDisk parameter.
- Renamed $ScratchDisk to $p_ScratchDisk throughout the script.
- Added logic to handle $p_IsoDisk, prompting user if not provided.
- Removed output of scratch disk setting.
This commit is contained in:
Old Character 2025-02-15 00:46:01 +01:00 committed by GitHub
parent af69a48265
commit db82d7de4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,17 +3,16 @@
param (
[ValidatePattern('^[c-zC-Z]$')]
[string]$ScratchDisk
[string]$p_ScratchDisk,
[string]$p_IsoDisk
)
if (-not $ScratchDisk) {
if (-not $p_ScratchDisk) {
$ScratchDisk = $PSScriptRoot -replace '[\\]+$', ''
} else {
$ScratchDisk = $ScratchDisk + ":"
$ScratchDisk = $p_ScratchDisk + ":"
}
Write-Output "Scratch disk set to $ScratchDisk"
# Check if PowerShell execution is restricted
if ((Get-ExecutionPolicy) -eq 'Restricted') {
Write-Host "Your current PowerShell Execution Policy is set to Restricted, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)"
@ -42,8 +41,6 @@ if (! $myWindowsPrincipal.IsInRole($adminRole))
exit
}
# Start the transcript and prepare the window
Start-Transcript -Path "$ScratchDisk\tiny11.log"
@ -54,7 +51,11 @@ Write-Host "Welcome to the tiny11 image creator! Release: 05-06-24"
$hostArchitecture = $Env:PROCESSOR_ARCHITECTURE
New-Item -ItemType Directory -Force -Path "$ScratchDisk\tiny11\sources" | Out-Null
do {
$DriveLetter = Read-Host "Please enter the drive letter for the Windows 11 image"
if (-not $p_IsoDisk) {
$DriveLetter = Read-Host "Please enter the drive letter for the Windows 11 image"
} else {
$DriveLetter = $p_IsoDisk
}
if ($DriveLetter -match '^[c-zC-Z]$') {
$DriveLetter = $DriveLetter + ":"
Write-Output "Drive letter set to $DriveLetter"