From db82d7de4e1067057f461c98e3d8164e8b701200 Mon Sep 17 00:00:00 2001 From: Old Character <167513064+Miiraak@users.noreply.github.com> Date: Sat, 15 Feb 2025 00:46:01 +0100 Subject: [PATCH] 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. --- tiny11maker.ps1 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tiny11maker.ps1 b/tiny11maker.ps1 index 03dfedd..53d495b 100644 --- a/tiny11maker.ps1 +++ b/tiny11maker.ps1 @@ -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"