\Sources."
} catch {
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
+ Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
@@ -106,6 +107,8 @@ function Remove-Packages {
$_ -NotLike "*Wifi*"
}
+ $failedCount = 0
+
foreach ($pkg in $pkglist) {
try {
$status = "Removing $pkg"
@@ -114,12 +117,18 @@ function Remove-Packages {
} catch {
# This can happen if the package that is being removed is a permanent one, like FodMetadata
Write-Host "Could not remove OS package $($pkg)"
+ $failedCount += 1
continue
}
}
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
+ if ($failedCount -gt 0)
+ {
+ Write-Host "Some packages could not be removed. Do not worry: your image will still work fine. This can happen if the package is permanent or has been superseded by a newer one."
+ }
} catch {
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
+ Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
@@ -175,6 +184,7 @@ function Remove-ProvisionedPackages() {
{
# This can happen if getting AppX packages fails
Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed"
+ Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
diff --git a/functions/private/Update-WinUtilProgramWinget.ps1 b/functions/private/Update-WinUtilProgramWinget.ps1
index 0784657d22..7f50d35e6c 100644
--- a/functions/private/Update-WinUtilProgramWinget.ps1
+++ b/functions/private/Update-WinUtilProgramWinget.ps1
@@ -11,7 +11,7 @@ Function Update-WinUtilProgramWinget {
$host.ui.RawUI.WindowTitle = """Winget Install"""
- Start-Transcript $ENV:TEMP\winget-update.log -Append
+ Start-Transcript "$logdir\winget-update_$dateTime.log" -Append
winget upgrade --all --accept-source-agreements --accept-package-agreements --scope=machine --silent
}
diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1
index ac5b2f8cdb..e3015f09e0 100644
--- a/functions/public/Invoke-WPFButton.ps1
+++ b/functions/public/Invoke-WPFButton.ps1
@@ -21,13 +21,13 @@ function Invoke-WPFButton {
Switch -Wildcard ($Button) {
"WPFTab?BT" {Invoke-WPFTab $Button}
- "WPFinstall" {Invoke-WPFInstall}
- "WPFuninstall" {Invoke-WPFUnInstall}
+ "WPFInstall" {Invoke-WPFInstall}
+ "WPFUninstall" {Invoke-WPFUnInstall}
"WPFInstallUpgrade" {Invoke-WPFInstallUpgrade}
- "WPFstandard" {Invoke-WPFPresets "Standard"}
- "WPFminimal" {Invoke-WPFPresets "Minimal"}
- "WPFclear" {Invoke-WPFPresets -preset $null -imported $true}
- "WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "WPFInstall"}
+ "WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"}
+ "WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"}
+ "WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"}
+ "WPFClearInstallSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*"}
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
"WPFOOSUbutton" {Invoke-WPFOOSU}
"WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enable"}
diff --git a/functions/public/Invoke-WPFImpex.ps1 b/functions/public/Invoke-WPFImpex.ps1
index 9b03cc13fc..43d835de95 100644
--- a/functions/public/Invoke-WPFImpex.ps1
+++ b/functions/public/Invoke-WPFImpex.ps1
@@ -41,6 +41,8 @@ function Invoke-WPFImpex {
if ($type -eq "export") {
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
+ $runscript = "iex ""& { `$(irm christitus.com/win) } -Config '$($FileBrowser.FileName)'"""
+ $runscript | Set-Clipboard
}
if ($type -eq "import") {
$jsonFile = Get-Content $Config | ConvertFrom-Json
diff --git a/functions/public/Invoke-WPFPresets.ps1 b/functions/public/Invoke-WPFPresets.ps1
index 1595a8f103..90493899c7 100644
--- a/functions/public/Invoke-WPFPresets.ps1
+++ b/functions/public/Invoke-WPFPresets.ps1
@@ -10,29 +10,36 @@ function Invoke-WPFPresets {
.PARAMETER imported
If the preset is imported from a file, defaults to false
- .PARAMETER checkbox
- The checkbox to set the options to, defaults to 'WPFTweaks'
+ .PARAMETER checkboxfilterpattern
+ The Pattern to use when filtering through CheckBoxes, defaults to "**"
#>
- param(
- $preset,
- [bool]$imported = $false
+ param (
+ [Parameter(position=0)]
+ [string]$preset = "",
+
+ [Parameter(position=1)]
+ [bool]$imported = $false,
+
+ [Parameter(position=2)]
+ [string]$checkboxfilterpattern = "**"
)
- if($imported -eq $true) {
+ if ($imported -eq $true) {
$CheckBoxesToCheck = $preset
} else {
$CheckBoxesToCheck = $sync.configs.preset.$preset
}
- $CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" }
- Write-Debug "Getting checkboxes to set $($CheckBoxes.Count)"
+ $CheckBoxes = ($sync.GetEnumerator()).where{ $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" -and $_.Name -like "$checkboxfilterpattern"}
+ Write-Debug "Getting checkboxes to set, number of checkboxes: $($CheckBoxes.Count)"
- $CheckBoxesToCheck | ForEach-Object {
- if ($_ -ne $null) {
- Write-Debug $_
- }
+ if ($CheckBoxesToCheck -ne "") {
+ $debugMsg = "CheckBoxes to Check are: "
+ $CheckBoxesToCheck | ForEach-Object { $debugMsg += "$_, " }
+ $debugMsg = $debugMsg -replace (',\s*$', '')
+ Write-Debug "$debugMsg"
}
foreach ($CheckBox in $CheckBoxes) {
diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1
index 2319d6fe5a..f8e9c7ba00 100644
--- a/functions/public/Invoke-WPFUIElements.ps1
+++ b/functions/public/Invoke-WPFUIElements.ps1
@@ -186,6 +186,7 @@ function Invoke-WPFUIElements {
$label.ToolTip = $entryInfo.Description
$label.HorizontalAlignment = "Left"
$label.FontSize = $theme.FontSize
+ $label.Foreground = $theme.MainForegroundColor
$dockPanel.Children.Add($label) | Out-Null
$stackPanel.Children.Add($dockPanel) | Out-Null
diff --git a/overrides/main.html b/overrides/main.html
index f5f0eb399f..bf27a2c652 100644
--- a/overrides/main.html
+++ b/overrides/main.html
@@ -1,5 +1,12 @@
{% extends "base.html" %}
+{% block header %}
+ {{ super() }}
+
+ Announcement: We are currently not adding any applications to WinUtil and any apps that will be added through a PR will be declined by the maintainer.
+
+{% endblock %}
+
{% block footer %}
{# Empty block to override the footer #}
{% endblock %}
diff --git a/scripts/main.ps1 b/scripts/main.ps1
index 17606b5d55..bcc209b2d6 100644
--- a/scripts/main.ps1
+++ b/scripts/main.ps1
@@ -439,6 +439,12 @@ $sync["SearchBar"].Add_TextChanged({
}
})
+$sync["Form"].Add_Loaded({
+ param($e)
+ $sync["Form"].MaxWidth = [Double]::PositiveInfinity
+ $sync["Form"].MaxHeight = [Double]::PositiveInfinity
+})
+
# Initialize the hashtable
$winutildir = @{}
diff --git a/scripts/start.ps1 b/scripts/start.ps1
index 06e53b69d2..c289709c49 100644
--- a/scripts/start.ps1
+++ b/scripts/start.ps1
@@ -5,6 +5,7 @@
GitHub : https://github.com/ChrisTitusTech
Version : #{replaceme}
#>
+
param (
[switch]$Debug,
[string]$Config,
@@ -27,12 +28,6 @@ if ($Run) {
$PARAM_RUN = $true
}
-if (!(Test-Path -Path $ENV:TEMP)) {
- New-Item -ItemType Directory -Force -Path $ENV:TEMP
-}
-
-Start-Transcript $ENV:TEMP\Winutil.log -Append
-
# Load DLLs
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.Windows.Forms
@@ -46,8 +41,22 @@ $sync.ProcessRunning = $false
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
+ $argList = @()
+
+ $PSBoundParameters.GetEnumerator() | ForEach-Object {
+ $argList += if ($_.Value -is [switch] -and $_.Value) {
+ "-$($_.Key)"
+ } elseif ($_.Value) {
+ "-$($_.Key) `"$($_.Value)`""
+ }
+ }
+
+ $script = if ($MyInvocation.MyCommand.Path) {
+ "& { & '$($MyInvocation.MyCommand.Path)' $argList }"
+ } else {
+ "iex '& { $(irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1) } $argList'"
+ }
- $script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1' | iex"}
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
@@ -56,6 +65,12 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
break
}
+$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
+
+$logdir = "$env:localappdata\winutil\logs"
+[System.IO.Directory]::CreateDirectory("$logdir") | Out-Null
+Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
+
# Set PowerShell window title
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
clear-host
diff --git a/windev.ps1 b/windev.ps1
index 5bba017d12..b735efca6c 100644
--- a/windev.ps1
+++ b/windev.ps1
@@ -14,8 +14,15 @@
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
+ # Capture all the arguments passed to the script
+ $argList = $args -join ' '
+
+ $script = if ($MyInvocation.MyCommand.Path) {
+ "& { & '$($MyInvocation.MyCommand.Path)' $argList }"
+ } else {
+ "iex '& { $(irm https://github.com/ChrisTitusTech/winutil/raw/main/windev.ps1) } $argList'"
+ }
- $script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/raw/main/windev.ps1' | iex"}
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
@@ -46,9 +53,9 @@ function RedirectToLatestPreRelease {
Write-Host "Using latest Full Release"
$url = "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1"
}
- Invoke-RestMethod $url | Invoke-Expression
+
+ iex "& { $(irm $url) } $argList"
}
# Call the redirect function
-
RedirectToLatestPreRelease
diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml
index db4be1a9bf..8094af4a28 100644
--- a/xaml/inputXML.xaml
+++ b/xaml/inputXML.xaml
@@ -9,7 +9,11 @@
WindowStartupLocation="CenterScreen"
UseLayoutRounding="True"
WindowStyle="None"
- Title="Chris Titus Tech's Windows Utility" Height="800" Width="1280">
+ Width="Auto"
+ Height="Auto"
+ MaxWidth="1280"
+ MaxHeight="800"
+ Title="Chris Titus Tech's Windows Utility">
@@ -315,7 +319,7 @@
Margin="2"
SnapsToDevicePixels="True"/>
@@ -427,7 +431,11 @@
Width="34" Height="17">
+ HorizontalAlignment="Left" Width="10.8"
+ RenderTransformOrigin="0.5, 0.5">
+
+
+
@@ -438,12 +446,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
@@ -662,10 +693,10 @@
-
-
-
-
+
+
+
+