mirror of
https://github.com/ntdevlabs/tiny11builder.git
synced 2025-03-14 02:25:31 +00:00
Merge dc87713f97
into af69a48265
This commit is contained in:
commit
1d24f785f6
@ -1,19 +1,46 @@
|
|||||||
# Enable debugging
|
# Enable debugging
|
||||||
#Set-PSDebug -Trace 1
|
#Set-PSDebug -Trace 1
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Scripts to build a trimmed-down Windows 11 image.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This is a script created to automate the build of a streamlined Windows 11 image, similar to tiny10.
|
||||||
|
My main goal is to use only Microsoft utilities like DISM, and no utilities from external sources.
|
||||||
|
The only executable included is oscdimg.exe, which is provided in the Windows ADK and it is used to create bootable ISO images.
|
||||||
|
|
||||||
|
.PARAMETER Scratch
|
||||||
|
Drive letter of the desired scratch disk (eg: D)
|
||||||
|
|
||||||
|
.PARAMETER Iso
|
||||||
|
Drive letter given to the mounted iso (eg: E)
|
||||||
|
|
||||||
|
.VALIDE CALL
|
||||||
|
.\tiny11maker.ps1 E D
|
||||||
|
.\tiny11maker.ps1 -ISO E -SCRATCH D
|
||||||
|
.\tiny11maker.ps1 -SCRATCH D -ISO E
|
||||||
|
.\tiny11maker.ps1
|
||||||
|
|
||||||
|
*If you put only the value in parameters the first one must be the iso mounted. The second is the scratch drive.
|
||||||
|
prefer the use of "-ISO" as you can put in the order you want.
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
Auteur: ntdevlabs
|
||||||
|
Date: 05-06-24
|
||||||
|
#>
|
||||||
|
|
||||||
param (
|
param (
|
||||||
[ValidatePattern('^[c-zC-Z]$')]
|
[ValidatePattern('^[c-zC-Z]$')][string]$ISO,
|
||||||
[string]$ScratchDisk
|
[ValidatePattern('^[c-zC-Z]$')][string]$SCRATCH
|
||||||
)
|
)
|
||||||
|
|
||||||
if (-not $ScratchDisk) {
|
if (-not $SCRATCH) {
|
||||||
$ScratchDisk = $PSScriptRoot -replace '[\\]+$', ''
|
$ScratchDisk = $PSScriptRoot -replace '[\\]+$', ''
|
||||||
} else {
|
} else {
|
||||||
$ScratchDisk = $ScratchDisk + ":"
|
$ScratchDisk = $SCRATCH + ":"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "Scratch disk set to $ScratchDisk"
|
|
||||||
|
|
||||||
# Check if PowerShell execution is restricted
|
# Check if PowerShell execution is restricted
|
||||||
if ((Get-ExecutionPolicy) -eq '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)"
|
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 +69,6 @@ if (! $myWindowsPrincipal.IsInRole($adminRole))
|
|||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Start the transcript and prepare the window
|
# Start the transcript and prepare the window
|
||||||
Start-Transcript -Path "$ScratchDisk\tiny11.log"
|
Start-Transcript -Path "$ScratchDisk\tiny11.log"
|
||||||
|
|
||||||
@ -54,7 +79,11 @@ Write-Host "Welcome to the tiny11 image creator! Release: 05-06-24"
|
|||||||
$hostArchitecture = $Env:PROCESSOR_ARCHITECTURE
|
$hostArchitecture = $Env:PROCESSOR_ARCHITECTURE
|
||||||
New-Item -ItemType Directory -Force -Path "$ScratchDisk\tiny11\sources" | Out-Null
|
New-Item -ItemType Directory -Force -Path "$ScratchDisk\tiny11\sources" | Out-Null
|
||||||
do {
|
do {
|
||||||
|
if (-not $ISO) {
|
||||||
$DriveLetter = Read-Host "Please enter the drive letter for the Windows 11 image"
|
$DriveLetter = Read-Host "Please enter the drive letter for the Windows 11 image"
|
||||||
|
} else {
|
||||||
|
$DriveLetter = $ISO
|
||||||
|
}
|
||||||
if ($DriveLetter -match '^[c-zC-Z]$') {
|
if ($DriveLetter -match '^[c-zC-Z]$') {
|
||||||
$DriveLetter = $DriveLetter + ":"
|
$DriveLetter = $DriveLetter + ":"
|
||||||
Write-Output "Drive letter set to $DriveLetter"
|
Write-Output "Drive letter set to $DriveLetter"
|
||||||
|
Loading…
Reference in New Issue
Block a user