From a2b12ae4b0bb8f58c9def3865cc8dff64279fbba Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 3 Jan 2024 09:49:23 -0600 Subject: [PATCH] Test 2024 01 02 Main Merge (#1345) * Add Version to App Display * Keep Windows Security (#1341) Adds a switch to Remove-ProvisionedPackages to determine whether we should remove Windows Security (GUI component, Microsoft.SecHealthUI). This commit fixes issue #1339 * Added scrollbar to all tabs (#1344) * Add scrollbar to Tweaks * Added scrollbar to all tabs * Compile Winutil --------- Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com> Co-authored-by: Munkk <152475628+munkk01@users.noreply.github.com> Co-authored-by: ChrisTitusTech --- Compile.ps1 | 3 +- functions/private/MicroWin-Helper.ps1 | 15 ++++++- functions/public/Invoke-WPFMicrowin.ps1 | 2 +- winutil.ps1 | 52 ++++++++++++++++++------- xaml/inputXML.xaml | 31 ++++++++++----- 5 files changed, 76 insertions(+), 27 deletions(-) diff --git a/Compile.ps1 b/Compile.ps1 index d17b15af..69265228 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -23,8 +23,9 @@ Get-ChildItem .\functions -Recurse -File | ForEach-Object { Get-ChildItem .\xaml | ForEach-Object { $xaml = (Get-Content $psitem.FullName).replace("'","''") + $newXaml = $xaml -replace 'CTTVersion', (Get-Date -Format 'yy.MM.dd') - Write-output "`$$($psitem.BaseName) = '$xaml'" | Out-File ./$scriptname -Append -Encoding ascii + Write-output "`$$($psitem.BaseName) = '$newXaml'" | Out-File ./$scriptname -Append -Encoding ascii } Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object { diff --git a/functions/private/MicroWin-Helper.ps1 b/functions/private/MicroWin-Helper.ps1 index 0291e7e8..5219f1b5 100644 --- a/functions/private/MicroWin-Helper.ps1 +++ b/functions/private/MicroWin-Helper.ps1 @@ -90,8 +90,20 @@ function Remove-Packages Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed } -function Remove-ProvisionedPackages +function Remove-ProvisionedPackages([switch] $keepSecurity = $false) { +<# + + .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 + + .EXAMPLE + Remove-ProvisionedPackages -keepSecurity:$false + +#> $appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object { $_.PackageName -NotLike "*AppInstaller*" -AND $_.PackageName -NotLike "*Store*" -and @@ -107,6 +119,7 @@ function Remove-ProvisionedPackages if ($?) { + if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }} $counter = 0 foreach ($appx in $appxProvisionedPackages) { diff --git a/functions/public/Invoke-WPFMicrowin.ps1 b/functions/public/Invoke-WPFMicrowin.ps1 index 0b50c9eb..de4da7f2 100644 --- a/functions/public/Invoke-WPFMicrowin.ps1 +++ b/functions/public/Invoke-WPFMicrowin.ps1 @@ -63,7 +63,7 @@ function Invoke-WPFMicrowin { } if (!$keepProvisionedPackages) { - Remove-ProvisionedPackages + Remove-ProvisionedPackages -keepSecurity:$keepDefender } # special code, for some reason when you try to delete some inbox apps diff --git a/winutil.ps1 b/winutil.ps1 index e81ce133..d1534ba5 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -10,7 +10,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : 24.01.02 + Version : 24.01.03 #> Start-Transcript $ENV:TEMP\Winutil.log -Append @@ -22,7 +22,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.01.02" +$sync.version = "24.01.03" $sync.configs = @{} $sync.ProcessRunning = $false @@ -1121,8 +1121,20 @@ function Remove-Packages Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed } -function Remove-ProvisionedPackages +function Remove-ProvisionedPackages([switch] $keepSecurity = $false) { +<# + + .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 + + .EXAMPLE + Remove-ProvisionedPackages -keepSecurity:$false + +#> $appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object { $_.PackageName -NotLike "*AppInstaller*" -AND $_.PackageName -NotLike "*Store*" -and @@ -1138,6 +1150,7 @@ function Remove-ProvisionedPackages if ($?) { + if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }} $counter = 0 foreach ($appx in $appxProvisionedPackages) { @@ -2640,7 +2653,7 @@ function Invoke-WPFMicrowin { } if (!$keepProvisionedPackages) { - Remove-ProvisionedPackages + Remove-ProvisionedPackages -keepSecurity:$keepDefender } # special code, for some reason when you try to delete some inbox apps @@ -4263,12 +4276,15 @@ $inputXML = ' +