diff --git a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1
index 329a686a..79c1f00b 100644
--- a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1
+++ b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1
@@ -25,25 +25,22 @@ function Test-CompatibleImage() {
}
}
-function Remove-Features([switch]$dumpFeatures = $false, [switch]$keepDefender = $false) {
+function Remove-Features() {
<#
.SYNOPSIS
Removes certain features from ISO image
.PARAMETER Name
- dumpFeatures - Dumps all features found in the ISO into a file called allfeaturesdump.txt. This file can be examined and used to decide what to remove.
- keepDefender - Should Defender be removed from the ISO?
+ No Params
.EXAMPLE
- Remove-Features -keepDefender:$false
+ Remove-Features
#>
try {
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
- if ($dumpFeatures) {
- $featlist > allfeaturesdump.txt
- }
$featlist = $featlist | Where-Object {
+ $_ -NotLike "*Defender*" -AND
$_ -NotLike "*Printing*" -AND
$_ -NotLike "*TelnetClient*" -AND
$_ -NotLike "*PowerShell*" -AND
@@ -52,8 +49,6 @@ function Remove-Features([switch]$dumpFeatures = $false, [switch]$keepDefender =
$_ -NotLike "*NFS*"
}
- if ($keepDefender) { $featlist = $featlist | Where-Object { $_ -NotLike "*Defender*" }}
-
foreach($feature in $featlist) {
$status = "Removing feature $feature"
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
@@ -126,16 +121,16 @@ function Remove-Packages {
}
}
-function Remove-ProvisionedPackages([switch]$keepSecurity = $false) {
+function Remove-ProvisionedPackages() {
<#
.SYNOPSIS
Removes AppX packages from a Windows image during MicroWin processing
.PARAMETER Name
- keepSecurity - Boolean that determines whether to keep "Microsoft.SecHealthUI" (Windows Security) in the Windows image
+ No Params
.EXAMPLE
- Remove-ProvisionedPackages -keepSecurity:$false
+ Remove-ProvisionedPackages
#>
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
$_.PackageName -NotLike "*AppInstaller*" -AND
@@ -151,22 +146,19 @@ function Remove-ProvisionedPackages([switch]$keepSecurity = $false) {
}
if ($?) {
- if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }}
- $counter = 0
- foreach ($appx in $appxProvisionedPackages) {
- $status = "Removing Provisioned $($appx.PackageName)"
- Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
- try {
- Remove-AppxProvisionedPackage -Path "$scratchDir" -PackageName $appx.PackageName -ErrorAction SilentlyContinue
- } catch {
- Write-Host "Application $($appx.PackageName) could not be removed"
- continue
- }
+ $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }
+ $counter = 0
+ foreach ($appx in $appxProvisionedPackages) {
+ $status = "Removing Provisioned $($appx.PackageName)"
+ Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
+ try {
+ Remove-AppxProvisionedPackage -Path "$scratchDir" -PackageName $appx.PackageName -ErrorAction SilentlyContinue
+ } catch {
+ Write-Host "Application $($appx.PackageName) could not be removed"
+ continue
}
- Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
- } else {
- Write-Host "Could not get Provisioned App information. Skipping process..."
}
+ Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
}
function Copy-ToUSB([string]$fileToCopy) {
@@ -200,22 +192,6 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
$yesNo = Get-LocalizedYesNo
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
- # Specify the path to the directory
- # $directoryPath = "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup"
- # takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
- # icacls "$($directoryPath)" /q /c /t /reset > $null
- # icacls $directoryPath /setowner "*S-1-5-32-544"
- # icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
- # Remove-Item -Path $directoryPath -Recurse -Force
-
- # # Grant full control to BUILTIN\Administrators using icacls
- # $directoryPath = "$($scratchDir)\Windows\System32\WebThreatDefSvc"
- # takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
- # icacls "$($directoryPath)" /q /c /t /reset > $null
- # icacls $directoryPath /setowner "*S-1-5-32-544"
- # icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
- # Remove-Item -Path $directoryPath -Recurse -Force
-
$itemsToDelete = [System.Collections.ArrayList]::new()
if ($mask -eq "") {
@@ -254,46 +230,6 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
function New-Unattend {
- # later if we wont to remove even more bloat EU requires MS to remove everything from English(world)
- # Below is an example how to do it we probably should create a drop down with common locals
- #
- #
- #
- #
- # en-US
- #
- # en-US
- # en-US
- # en-US
- # en-US
- #
- #
-
- #
- #
- #
- # en-US
- # en-US
- # en-US
- # en-US
- #
- #
- # using here string to embedd unattend
- #
- # 1
- # net user administrator /active:yes
- #
-
- # this section doesn't work in win10/????
-#
-#
-# 0
-#
-#
-# false
-#
-#
-
$unattend = @'
Choose Windows SKU
- Choose Windows features you want to remove from the ISO
-
-
-
-
MicroWin features:
- Remove Telemetry and Tracking
- - Add ability to use local accounts
- - Remove Wifi requirement to finish install
- - Ability to remove Edge
- - Ability to remove Defender
- - Remove Teams
+ - Fast Install using "User" local account
+ - No internet requirement for install
- Apps debloat
@@ -988,7 +980,6 @@
- Click on the "Select Windows ISO" button and wait for WinUtil to process the image
It will be processed and unpacked which may take some time
- Once complete, choose which Windows flavor you want to base your image on
- - Choose which features you want to keep
- Click the "Start Process" button
The process of creating the Windows image may take some time, please check the console and wait for it to say "Done"
- Once complete, the target ISO file will be in the directory you have specified