mirror of
https://github.com/ntdevlabs/tiny11builder.git
synced 2025-09-16 22:18:03 +02:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
00e7d8a151 | ||
![]() |
af06d5ab57 | ||
![]() |
b8cd6e9003 | ||
![]() |
44da0a4b4a | ||
![]() |
4a24bff48b | ||
![]() |
a3bb93e0d9 | ||
![]() |
e5752915f6 | ||
![]() |
bde07ab406 | ||
![]() |
ecd3c8310e | ||
![]() |
13b88eeea7 | ||
![]() |
35aa44d4e3 | ||
![]() |
88c058a383 | ||
![]() |
cc7e53647e | ||
![]() |
ca2f2dff7e | ||
![]() |
9af52a8206 | ||
![]() |
5da84b9737 |
212
README.md
212
README.md
@@ -1,136 +1,122 @@
|
|||||||
# tiny11builder
|
# tiny11builder
|
||||||
Scripts to build a trimmed-down Windows 11 image - now in PowerShell!
|
*Scripts to build a trimmed-down Windows 11 image - now in **PowerShell**!*
|
||||||
<br>
|
|
||||||
Tiny11 builder, now completely overhauled.
|
|
||||||
</br>
|
|
||||||
|
|
||||||
Latest Update (September 6, 2025)
|
## Introduction :
|
||||||
It's been a while, but a new update is here!
|
Tiny11 builder, now completely overhauled. <br> After more than a year (for which I am so sorry) of no updates, tiny11 builder is now a much more complete and flexible solution - one script fits all. Also, it is a steppingstone for an even more fleshed-out solution.
|
||||||
|
|
||||||
Added removal for Copilot and the new Outlook for Windows client.
|
|
||||||
|
|
||||||
Switched to a more efficient compression method (/Compress:recovery), resulting in significantly smaller ISO files!
|
|
||||||
|
|
||||||
Included new tweaks to proactively block the reinstallation of certain unwanted apps.
|
|
||||||
|
|
||||||
After more than a year (for which I am so sorry) of no updates, tiny11 builder is now a much more complete and flexible solution - one script fits all. Also, it is a steppingstone for an even more fleshed-out solution.
|
|
||||||
<br>
|
|
||||||
You can now use it on ANY Windows 11 release (not just a specific build), as well as ANY language or architecture.
|
You can now use it on ANY Windows 11 release (not just a specific build), as well as ANY language or architecture.
|
||||||
This is made possible thanks to the much-improved scripting capabilities of PowerShell, compared to the older Batch release.
|
This is made possible thanks to the much-improved scripting capabilities of PowerShell, compared to the older Batch release.
|
||||||
</br>
|
|
||||||
Since it is written in PowerShell, you need to set the execution policy to Unrestricted, so that you could run the script.
|
|
||||||
If you haven't done this before, make sure to run Set-ExecutionPolicy unrestricted as administrator in PowerShell before running the script, otherwise it would just crash.
|
|
||||||
|
|
||||||
This is a script created to automate the build of a streamlined Windows 11 image, similar to tiny11.
|
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 script has also been updated to use DISM's recovery compression, resulting in a much smaller final ISO size. The only other executable included is oscdimg.exe, which is provided in the Windows ADK and it is used to create bootable ISO images.
|
The script has also been updated to use DISM's recovery compression, resulting in a much smaller final ISO size, and no utilities from external sources. The only other executable included is **oscdimg.exe**, which is provided in the Windows ADK and it is used to create bootable ISO images.
|
||||||
Also included is an unattended answer file, which is used to bypass the Microsoft Account on OOBE and to deploy the image with the /compact flag.
|
Also included is an unattended answer file, which is used to bypass the Microsoft Account on OOBE and to deploy the image with the `/compact` flag.
|
||||||
It's open-source, so feel free to add or remove anything you want! Feedback is also much appreciated.
|
It's open-source, **so feel free to add or remove anything you want!** Feedback is also much appreciated.
|
||||||
|
|
||||||
Also, for the very first time, introducing tiny11 core builder! A more powerful script, designed for a quick and dirty development testbed. Just the bare minimum, none of the fluff.
|
Also, for the very first time, **introducing tiny11 core builder**! A more powerful script, designed for a quick and dirty development testbed. Just the bare minimum, none of the fluff.
|
||||||
This script generates a significantly reduced Windows 11 image. However, it's not suitable for regular use due to its lack of serviceability - you can't add languages, updates, or features post-creation. tiny11 Core is not a full Windows 11 substitute but a rapid testing or development tool, potentially useful for VM environments.
|
This script generates a significantly reduced Windows 11 image. However, **it's not suitable for regular use due to its lack of serviceability - you can't add languages, updates, or features post-creation**. tiny11 Core is not a full Windows 11 substitute but a rapid testing or development tool, potentially useful for VM environments.
|
||||||
|
|
||||||
Instructions:
|
---
|
||||||
Download Windows 11 from the Microsoft website (https://www.microsoft.com/software-download/windows11)
|
|
||||||
|
|
||||||
Mount the downloaded ISO image using Windows Explorer.
|
## ⚠️ Script versions:
|
||||||
|
- **tiny11maker.ps1** : The regular script, which removes a lot of bloat but keeps the system serviceable. You can add languages, updates, and features post-creation. This is the recommended script for regular use.
|
||||||
|
- ⚠️ **tiny11coremaker.ps1** : The core script, which removes even more bloat but also removes the ability to service the image. You cannot add languages, updates, or features post-creation. This is recommended for quick testing or development use.
|
||||||
|
|
||||||
Run the script and follow the on-screen prompts (selecting the drive letter and image SKU).
|
## Instructions:
|
||||||
|
1. Download Windows 11 from the [Microsoft website](https://www.microsoft.com/software-download/windows11) or [Rufus](https://github.com/pbatard/rufus)
|
||||||
|
2. Mount the downloaded ISO image using Windows Explorer.
|
||||||
|
3. Open **PowerShell 5.1** as Administrator.
|
||||||
|
5. Change the script execution policy :
|
||||||
|
```powershell
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process
|
||||||
|
```
|
||||||
|
> Using `-Scope Process` you keep your original policy intact as this change only lasts for the current PowerShell session.
|
||||||
|
|
||||||
Sit back and relax :)
|
6. Start the script :
|
||||||
|
```powershell
|
||||||
|
C:/path/to/your/tiny11/script.ps1 -ISO <letter> -SCRATCH <letter>
|
||||||
|
```
|
||||||
|
> You can see of the script by running the `get-help` command.
|
||||||
|
|
||||||
When the image is completed, you will see it in the folder where the script was extracted, with the name tiny11.iso
|
6. Select the drive letter where the image is mounted (only the letter, no colon (:))
|
||||||
|
7. Select the SKU that you want the image to be based.
|
||||||
|
8. Sit back and relax :)
|
||||||
|
9. When the image is completed, you will see it in the folder where the script was extracted, with the name tiny11.iso
|
||||||
|
|
||||||
What is removed:
|
---
|
||||||
Clipchamp
|
|
||||||
|
|
||||||
News
|
## What is removed:
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Tiny11maker</th>
|
||||||
|
<th>Tiny11coremaker</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>Clipchamp</li>
|
||||||
|
<li>News</li>
|
||||||
|
<li>Weather</li>
|
||||||
|
<li>Xbox</li>
|
||||||
|
<li>GetHelp</li>
|
||||||
|
<li>GetStarted</li>
|
||||||
|
<li>Office Hub</li>
|
||||||
|
<li>Solitaire</li>
|
||||||
|
<li>PeopleApp</li>
|
||||||
|
<li>PowerAutomate</li>
|
||||||
|
<li>ToDo</li>
|
||||||
|
<li>Alarms</li>
|
||||||
|
<li>Mail and Calendar</li>
|
||||||
|
<li>Feedback Hub</li>
|
||||||
|
<li>Maps</li>
|
||||||
|
<li>Sound Recorder</li>
|
||||||
|
<li>Your Phone</li>
|
||||||
|
<li>Media Player</li>
|
||||||
|
<li>QuickAssist</li>
|
||||||
|
<li>Internet Explorer</li>
|
||||||
|
<li>Tablet PC Math</li>
|
||||||
|
<li>Edge</li>
|
||||||
|
<li>OneDrive</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>all from regular tiny +</li>
|
||||||
|
<li>Windows Component Store (WinSxS)</li>
|
||||||
|
<li>Windows Defender (only disabled, can be enabled back if needed)</li>
|
||||||
|
<li>Windows Update (wouldn't work without WinSxS, enabling it would put the system in a state of failure)</li>
|
||||||
|
<li>WinRE</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
Weather
|
Keep in mind that **you cannot add back features in tiny11 core**! <br>
|
||||||
|
|
||||||
Xbox (although Xbox Identity provider is still here, so it should be possible to be reinstalled with no issues)
|
|
||||||
|
|
||||||
GetHelp
|
|
||||||
|
|
||||||
GetStarted
|
|
||||||
|
|
||||||
Office Hub
|
|
||||||
|
|
||||||
Solitaire
|
|
||||||
|
|
||||||
PeopleApp
|
|
||||||
|
|
||||||
PowerAutomate
|
|
||||||
|
|
||||||
ToDo
|
|
||||||
|
|
||||||
Alarms
|
|
||||||
|
|
||||||
Mail and Calendar
|
|
||||||
|
|
||||||
Feedback Hub
|
|
||||||
|
|
||||||
Maps
|
|
||||||
|
|
||||||
Sound Recorder
|
|
||||||
|
|
||||||
Your Phone
|
|
||||||
|
|
||||||
Media Player
|
|
||||||
|
|
||||||
QuickAssist
|
|
||||||
|
|
||||||
Internet Explorer
|
|
||||||
|
|
||||||
Tablet PC Math
|
|
||||||
|
|
||||||
Edge
|
|
||||||
|
|
||||||
OneDrive
|
|
||||||
|
|
||||||
Copilot
|
|
||||||
|
|
||||||
Outlook for Windows (new)
|
|
||||||
|
|
||||||
For tiny11 core:
|
|
||||||
all of the above +
|
|
||||||
|
|
||||||
Windows Component Store (WinSxS)
|
|
||||||
|
|
||||||
Windows Defender (only disabled, can be enabled back if needed)
|
|
||||||
|
|
||||||
Windows Update (Windows Update wouldn't work anyway without WinSxS, so enabling it would only put the system in a state where it would try to update but fail spectacularly)
|
|
||||||
|
|
||||||
WinRE
|
|
||||||
|
|
||||||
<br>
|
|
||||||
Keep in mind that you cannot add back features in tiny11 core!
|
|
||||||
</br>
|
|
||||||
<br>
|
|
||||||
You will be asked during image creation if you want to enable .net 3.5 support!
|
You will be asked during image creation if you want to enable .net 3.5 support!
|
||||||
</br>
|
|
||||||
|
|
||||||
Known issues:
|
---
|
||||||
Although Edge is removed, there are some remnants in the Settings. But the app in itself is deleted. You can install any browser using WinGet (after you update the app using Microsoft Store). If you want Edge, Copilot and Web Search back, simply install Edge using Winget: winget install edge.
|
|
||||||
|
|
||||||
<br>
|
## Known issues:
|
||||||
Note: You might have to update Winget before being able to install any apps, using Microsoft Store.
|
- Although Edge is removed, there are some remnants in the Settings, but the app in itself is deleted.
|
||||||
<br>
|
- You might have to update Winget before being able to install any apps, using Microsoft Store.
|
||||||
</br>
|
- Outlook and Dev Home might reappear after some time. This is an ongoing battle, though the latest script update tries to prevent this more aggressively.
|
||||||
2. Outlook and Dev Home might reappear after some time. This is an ongoing battle, though the latest script update tries to prevent this more aggressively.
|
- If you are using this script on arm64, you might see a glimpse of an error while running the script. This is caused by the fact that the arm64 image doesn't have OneDriveSetup.exe included in the System32 folder.
|
||||||
<br>
|
|
||||||
</br>
|
|
||||||
3. If you are using this script on arm64, you might see a glimpse of an error while running the script. This is caused by the fact that the arm64 image doesn't have OneDriveSetup.exe included in the System32 folder.
|
|
||||||
|
|
||||||
Features to be implemented:
|
---
|
||||||
~~disabling telemetry~~ (Implemented in the 04-29-24 release!)
|
|
||||||
|
|
||||||
~~more ad suppression~~ (Partially implemented in the 09-06-25 release!)
|
## Features to be implemented:
|
||||||
|
- ~~disabling telemetry~~ (Implemented in the 04-29-24 release!)
|
||||||
improved language and arch detection
|
- ~~more ad suppression~~ (Partially implemented in the 09-06-25 release!)
|
||||||
|
- improved language and arch detection
|
||||||
more flexibility in what to keep and what to delete
|
- more flexibility in what to keep and what to delete
|
||||||
|
- maybe a GUI???
|
||||||
maybe a GUI???
|
|
||||||
|
|
||||||
And that's pretty much it for now!
|
And that's pretty much it for now!
|
||||||
|
## ❤️ Support the Project
|
||||||
|
|
||||||
|
If this project has helped you, please consider showing your support! A small donation helps me dedicate more time to projects like this.
|
||||||
|
Thank you!
|
||||||
|
|
||||||
|
**[Patreon](http://patreon.com/ntdev) | [PayPal](http://paypal.me/ntdev2) | [Ko-fi](http://ko-fi.com/ntdev)**
|
||||||
Thanks for trying it and let me know how you like it!
|
Thanks for trying it and let me know how you like it!
|
||||||
|
477
tiny11maker.ps1
477
tiny11maker.ps1
@@ -1,24 +1,81 @@
|
|||||||
|
<#
|
||||||
|
.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 ISO
|
||||||
|
Drive letter given to the mounted iso (eg: E)
|
||||||
|
|
||||||
|
.PARAMETER SCRATCH
|
||||||
|
Drive letter of the desired scratch disk (eg: D)
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\tiny11maker.ps1 E D
|
||||||
|
.\tiny11maker.ps1 -ISO E -SCRATCH D
|
||||||
|
.\tiny11maker.ps1 -SCRATCH D -ISO E
|
||||||
|
.\tiny11maker.ps1
|
||||||
|
|
||||||
|
*If you ordinal parameters the first one must be the mounted iso. The second is the scratch drive.
|
||||||
|
prefer the use of full named parameter (eg: "-ISO") as you can put in the order you want.
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
Auteur: ntdevlabs
|
||||||
|
Date: 09-07-25
|
||||||
|
#>
|
||||||
|
|
||||||
|
#---------[ Parameters ]---------#
|
||||||
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"
|
#---------[ Functions ]---------#
|
||||||
|
function Set-RegistryValue {
|
||||||
|
param (
|
||||||
|
[string]$path,
|
||||||
|
[string]$name,
|
||||||
|
[string]$type,
|
||||||
|
[string]$value
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
& 'reg' 'add' $path '/v' $name '/t' $type '/d' $value '/f' | Out-Null
|
||||||
|
Write-Output "Set registry value: $path\$name"
|
||||||
|
} catch {
|
||||||
|
Write-Output "Error setting registry value: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Remove-RegistryValue {
|
||||||
|
param (
|
||||||
|
[string]$path
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
& 'reg' 'delete' $path '/f' | Out-Null
|
||||||
|
Write-Output "Removed registry value: $path"
|
||||||
|
} catch {
|
||||||
|
Write-Output "Error removing registry value: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#---------[ Execution ]---------#
|
||||||
# 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-Output "Your current PowerShell Execution Policy is set to Restricted, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)"
|
||||||
$response = Read-Host
|
$response = Read-Host
|
||||||
if ($response -eq 'yes') {
|
if ($response -eq 'yes') {
|
||||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm:$false
|
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm:$false
|
||||||
} else {
|
} else {
|
||||||
Write-Host "The script cannot be run without changing the execution policy. Exiting..."
|
Write-Output "The script cannot be run without changing the execution policy. Exiting..."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,23 +88,33 @@ $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWin
|
|||||||
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
|
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
|
||||||
if (! $myWindowsPrincipal.IsInRole($adminRole))
|
if (! $myWindowsPrincipal.IsInRole($adminRole))
|
||||||
{
|
{
|
||||||
Write-Host "Restarting Tiny11 image creator as admin in a new window, you can close this one."
|
Write-Output "Restarting Tiny11 image creator as admin in a new window, you can close this one."
|
||||||
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
|
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
|
||||||
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
|
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
|
||||||
$newProcess.Verb = "runas";
|
$newProcess.Verb = "runas";
|
||||||
[System.Diagnostics.Process]::Start($newProcess);
|
[System.Diagnostics.Process]::Start($newProcess);
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
Start-Transcript -Path "$ScratchDisk\tiny11.log"
|
|
||||||
|
if (-not (Test-Path -Path "$PSScriptRoot/autounattend.xml")) {
|
||||||
|
Invoke-RestMethod "https://raw.githubusercontent.com/ntdevlabs/tiny11builder/refs/heads/main/autounattend.xml" -OutFile "$PSScriptRoot/autounattend.xml"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start the transcript and prepare the window
|
||||||
|
Start-Transcript -Path "$PSScriptRoot\tiny11_$(get-date -f yyyyMMdd_HHmms).log"
|
||||||
|
|
||||||
$Host.UI.RawUI.WindowTitle = "Tiny11 image creator"
|
$Host.UI.RawUI.WindowTitle = "Tiny11 image creator"
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Welcome to the tiny11 image creator! Release: 09-04-25"
|
Write-Output "Welcome to the tiny11 image creator! Release: 09-07-25"
|
||||||
|
|
||||||
$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 {
|
||||||
$DriveLetter = Read-Host "Please enter the drive letter for the Windows 11 image"
|
if (-not $ISO) {
|
||||||
|
$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"
|
||||||
@@ -58,37 +125,41 @@ do {
|
|||||||
|
|
||||||
if ((Test-Path "$DriveLetter\sources\boot.wim") -eq $false -or (Test-Path "$DriveLetter\sources\install.wim") -eq $false) {
|
if ((Test-Path "$DriveLetter\sources\boot.wim") -eq $false -or (Test-Path "$DriveLetter\sources\install.wim") -eq $false) {
|
||||||
if ((Test-Path "$DriveLetter\sources\install.esd") -eq $true) {
|
if ((Test-Path "$DriveLetter\sources\install.esd") -eq $true) {
|
||||||
Write-Host "Found install.esd, converting to install.wim..."
|
Write-Output "Found install.esd, converting to install.wim..."
|
||||||
Get-WindowsImage -ImagePath $DriveLetter\sources\install.esd
|
Get-WindowsImage -ImagePath $DriveLetter\sources\install.esd
|
||||||
$index = Read-Host "Please enter the image index"
|
$index = Read-Host "Please enter the image index"
|
||||||
Write-Host ' '
|
Write-Output ' '
|
||||||
Write-Host 'Converting install.esd to install.wim. This may take a while...'
|
Write-Output 'Converting install.esd to install.wim. This may take a while...'
|
||||||
Export-WindowsImage -SourceImagePath $DriveLetter\sources\install.esd -SourceIndex $index -DestinationImagePath $ScratchDisk\tiny11\sources\install.wim -Compressiontype Maximum -CheckIntegrity
|
Export-WindowsImage -SourceImagePath $DriveLetter\sources\install.esd -SourceIndex $index -DestinationImagePath $ScratchDisk\tiny11\sources\install.wim -Compressiontype Maximum -CheckIntegrity
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Can't find Windows OS Installation files in the specified Drive Letter.."
|
Write-Output "Can't find Windows OS Installation files in the specified Drive Letter.."
|
||||||
Write-Host "Please enter the correct DVD Drive Letter.."
|
Write-Output "Please enter the correct DVD Drive Letter.."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Copying Windows image..."
|
Write-Output "Copying Windows image..."
|
||||||
Copy-Item -Path "$DriveLetter\*" -Destination "$ScratchDisk\tiny11" -Recurse -Force | Out-Null
|
Copy-Item -Path "$DriveLetter\*" -Destination "$ScratchDisk\tiny11" -Recurse -Force | Out-Null
|
||||||
Set-ItemProperty -Path "$ScratchDisk\tiny11\sources\install.esd" -Name IsReadOnly -Value $false > $null 2>&1
|
Set-ItemProperty -Path "$ScratchDisk\tiny11\sources\install.esd" -Name IsReadOnly -Value $false > $null 2>&1
|
||||||
Remove-Item "$ScratchDisk\tiny11\sources\install.esd" > $null 2>&1
|
Remove-Item "$ScratchDisk\tiny11\sources\install.esd" > $null 2>&1
|
||||||
Write-Host "Copy complete!"
|
Write-Output "Copy complete!"
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Getting image information:"
|
Write-Output "Getting image information:"
|
||||||
Get-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim
|
$ImagesIndex = (Get-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim).ImageIndex
|
||||||
$index = Read-Host "Please enter the image index"
|
while ($ImagesIndex -notcontains $index) {
|
||||||
Write-Host "Mounting Windows image. This may take a while."
|
Get-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim
|
||||||
|
$index = Read-Host "Please enter the image index"
|
||||||
|
}
|
||||||
|
Write-Output "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
|
||||||
& icacls $wimFilePath "/grant" "$($adminGroup.Value):(F)"
|
& icacls $wimFilePath "/grant" "$($adminGroup.Value):(F)"
|
||||||
try {
|
try {
|
||||||
Set-ItemProperty -Path $wimFilePath -Name IsReadOnly -Value $false -ErrorAction Stop
|
Set-ItemProperty -Path $wimFilePath -Name IsReadOnly -Value $false -ErrorAction Stop
|
||||||
} catch {
|
} catch {
|
||||||
|
# This block will catch the error and suppress it.
|
||||||
|
Write-Error "$wimFilePath not found"
|
||||||
}
|
}
|
||||||
New-Item -ItemType Directory -Force -Path "$ScratchDisk\scratchdir" > $null
|
New-Item -ItemType Directory -Force -Path "$ScratchDisk\scratchdir" > $null
|
||||||
Mount-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim -Index $index -Path $ScratchDisk\scratchdir
|
Mount-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\install.wim -Index $index -Path $ScratchDisk\scratchdir
|
||||||
@@ -98,9 +169,9 @@ $languageLine = $imageIntl -split '\n' | Where-Object { $_ -match 'Default syste
|
|||||||
|
|
||||||
if ($languageLine) {
|
if ($languageLine) {
|
||||||
$languageCode = $Matches[1]
|
$languageCode = $Matches[1]
|
||||||
Write-Host "Default system UI language code: $languageCode"
|
Write-Output "Default system UI language code: $languageCode"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Default system UI language code not found."
|
Write-Output "Default system UI language code not found."
|
||||||
}
|
}
|
||||||
|
|
||||||
$imageInfo = & 'dism' '/English' '/Get-WimInfo' "/wimFile:$($ScratchDisk)\tiny11\sources\install.wim" "/index:$index"
|
$imageInfo = & 'dism' '/English' '/Get-WimInfo' "/wimFile:$($ScratchDisk)\tiny11\sources\install.wim" "/index:$index"
|
||||||
@@ -113,16 +184,16 @@ foreach ($line in $lines) {
|
|||||||
if ($architecture -eq 'x64') {
|
if ($architecture -eq 'x64') {
|
||||||
$architecture = 'amd64'
|
$architecture = 'amd64'
|
||||||
}
|
}
|
||||||
Write-Host "Architecture: $architecture"
|
Write-Output "Architecture: $architecture"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $architecture) {
|
if (-not $architecture) {
|
||||||
Write-Host "Architecture information not found."
|
Write-Output "Architecture information not found."
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Mounting complete! Performing removal of applications..."
|
Write-Output "Mounting complete! Performing removal of applications..."
|
||||||
|
|
||||||
$packages = & 'dism' '/English' "/image:$($ScratchDisk)\scratchdir" '/Get-ProvisionedAppxPackages' |
|
$packages = & 'dism' '/English' "/image:$($ScratchDisk)\scratchdir" '/Get-ProvisionedAppxPackages' |
|
||||||
ForEach-Object {
|
ForEach-Object {
|
||||||
@@ -130,120 +201,169 @@ $packages = & 'dism' '/English' "/image:$($ScratchDisk)\scratchdir" '/Get-Provis
|
|||||||
$matches[1]
|
$matches[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$packagePrefixes = 'Clipchamp.Clipchamp_', 'Microsoft.BingNews_', 'Microsoft.BingWeather_', 'Microsoft.GamingApp_', 'Microsoft.GetHelp_', 'Microsoft.Getstarted_', 'Microsoft.MicrosoftOfficeHub_', 'Microsoft.MicrosoftSolitaireCollection_', 'Microsoft.People_', 'Microsoft.PowerAutomateDesktop_', 'Microsoft.Todos_', 'Microsoft.WindowsAlarms_', 'microsoft.windowscommunicationsapps_', 'Microsoft.WindowsFeedbackHub_', 'Microsoft.WindowsMaps_', 'Microsoft.WindowsSoundRecorder_', 'Microsoft.Xbox.TCUI_', 'Microsoft.XboxGamingOverlay_', 'Microsoft.XboxGameOverlay_', 'Microsoft.XboxSpeechToTextOverlay_', 'Microsoft.YourPhone_', 'Microsoft.ZuneMusic_', 'Microsoft.ZuneVideo_', 'MicrosoftCorporationII.MicrosoftFamily_', 'MicrosoftCorporationII.QuickAssist_', 'MicrosoftTeams_', 'Microsoft.549981C3F5F10_', 'Microsoft.Windows.Copilot', 'MSTeams_', 'Microsoft.OutlookForWindows_', 'Microsoft.Windows.Teams_', 'Microsoft.Copilot_'
|
|
||||||
|
$packagePrefixes = 'AppUp.IntelManagementandSecurityStatus',
|
||||||
|
'Clipchamp.Clipchamp',
|
||||||
|
'DolbyLaboratories.DolbyAccess',
|
||||||
|
'DolbyLaboratories.DolbyDigitalPlusDecoderOEM',
|
||||||
|
'Microsoft.BingNews',
|
||||||
|
'Microsoft.BingSearch',
|
||||||
|
'Microsoft.BingWeather',
|
||||||
|
'Microsoft.Copilot',
|
||||||
|
'Microsoft.Windows.CrossDevice',
|
||||||
|
'Microsoft.GamingApp',
|
||||||
|
'Microsoft.GetHelp',
|
||||||
|
'Microsoft.Getstarted',
|
||||||
|
'Microsoft.Microsoft3DViewer',
|
||||||
|
'Microsoft.MicrosoftOfficeHub',
|
||||||
|
'Microsoft.MicrosoftSolitaireCollection',
|
||||||
|
'Microsoft.MicrosoftStickyNotes',
|
||||||
|
'Microsoft.MixedReality.Portal',
|
||||||
|
'Microsoft.MSPaint',
|
||||||
|
'Microsoft.Office.OneNote',
|
||||||
|
'Microsoft.OfficePushNotificationUtility',
|
||||||
|
'Microsoft.OutlookForWindows',
|
||||||
|
'Microsoft.Paint',
|
||||||
|
'Microsoft.People',
|
||||||
|
'Microsoft.PowerAutomateDesktop',
|
||||||
|
'Microsoft.SkypeApp',
|
||||||
|
'Microsoft.StartExperiencesApp',
|
||||||
|
'Microsoft.Todos',
|
||||||
|
'Microsoft.Wallet',
|
||||||
|
'Microsoft.Windows.DevHome',
|
||||||
|
'Microsoft.Windows.Copilot',
|
||||||
|
'Microsoft.Windows.Teams',
|
||||||
|
'Microsoft.WindowsAlarms',
|
||||||
|
'Microsoft.WindowsCamera',
|
||||||
|
'microsoft.windowscommunicationsapps',
|
||||||
|
'Microsoft.WindowsFeedbackHub',
|
||||||
|
'Microsoft.WindowsMaps',
|
||||||
|
'Microsoft.WindowsSoundRecorder',
|
||||||
|
'Microsoft.WindowsTerminal',
|
||||||
|
'Microsoft.Xbox.TCUI',
|
||||||
|
'Microsoft.XboxApp',
|
||||||
|
'Microsoft.XboxGameOverlay',
|
||||||
|
'Microsoft.XboxGamingOverlay',
|
||||||
|
'Microsoft.XboxIdentityProvider',
|
||||||
|
'Microsoft.XboxSpeechToTextOverlay',
|
||||||
|
'Microsoft.YourPhone',
|
||||||
|
'Microsoft.ZuneMusic',
|
||||||
|
'Microsoft.ZuneVideo',
|
||||||
|
'MicrosoftCorporationII.MicrosoftFamily',
|
||||||
|
'MicrosoftCorporationII.QuickAssist',
|
||||||
|
'MSTeams',
|
||||||
|
'MicrosoftTeams',
|
||||||
|
'Microsoft.WindowsTerminal',
|
||||||
|
'Microsoft.549981C3F5F10'
|
||||||
|
|
||||||
$packagesToRemove = $packages | Where-Object {
|
$packagesToRemove = $packages | Where-Object {
|
||||||
$packageName = $_
|
$packageName = $_
|
||||||
$packagePrefixes -contains ($packagePrefixes | Where-Object { $packageName -like "$_*" })
|
$packagePrefixes -contains ($packagePrefixes | Where-Object { $packageName -like "*$_*" })
|
||||||
}
|
}
|
||||||
foreach ($package in $packagesToRemove) {
|
foreach ($package in $packagesToRemove) {
|
||||||
& 'dism' '/English' "/image:$($ScratchDisk)\scratchdir" '/Remove-ProvisionedAppxPackage' "/PackageName:$package"
|
& 'dism' '/English' "/image:$($ScratchDisk)\scratchdir" '/Remove-ProvisionedAppxPackage' "/PackageName:$package"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Output "Removing Edge:"
|
||||||
Write-Host "Removing Edge:"
|
|
||||||
Remove-Item -Path "$ScratchDisk\scratchdir\Program Files (x86)\Microsoft\Edge" -Recurse -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\scratchdir\Program Files (x86)\Microsoft\Edge" -Recurse -Force | Out-Null
|
||||||
Remove-Item -Path "$ScratchDisk\scratchdir\Program Files (x86)\Microsoft\EdgeUpdate" -Recurse -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\scratchdir\Program Files (x86)\Microsoft\EdgeUpdate" -Recurse -Force | Out-Null
|
||||||
Remove-Item -Path "$ScratchDisk\scratchdir\Program Files (x86)\Microsoft\EdgeCore" -Recurse -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\scratchdir\Program Files (x86)\Microsoft\EdgeCore" -Recurse -Force | Out-Null
|
||||||
& 'takeown' '/f' "$ScratchDisk\scratchdir\Windows\System32\Microsoft-Edge-Webview" '/r' | Out-Null
|
& 'takeown' '/f' "$ScratchDisk\scratchdir\Windows\System32\Microsoft-Edge-Webview" '/r' | Out-Null
|
||||||
& 'icacls' "$ScratchDisk\scratchdir\Windows\System32\Microsoft-Edge-Webview" '/grant' "$($adminGroup.Value):(F)" '/T' '/C' | Out-Null
|
& 'icacls' "$ScratchDisk\scratchdir\Windows\System32\Microsoft-Edge-Webview" '/grant' "$($adminGroup.Value):(F)" '/T' '/C' | Out-Null
|
||||||
Remove-Item -Path "$ScratchDisk\scratchdir\Windows\System32\Microsoft-Edge-Webview" -Recurse -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\scratchdir\Windows\System32\Microsoft-Edge-Webview" -Recurse -Force | Out-Null
|
||||||
Write-Host "Removing OneDrive:"
|
Write-Output "Removing OneDrive:"
|
||||||
& 'takeown' '/f' "$ScratchDisk\scratchdir\Windows\System32\OneDriveSetup.exe" | Out-Null
|
& 'takeown' '/f' "$ScratchDisk\scratchdir\Windows\System32\OneDriveSetup.exe" | Out-Null
|
||||||
& 'icacls' "$ScratchDisk\scratchdir\Windows\System32\OneDriveSetup.exe" '/grant' "$($adminGroup.Value):(F)" '/T' '/C' | Out-Null
|
& 'icacls' "$ScratchDisk\scratchdir\Windows\System32\OneDriveSetup.exe" '/grant' "$($adminGroup.Value):(F)" '/T' '/C' | Out-Null
|
||||||
Remove-Item -Path "$ScratchDisk\scratchdir\Windows\System32\OneDriveSetup.exe" -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\scratchdir\Windows\System32\OneDriveSetup.exe" -Force | Out-Null
|
||||||
Write-Host "Removal complete!"
|
Write-Output "Removal complete!"
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Loading registry..."
|
Write-Output "Loading registry..."
|
||||||
reg load HKLM\zCOMPONENTS $ScratchDisk\scratchdir\Windows\System32\config\COMPONENTS | Out-Null
|
reg load HKLM\zCOMPONENTS $ScratchDisk\scratchdir\Windows\System32\config\COMPONENTS | Out-Null
|
||||||
reg load HKLM\zDEFAULT $ScratchDisk\scratchdir\Windows\System32\config\default | Out-Null
|
reg load HKLM\zDEFAULT $ScratchDisk\scratchdir\Windows\System32\config\default | Out-Null
|
||||||
reg load HKLM\zNTUSER $ScratchDisk\scratchdir\Users\Default\ntuser.dat | Out-Null
|
reg load HKLM\zNTUSER $ScratchDisk\scratchdir\Users\Default\ntuser.dat | Out-Null
|
||||||
reg load HKLM\zSOFTWARE $ScratchDisk\scratchdir\Windows\System32\config\SOFTWARE | Out-Null
|
reg load HKLM\zSOFTWARE $ScratchDisk\scratchdir\Windows\System32\config\SOFTWARE | Out-Null
|
||||||
reg load HKLM\zSYSTEM $ScratchDisk\scratchdir\Windows\System32\config\SYSTEM | Out-Null
|
reg load HKLM\zSYSTEM $ScratchDisk\scratchdir\Windows\System32\config\SYSTEM | Out-Null
|
||||||
Write-Host "Bypassing system requirements(on the system image):"
|
Write-Output "Bypassing system requirements(on the system image):"
|
||||||
& 'reg' 'add' 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV1' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' 'SV1' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV2' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' 'SV2' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV1' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' 'SV1' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV2' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' 'SV2' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassCPUCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassCPUCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassRAMCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassRAMCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassSecureBootCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassSecureBootCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassStorageCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassStorageCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassTPMCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassTPMCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\MoSetup' '/v' 'AllowUpgradesWithUnsupportedTPMOrCPU' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 'REG_DWORD' '1'
|
||||||
Write-Host "Disabling Sponsored Apps:"
|
Write-Output "Disabling Sponsored Apps:"
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'OemPreInstalledAppsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'OemPreInstalledAppsEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'PreInstalledAppsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SilentInstalledAppsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SilentInstalledAppsEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' '/v' 'DisableWindowsConsumerFeatures' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' 'DisableWindowsConsumerFeatures' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'ContentDeliveryAllowed' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'ContentDeliveryAllowed' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start' '/v' 'ConfigureStartPins' '/t' 'REG_SZ' '/d' '{"pinnedList": [{}]}' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start' 'ConfigureStartPins' 'REG_SZ' '{"pinnedList": [{}]}'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'ContentDeliveryAllowed' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'FeatureManagementEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'ContentDeliveryAllowed' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEverEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'FeatureManagementEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SoftLandingEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'OemPreInstalledAppsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContentEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'PreInstalledAppsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-310093Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'PreInstalledAppsEverEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338388Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SilentInstalledAppsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338389Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SoftLandingEnabled' '/t' 'REG_DWORD' '/d' '0' '/f'| Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338393Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContentEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-353694Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-310093Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-353696Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-338388Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SystemPaneSuggestionsEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-338389Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\PushToInstall' 'DisablePushToInstall' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-338393Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\MRT' 'DontOfferThroughWUAU' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-353694Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Remove-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-353696Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Remove-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContentEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' 'DisableConsumerAccountStateContent' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SystemPaneSuggestionsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' 'DisableCloudOptimizedContent' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\PushToInstall' '/v' 'DisablePushToInstall' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Write-Output "Enabling Local Accounts on OOBE:"
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\MRT' '/v' 'DontOfferThroughWUAU' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE' 'BypassNRO' 'REG_DWORD' '1'
|
||||||
& 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions' '/f' | Out-Null
|
|
||||||
& 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps' '/f' | Out-Null
|
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' '/v' 'DisableConsumerAccountStateContent' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' '/v' 'DisableCloudOptimizedContent' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
|
||||||
Write-Host "Enabling Local Accounts on OOBE:"
|
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE' '/v' 'BypassNRO' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
|
||||||
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\scratchdir\Windows\System32\Sysprep\autounattend.xml" -Force | Out-Null
|
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\scratchdir\Windows\System32\Sysprep\autounattend.xml" -Force | Out-Null
|
||||||
Write-Host "Disabling Reserved Storage:"
|
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager' '/v' 'ShippedWithReserves' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Write-Output "Disabling Reserved Storage:"
|
||||||
Write-Host "Disabling BitLocker Device Encryption"
|
Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager' 'ShippedWithReserves' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\ControlSet001\Control\BitLocker' '/v' 'PreventDeviceEncryption' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Write-Output "Disabling BitLocker Device Encryption"
|
||||||
Write-Host "Disabling Chat icon:"
|
Set-RegistryValue 'HKLM\zSYSTEM\ControlSet001\Control\BitLocker' 'PreventDeviceEncryption' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat' '/v' 'ChatIcon' '/t' 'REG_DWORD' '/d' '3' '/f' | Out-Null
|
Write-Output "Disabling Chat icon:"
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' '/v' 'TaskbarMn' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat' 'ChatIcon' 'REG_DWORD' '3'
|
||||||
Write-Host "Removing Edge related registries"
|
Set-RegistryValue 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' 'TaskbarMn' 'REG_DWORD' '0'
|
||||||
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /f | Out-Null
|
Write-Output "Removing Edge related registries"
|
||||||
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" /f | Out-Null
|
Remove-RegistryValue "HKEY_LOCAL_MACHINE\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge"
|
||||||
Write-Host "Disabling OneDrive folder backup"
|
Remove-RegistryValue "HKEY_LOCAL_MACHINE\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update"
|
||||||
& 'reg' 'add' "HKLM\zSOFTWARE\Policies\Microsoft\Windows\OneDrive" '/v' 'DisableFileSyncNGSC' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Write-Output "Disabling OneDrive folder backup"
|
||||||
Write-Host "Disabling Telemetry:"
|
Set-RegistryValue "HKLM\zSOFTWARE\Policies\Microsoft\Windows\OneDrive" "DisableFileSyncNGSC" "REG_DWORD" "1"
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo' '/v' 'Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Write-Output "Disabling Telemetry:"
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\Privacy' '/v' 'TailoredExperiencesWithDiagnosticDataEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo' 'Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy' '/v' 'HasAccepted' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\Privacy' 'TailoredExperiencesWithDiagnosticDataEnabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Input\TIPC' '/v' 'Enabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy' 'HasAccepted' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' '/v' 'RestrictImplicitInkCollection' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Input\TIPC' 'Enabled' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' '/v' 'RestrictImplicitTextCollection' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' 'RestrictImplicitInkCollection' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization\TrainedDataStore' '/v' 'HarvestContacts' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' 'RestrictImplicitTextCollection' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Personalization\Settings' '/v' 'AcceptedPrivacyPolicy' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization\TrainedDataStore' 'HarvestContacts' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\DataCollection' '/v' 'AllowTelemetry' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Software\Microsoft\Personalization\Settings' 'AcceptedPrivacyPolicy' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\ControlSet001\Services\dmwappushservice' '/v' 'Start' '/t' 'REG_DWORD' '/d' '4' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\DataCollection' 'AllowTelemetry' 'REG_DWORD' '0'
|
||||||
Write-Host "Prevents installation or DevHome and Outlook:"
|
Set-RegistryValue 'HKLM\zSYSTEM\ControlSet001\Services\dmwappushservice' 'Start' 'REG_DWORD' '4'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\OutlookUpdate' '/v' 'workCompleted' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
## Prevents installation of DevHome and Outlook
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\DevHomeUpdate' '/v' 'workCompleted' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Write-Output "Prevents installation of DevHome and Outlook:"
|
||||||
& 'reg' 'delete' 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' 'workCompleted' 'REG_DWORD' '1'
|
||||||
& 'reg' 'delete' 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\OutlookUpdate' 'workCompleted' 'REG_DWORD' '1'
|
||||||
Write-Host "Disabling Copilot"
|
Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\DevHomeUpdate' 'workCompleted' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsCopilot' '/v' 'TurnOffWindowsCopilot' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Remove-RegistryValue 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Edge' '/v' 'HubsSidebarEnabled' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Remove-RegistryValue 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Explorer' '/v' 'DisableSearchBoxSuggestions' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Write-Output "Disabling Copilot"
|
||||||
Write-Host "Prevents installation of Teams:"
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsCopilot' 'TurnOffWindowsCopilot' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Teams' '/v' 'DisableInstallation' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Edge' 'HubsSidebarEnabled' 'REG_DWORD' '0'
|
||||||
Write-Host "Prevent installation of New Outlook":
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Explorer' 'DisableSearchBoxSuggestions' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Mail' '/v' 'PreventRun' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Write-Output "Prevents installation of Teams:"
|
||||||
$tasksPath = "C:\scratchdir\Windows\System32\Tasks"
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Teams' 'DisableInstallation' 'REG_DWORD' '1'
|
||||||
|
Write-Output "Prevent installation of New Outlook":
|
||||||
|
Set-RegistryValue 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Mail' 'PreventRun' 'REG_DWORD' '1'
|
||||||
|
|
||||||
Write-Host "Deleting scheduled task definition files..."
|
Write-Host "Deleting scheduled task definition files..."
|
||||||
|
$tasksPath = "$ScratchDisk\scratchdir\Windows\System32\Tasks"
|
||||||
|
|
||||||
# Application Compatibility Appraiser
|
# Application Compatibility Appraiser
|
||||||
Remove-Item -Path "$tasksPath\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path "$tasksPath\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -Force -ErrorAction SilentlyContinue
|
||||||
@@ -259,7 +379,6 @@ Remove-Item -Path "$tasksPath\Microsoft\Windows\Chkdsk\Proxy" -Force -ErrorActio
|
|||||||
|
|
||||||
# Windows Error Reporting (QueueReporting)
|
# Windows Error Reporting (QueueReporting)
|
||||||
Remove-Item -Path "$tasksPath\Microsoft\Windows\Windows Error Reporting\QueueReporting" -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path "$tasksPath\Microsoft\Windows\Windows Error Reporting\QueueReporting" -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
Write-Host "Task files have been deleted."
|
Write-Host "Task files have been deleted."
|
||||||
Write-Host "Unmounting Registry..."
|
Write-Host "Unmounting Registry..."
|
||||||
reg unload HKLM\zCOMPONENTS | Out-Null
|
reg unload HKLM\zCOMPONENTS | Out-Null
|
||||||
@@ -267,79 +386,81 @@ reg unload HKLM\zDEFAULT | Out-Null
|
|||||||
reg unload HKLM\zNTUSER | Out-Null
|
reg unload HKLM\zNTUSER | Out-Null
|
||||||
reg unload HKLM\zSOFTWARE | Out-Null
|
reg unload HKLM\zSOFTWARE | Out-Null
|
||||||
reg unload HKLM\zSYSTEM | Out-Null
|
reg unload HKLM\zSYSTEM | Out-Null
|
||||||
Write-Host "Cleaning up image..."
|
Write-Output "Cleaning up image..."
|
||||||
Repair-WindowsImage -Path $ScratchDisk\scratchdir -StartComponentCleanup -ResetBase
|
dism.exe /Image:$ScratchDisk\scratchdir /Cleanup-Image /StartComponentCleanup /ResetBase
|
||||||
Write-Host "Cleanup complete."
|
Write-Output "Cleanup complete."
|
||||||
Write-Host ' '
|
Write-Output ' '
|
||||||
Write-Host "Unmounting image..."
|
Write-Output "Unmounting image..."
|
||||||
Dismount-WindowsImage -Path $ScratchDisk\scratchdir -Save
|
Dismount-WindowsImage -Path $ScratchDisk\scratchdir -Save
|
||||||
Write-Host "Exporting image..."
|
Write-Host "Exporting image..."
|
||||||
Dism.exe /Export-Image /SourceImageFile:"$ScratchDisk\tiny11\sources\install.wim" /SourceIndex:$index /DestinationImageFile:"$ScratchDisk\tiny11\sources\install2.wim" /Compress:recovery
|
Dism.exe /Export-Image /SourceImageFile:"$ScratchDisk\tiny11\sources\install.wim" /SourceIndex:$index /DestinationImageFile:"$ScratchDisk\tiny11\sources\install2.wim" /Compress:recovery
|
||||||
Remove-Item -Path "$ScratchDisk\tiny11\sources\install.wim" -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\tiny11\sources\install.wim" -Force | Out-Null
|
||||||
Rename-Item -Path "$ScratchDisk\tiny11\sources\install2.wim" -NewName "install.wim" | Out-Null
|
Rename-Item -Path "$ScratchDisk\tiny11\sources\install2.wim" -NewName "install.wim" | Out-Null
|
||||||
Write-Host "Windows image completed. Continuing with boot.wim."
|
Write-Output "Windows image completed. Continuing with boot.wim."
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Mounting boot image:"
|
Write-Output "Mounting boot image:"
|
||||||
$wimFilePath = "$ScratchDisk\tiny11\sources\boot.wim"
|
$wimFilePath = "$ScratchDisk\tiny11\sources\boot.wim"
|
||||||
& takeown "/F" $wimFilePath | Out-Null
|
& takeown "/F" $wimFilePath | Out-Null
|
||||||
& icacls $wimFilePath "/grant" "$($adminGroup.Value):(F)"
|
& icacls $wimFilePath "/grant" "$($adminGroup.Value):(F)"
|
||||||
Set-ItemProperty -Path $wimFilePath -Name IsReadOnly -Value $false
|
Set-ItemProperty -Path $wimFilePath -Name IsReadOnly -Value $false
|
||||||
Mount-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\boot.wim -Index 2 -Path $ScratchDisk\scratchdir
|
Mount-WindowsImage -ImagePath $ScratchDisk\tiny11\sources\boot.wim -Index 2 -Path $ScratchDisk\scratchdir
|
||||||
Write-Host "Loading registry..."
|
Write-Output "Loading registry..."
|
||||||
reg load HKLM\zCOMPONENTS $ScratchDisk\scratchdir\Windows\System32\config\COMPONENTS
|
reg load HKLM\zCOMPONENTS $ScratchDisk\scratchdir\Windows\System32\config\COMPONENTS
|
||||||
reg load HKLM\zDEFAULT $ScratchDisk\scratchdir\Windows\System32\config\default
|
reg load HKLM\zDEFAULT $ScratchDisk\scratchdir\Windows\System32\config\default
|
||||||
reg load HKLM\zNTUSER $ScratchDisk\scratchdir\Users\Default\ntuser.dat
|
reg load HKLM\zNTUSER $ScratchDisk\scratchdir\Users\Default\ntuser.dat
|
||||||
reg load HKLM\zSOFTWARE $ScratchDisk\scratchdir\Windows\System32\config\SOFTWARE
|
reg load HKLM\zSOFTWARE $ScratchDisk\scratchdir\Windows\System32\config\SOFTWARE
|
||||||
reg load HKLM\zSYSTEM $ScratchDisk\scratchdir\Windows\System32\config\SYSTEM
|
reg load HKLM\zSYSTEM $ScratchDisk\scratchdir\Windows\System32\config\SYSTEM
|
||||||
Write-Host "Bypassing system requirements(on the setup image):"
|
|
||||||
& 'reg' 'add' 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV1' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Write-Output "Bypassing system requirements(on the setup image):"
|
||||||
& 'reg' 'add' 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV2' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' 'SV1' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV1' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' 'SV2' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' '/v' 'SV2' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' 'SV1' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassCPUCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' 'SV2' 'REG_DWORD' '0'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassRAMCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassCPUCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassSecureBootCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassRAMCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassStorageCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassSecureBootCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\LabConfig' '/v' 'BypassTPMCheck' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassStorageCheck' 'REG_DWORD' '1'
|
||||||
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\MoSetup' '/v' 'AllowUpgradesWithUnsupportedTPMOrCPU' '/t' 'REG_DWORD' '/d' '1' '/f' | Out-Null
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassTPMCheck' 'REG_DWORD' '1'
|
||||||
Write-Host "Tweaking complete!"
|
Set-RegistryValue 'HKLM\zSYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 'REG_DWORD' '1'
|
||||||
Write-Host "Unmounting Registry..."
|
Write-Output "Tweaking complete!"
|
||||||
|
|
||||||
|
Write-Output "Unmounting Registry..."
|
||||||
reg unload HKLM\zCOMPONENTS | Out-Null
|
reg unload HKLM\zCOMPONENTS | Out-Null
|
||||||
reg unload HKLM\zDEFAULT | Out-Null
|
reg unload HKLM\zDEFAULT | Out-Null
|
||||||
reg unload HKLM\zNTUSER | Out-Null
|
reg unload HKLM\zNTUSER | Out-Null
|
||||||
reg unload HKLM\zSOFTWARE | Out-Null
|
reg unload HKLM\zSOFTWARE | Out-Null
|
||||||
reg unload HKLM\zSYSTEM | Out-Null
|
reg unload HKLM\zSYSTEM | Out-Null
|
||||||
Write-Host "Unmounting image..."
|
|
||||||
|
Write-Output "Unmounting image..."
|
||||||
Dismount-WindowsImage -Path $ScratchDisk\scratchdir -Save
|
Dismount-WindowsImage -Path $ScratchDisk\scratchdir -Save
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "The tiny11 image is now completed. Proceeding with the making of the ISO..."
|
Write-Output "The tiny11 image is now completed. Proceeding with the making of the ISO..."
|
||||||
Write-Host "Copying unattended file for bypassing MS account on OOBE..."
|
Write-Output "Copying unattended file for bypassing MS account on OOBE..."
|
||||||
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\tiny11\autounattend.xml" -Force | Out-Null
|
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\tiny11\autounattend.xml" -Force | Out-Null
|
||||||
Write-Host "Creating ISO image..."
|
Write-Output "Creating ISO image..."
|
||||||
$ADKDepTools = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
|
$ADKDepTools = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
|
||||||
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
|
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
|
||||||
|
|
||||||
if ([System.IO.Directory]::Exists($ADKDepTools)) {
|
if ([System.IO.Directory]::Exists($ADKDepTools)) {
|
||||||
Write-Host "Will be using oscdimg.exe from system ADK."
|
Write-Output "Will be using oscdimg.exe from system ADK."
|
||||||
$OSCDIMG = "$ADKDepTools\oscdimg.exe"
|
$OSCDIMG = "$ADKDepTools\oscdimg.exe"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "ADK folder not found. Will be using bundled oscdimg.exe."
|
Write-Output "ADK folder not found. Will be using bundled oscdimg.exe."
|
||||||
|
|
||||||
$url = "https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe"
|
$url = "https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe"
|
||||||
|
|
||||||
if (-not (Test-Path -Path $localOSCDIMGPath)) {
|
if (-not (Test-Path -Path $localOSCDIMGPath)) {
|
||||||
Write-Host "Downloading oscdimg.exe..."
|
Write-Output "Downloading oscdimg.exe..."
|
||||||
Invoke-WebRequest -Uri $url -OutFile $localOSCDIMGPath
|
Invoke-WebRequest -Uri $url -OutFile $localOSCDIMGPath
|
||||||
|
|
||||||
if (Test-Path $localOSCDIMGPath) {
|
if (Test-Path $localOSCDIMGPath) {
|
||||||
Write-Host "oscdimg.exe downloaded successfully."
|
Write-Output "oscdimg.exe downloaded successfully."
|
||||||
} else {
|
} else {
|
||||||
Write-Error "Failed to download oscdimg.exe."
|
Write-Error "Failed to download oscdimg.exe."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "oscdimg.exe already exists locally."
|
Write-Output "oscdimg.exe already exists locally."
|
||||||
}
|
}
|
||||||
|
|
||||||
$OSCDIMG = $localOSCDIMGPath
|
$OSCDIMG = $localOSCDIMGPath
|
||||||
@@ -348,13 +469,67 @@ if ([System.IO.Directory]::Exists($ADKDepTools)) {
|
|||||||
& "$OSCDIMG" '-m' '-o' '-u2' '-udfver102' "-bootdata:2#p0,e,b$ScratchDisk\tiny11\boot\etfsboot.com#pEF,e,b$ScratchDisk\tiny11\efi\microsoft\boot\efisys.bin" "$ScratchDisk\tiny11" "$PSScriptRoot\tiny11.iso"
|
& "$OSCDIMG" '-m' '-o' '-u2' '-udfver102' "-bootdata:2#p0,e,b$ScratchDisk\tiny11\boot\etfsboot.com#pEF,e,b$ScratchDisk\tiny11\efi\microsoft\boot\efisys.bin" "$ScratchDisk\tiny11" "$PSScriptRoot\tiny11.iso"
|
||||||
|
|
||||||
# Finishing up
|
# Finishing up
|
||||||
Write-Host "Creation completed! Press any key to exit the script..."
|
Write-Output "Creation completed! Press any key to exit the script..."
|
||||||
Read-Host "Press Enter to continue"
|
Read-Host "Press Enter to continue"
|
||||||
Write-Host "Performing Cleanup..."
|
Write-Output "Performing Cleanup..."
|
||||||
Remove-Item -Path "$ScratchDisk\tiny11" -Recurse -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\tiny11" -Recurse -Force | Out-Null
|
||||||
Remove-Item -Path "$ScratchDisk\scratchdir" -Recurse -Force | Out-Null
|
Remove-Item -Path "$ScratchDisk\scratchdir" -Recurse -Force | Out-Null
|
||||||
|
Write-Output "Ejecting Iso drive"
|
||||||
|
Get-Volume -DriveLetter $DriveLetter[0] | Get-DiskImage | Dismount-DiskImage
|
||||||
|
Write-Output "Iso drive ejected"
|
||||||
|
Write-Output "Removing oscdimg.exe..."
|
||||||
|
Remove-Item -Path "$PSScriptRoot\oscdimg.exe" -Force -ErrorAction SilentlyContinue
|
||||||
|
Write-Output "Removing autounattend.xml..."
|
||||||
|
Remove-Item -Path "$PSScriptRoot\autounattend.xml" -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
Write-Output "Cleanup check :"
|
||||||
|
if (Test-Path -Path "$ScratchDisk\tiny11") {
|
||||||
|
Write-Output "tiny11 folder still exists. Attempting to remove it again..."
|
||||||
|
Remove-Item -Path "$ScratchDisk\tiny11" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
if (Test-Path -Path "$ScratchDisk\tiny11") {
|
||||||
|
Write-Output "Failed to remove tiny11 folder."
|
||||||
|
} else {
|
||||||
|
Write-Output "tiny11 folder removed successfully."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "tiny11 folder does not exist. No action needed."
|
||||||
|
}
|
||||||
|
if (Test-Path -Path "$ScratchDisk\scratchdir") {
|
||||||
|
Write-Output "scratchdir folder still exists. Attempting to remove it again..."
|
||||||
|
Remove-Item -Path "$ScratchDisk\scratchdir" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
if (Test-Path -Path "$ScratchDisk\scratchdir") {
|
||||||
|
Write-Output "Failed to remove scratchdir folder."
|
||||||
|
} else {
|
||||||
|
Write-Output "scratchdir folder removed successfully."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "scratchdir folder does not exist. No action needed."
|
||||||
|
}
|
||||||
|
if (Test-Path -Path "$PSScriptRoot\oscdimg.exe") {
|
||||||
|
Write-Output "oscdimg.exe still exists. Attempting to remove it again..."
|
||||||
|
Remove-Item -Path "$PSScriptRoot\oscdimg.exe" -Force -ErrorAction SilentlyContinue
|
||||||
|
if (Test-Path -Path "$PSScriptRoot\oscdimg.exe") {
|
||||||
|
Write-Output "Failed to remove oscdimg.exe."
|
||||||
|
} else {
|
||||||
|
Write-Output "oscdimg.exe removed successfully."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "oscdimg.exe does not exist. No action needed."
|
||||||
|
}
|
||||||
|
if (Test-Path -Path "$PSScriptRoot\autounattend.xml") {
|
||||||
|
Write-Output "autounattend.xml still exists. Attempting to remove it again..."
|
||||||
|
Remove-Item -Path "$PSScriptRoot\autounattend.xml" -Force -ErrorAction SilentlyContinue
|
||||||
|
if (Test-Path -Path "$PSScriptRoot\autounattend.xml") {
|
||||||
|
Write-Output "Failed to remove autounattend.xml."
|
||||||
|
} else {
|
||||||
|
Write-Output "autounattend.xml removed successfully."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "autounattend.xml does not exist. No action needed."
|
||||||
|
}
|
||||||
|
|
||||||
# Stop the transcript
|
# Stop the transcript
|
||||||
Stop-Transcript
|
Stop-Transcript
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user