mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-05 23:40:10 +00:00
Compare commits
32 Commits
25.12.01
...
63eeab0b19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63eeab0b19 | ||
|
|
1b78cd1316 | ||
|
|
a1907f5dee | ||
|
|
be415051ca | ||
|
|
80c15557d4 | ||
|
|
a587bc60c4 | ||
|
|
c71fad54dc | ||
|
|
4eb76a9099 | ||
|
|
95d8660b3a | ||
|
|
4bd25e62e1 | ||
|
|
da6b105573 | ||
|
|
64022cc08d | ||
|
|
401f7f384a | ||
|
|
e2efb3a483 | ||
|
|
4dc0fd6a6e | ||
|
|
f671ad4518 | ||
|
|
c2cb00fc68 | ||
|
|
7503444e2b | ||
|
|
80ab6ba005 | ||
|
|
2e0073af75 | ||
|
|
3cb0a4b664 | ||
|
|
e9b40ae710 | ||
|
|
408327daec | ||
|
|
7f7424406f | ||
|
|
ccc44414a2 | ||
|
|
06ea48dd01 | ||
|
|
5a6b1ef086 | ||
|
|
aba3d786bc | ||
|
|
7765c1032b | ||
|
|
015f1b0709 | ||
|
|
19b6f8abfa | ||
|
|
80e872aa60 |
@@ -79,7 +79,7 @@ You'll see a new file named `winutil.ps1`, which's created by `Compile.ps1` scri
|
|||||||
|
|
||||||
These are the sponsors that help keep this project alive with monthly contributions.
|
These are the sponsors that help keep this project alive with monthly contributions.
|
||||||
|
|
||||||
<!-- sponsors --><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="User avatar: Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="User avatar: Martin Stockzell" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="User avatar: Stefan" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="User avatar: Dave J (WhamGeek)" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/FatBastard0"><img src="https://github.com/FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DursleyGuy"><img src="https://github.com/DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/realmuddy"><img src="https://github.com/realmuddy.png" width="60px" alt="User avatar: Phillip Waters" /></a><a href="https://github.com/quaszi"><img src="https://github.com/quaszi.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DwayneTheRockLobster1"><img src="https://github.com/DwayneTheRockLobster1.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KieraKujisawa"><img src="https://github.com/KieraKujisawa.png" width="60px" alt="User avatar: Kiera Meredith" /></a><a href="https://github.com/novello-dev"><img src="https://github.com/novello-dev.png" width="60px" alt="User avatar: João Pedro Novello" /></a><!-- sponsors -->
|
<!-- sponsors --><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="User avatar: Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="User avatar: Martin Stockzell" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="User avatar: Stefan" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="User avatar: Dave J (WhamGeek)" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/FatBastard0"><img src="https://github.com/FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DursleyGuy"><img src="https://github.com/DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/quaszi"><img src="https://github.com/quaszi.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DwayneTheRockLobster1"><img src="https://github.com/DwayneTheRockLobster1.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KieraKujisawa"><img src="https://github.com/KieraKujisawa.png" width="60px" alt="User avatar: Kiera Meredith" /></a><a href="https://github.com/TaNorbs"><img src="https://github.com/TaNorbs.png" width="60px" alt="User avatar: Norbs" /></a><!-- sponsors -->
|
||||||
|
|
||||||
## 🏅 Thanks to all Contributors
|
## 🏅 Thanks to all Contributors
|
||||||
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||||
|
|||||||
@@ -1000,6 +1000,14 @@
|
|||||||
"link": "https://aws.amazon.com/corretto",
|
"link": "https://aws.amazon.com/corretto",
|
||||||
"winget": "Amazon.Corretto.21.JDK"
|
"winget": "Amazon.Corretto.21.JDK"
|
||||||
},
|
},
|
||||||
|
"java25": {
|
||||||
|
"category": "Development",
|
||||||
|
"choco": "corretto25jdk",
|
||||||
|
"content": "Amazon Corretto 25 (LTS)",
|
||||||
|
"description": "Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK).",
|
||||||
|
"link": "https://aws.amazon.com/corretto",
|
||||||
|
"winget": "Amazon.Corretto.25.JDK"
|
||||||
|
},
|
||||||
"jdownloader": {
|
"jdownloader": {
|
||||||
"category": "Utilities",
|
"category": "Utilities",
|
||||||
"choco": "jdownloader",
|
"choco": "jdownloader",
|
||||||
|
|||||||
@@ -4,11 +4,9 @@
|
|||||||
"WPFTweaksConsumerFeatures",
|
"WPFTweaksConsumerFeatures",
|
||||||
"WPFTweaksDisableExplorerAutoDiscovery",
|
"WPFTweaksDisableExplorerAutoDiscovery",
|
||||||
"WPFTweaksDVR",
|
"WPFTweaksDVR",
|
||||||
"WPFTweaksLoc",
|
"WPFTweaksLocation",
|
||||||
"WPFTweaksServices",
|
"WPFTweaksServices",
|
||||||
"WPFTweaksStorage",
|
|
||||||
"WPFTweaksTele",
|
"WPFTweaksTele",
|
||||||
"WPFTweaksWifi",
|
|
||||||
"WPFTweaksDiskCleanup",
|
"WPFTweaksDiskCleanup",
|
||||||
"WPFTweaksDeleteTempFiles",
|
"WPFTweaksDeleteTempFiles",
|
||||||
"WPFTweaksEndTaskOnTaskbar",
|
"WPFTweaksEndTaskOnTaskbar",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,79 +2,20 @@ function Install-WinUtilWinget {
|
|||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs Winget if it is not already installed.
|
Installs Winget if not already installed.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function will download the latest version of Winget and install it. If Winget is already installed, it will do nothing.
|
installs winget if needed
|
||||||
#>
|
#>
|
||||||
$isWingetInstalled = Test-WinUtilPackageManager -winget
|
if ((Test-WinUtilPackageManager -winget) -eq "installed") {
|
||||||
|
return
|
||||||
try {
|
|
||||||
if ($isWingetInstalled -eq "installed") {
|
|
||||||
Write-Host "`nWinget is already installed.`r" -ForegroundColor Green
|
|
||||||
return
|
|
||||||
} elseif ($isWingetInstalled -eq "outdated") {
|
|
||||||
Write-Host "`nWinget is Outdated. Continuing with install.`r" -ForegroundColor Yellow
|
|
||||||
} else {
|
|
||||||
Write-Host "`nWinget is not Installed. Continuing with install.`r" -ForegroundColor Red
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Gets the computer's information
|
|
||||||
if ($null -eq $sync.ComputerInfo) {
|
|
||||||
$ComputerInfo = Get-ComputerInfo -ErrorAction Stop
|
|
||||||
} else {
|
|
||||||
$ComputerInfo = $sync.ComputerInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($ComputerInfo.WindowsVersion) -lt "1809") {
|
|
||||||
# Checks if Windows Version is too old for Winget
|
|
||||||
Write-Host "Winget is not supported on this version of Windows (Pre-1809)" -ForegroundColor Red
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Attempting to install/update Winget`r"
|
|
||||||
try {
|
|
||||||
$wingetCmd = Get-Command winget -ErrorAction Stop
|
|
||||||
Write-Information "Attempting to update WinGet using WinGet..."
|
|
||||||
$result = Start-Process -FilePath "`"$($wingetCmd.Source)`"" -ArgumentList "install -e --accept-source-agreements --accept-package-agreements Microsoft.AppInstaller" -Wait -NoNewWindow -PassThru
|
|
||||||
if ($result.ExitCode -ne 0) {
|
|
||||||
throw "WinGet update failed with exit code: $($result.ExitCode)"
|
|
||||||
}
|
|
||||||
Write-Output "Refreshing Environment Variables...`n"
|
|
||||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
||||||
return
|
|
||||||
} catch {
|
|
||||||
Write-Information "WinGet not found or update failed. Attempting to install from Microsoft Store..."
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Write-Host "Attempting to repair WinGet using Repair-WinGetPackageManager..." -ForegroundColor Yellow
|
|
||||||
|
|
||||||
# Check if Windows version supports Repair-WinGetPackageManager (24H2 and above)
|
|
||||||
if ([System.Environment]::OSVersion.Version.Build -ge 26100) {
|
|
||||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
|
||||||
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
|
|
||||||
Install-Module "Microsoft.WinGet.Client" -Force
|
|
||||||
Import-Module Microsoft.WinGet.Client
|
|
||||||
Repair-WinGetPackageManager -Force -Latest -Verbose
|
|
||||||
# Verify if repair was successful
|
|
||||||
$wingetCmd = Get-Command winget -ErrorAction Stop
|
|
||||||
Write-Host "WinGet repair successful!" -ForegroundColor Green
|
|
||||||
} else {
|
|
||||||
Write-Host "Repair-WinGetPackageManager is only available on Windows 24H2 and above. Your version doesn't support this method." -ForegroundColor Yellow
|
|
||||||
throw "Windows version not supported for repair method"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output "Refreshing Environment Variables...`n"
|
|
||||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
||||||
return
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
Write-Error "All installation methods failed. Unable to install WinGet."
|
|
||||||
throw
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
Write-Error "An error occurred during WinGet installation: $_"
|
|
||||||
throw
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Host "Winget is not Installed. Installing." -ForegroundColor Red
|
||||||
|
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
|
||||||
|
|
||||||
|
Install-PackageProvider -Name NuGet -Force
|
||||||
|
Install-Module Microsoft.WinGet.Client -Force
|
||||||
|
Import-Module Microsoft.WinGet.Client
|
||||||
|
Repair-WinGetPackageManager
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,67 +17,12 @@ function Test-WinUtilPackageManager {
|
|||||||
[System.Management.Automation.SwitchParameter]$choco
|
[System.Management.Automation.SwitchParameter]$choco
|
||||||
)
|
)
|
||||||
|
|
||||||
$status = "not-installed"
|
|
||||||
|
|
||||||
if ($winget) {
|
if ($winget) {
|
||||||
# Check if Winget is available while getting it's Version if it's available
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
||||||
$wingetExists = $true
|
|
||||||
try {
|
|
||||||
$wingetInfo = winget --info
|
|
||||||
# Extract the package version from the output
|
|
||||||
$wingetVersionFull = ($wingetInfo | Select-String -Pattern 'Microsoft\.DesktopAppInstaller v\d+\.\d+\.\d+\.\d+').Matches.Value
|
|
||||||
if ($wingetVersionFull) {
|
|
||||||
$wingetVersionFull = $wingetVersionFull.Split(' ')[-1].TrimStart('v')
|
|
||||||
} else {
|
|
||||||
# Fallback in case the pattern isn't found
|
|
||||||
$wingetVersionFull = ($wingetInfo | Select-String -Pattern 'Package Manager v\d+\.\d+\.\d+').Matches.Value.Split(' ')[-1]
|
|
||||||
}
|
|
||||||
} catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] {
|
|
||||||
Write-Warning "Winget was not found due to un-availability reasons"
|
|
||||||
$wingetExists = $false
|
|
||||||
} catch {
|
|
||||||
Write-Warning "Winget was not found due to un-known reasons, The Stack Trace is:`n$($psitem.Exception.StackTrace)"
|
|
||||||
$wingetExists = $false
|
|
||||||
}
|
|
||||||
|
|
||||||
# If Winget is available, Parse it's Version and give proper information to Terminal Output.
|
|
||||||
# If it isn't available, the return of this function will be "not-installed", indicating that
|
|
||||||
# Winget isn't installed/available on The System.
|
|
||||||
if ($wingetExists) {
|
|
||||||
# Check if Preview Version
|
|
||||||
if ($wingetVersionFull.Contains("-preview")) {
|
|
||||||
$wingetVersion = $wingetVersionFull.Trim("-preview")
|
|
||||||
$wingetPreview = $true
|
|
||||||
} else {
|
|
||||||
$wingetVersion = $wingetVersionFull
|
|
||||||
$wingetPreview = $false
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if Winget's Version is too old.
|
|
||||||
$wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v'))
|
|
||||||
# Grabs the latest release of Winget from the GitHub API for version check process.
|
|
||||||
$response = winget search -e Microsoft.AppInstaller --accept-source-agreements
|
|
||||||
$wingetLatestVersion = ($response | Select-String -Pattern '\d+\.\d+\.\d+\.\d+').Matches.Value
|
|
||||||
Write-Host "Latest Search Version: $wingetLatestVersion" -ForegroundColor White
|
|
||||||
Write-Host "Current Installed Version: $wingetCurrentVersion" -ForegroundColor White
|
|
||||||
$wingetOutdated = $wingetCurrentVersion -lt [System.Version]::Parse($wingetLatestVersion)
|
|
||||||
Write-Host "===========================================" -ForegroundColor Green
|
Write-Host "===========================================" -ForegroundColor Green
|
||||||
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
||||||
Write-Host "===========================================" -ForegroundColor Green
|
Write-Host "===========================================" -ForegroundColor Green
|
||||||
|
$status = "installed"
|
||||||
if (!$wingetPreview) {
|
|
||||||
Write-Host " - Winget is a release version." -ForegroundColor Green
|
|
||||||
} else {
|
|
||||||
Write-Host " - Winget is a preview version. Unexpected problems may occur." -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$wingetOutdated) {
|
|
||||||
Write-Host " - Winget is Up to Date" -ForegroundColor Green
|
|
||||||
$status = "installed"
|
|
||||||
} else {
|
|
||||||
Write-Host " - Winget is Out of Date" -ForegroundColor Red
|
|
||||||
$status = "outdated"
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Write-Host "===========================================" -ForegroundColor Red
|
Write-Host "===========================================" -ForegroundColor Red
|
||||||
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
|
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
|
||||||
@@ -87,11 +32,10 @@ function Test-WinUtilPackageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($choco) {
|
if ($choco) {
|
||||||
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)) {
|
if (Get-Command choco -ErrorAction SilentlyContinue) {
|
||||||
Write-Host "===========================================" -ForegroundColor Green
|
Write-Host "===========================================" -ForegroundColor Green
|
||||||
Write-Host "--- Chocolatey is installed ---" -ForegroundColor Green
|
Write-Host "--- Chocolatey is installed ---" -ForegroundColor Green
|
||||||
Write-Host "===========================================" -ForegroundColor Green
|
Write-Host "===========================================" -ForegroundColor Green
|
||||||
Write-Host "Version: v$chocoVersion" -ForegroundColor White
|
|
||||||
$status = "installed"
|
$status = "installed"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "===========================================" -ForegroundColor Red
|
Write-Host "===========================================" -ForegroundColor Red
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ function Invoke-WPFFixesWinget {
|
|||||||
# Install Choco if not already present
|
# Install Choco if not already present
|
||||||
try {
|
try {
|
||||||
Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
|
Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
|
||||||
Install-WinUtilChoco
|
Write-Host "==> Starting Winget Repair"
|
||||||
Start-Process -FilePath "choco" -ArgumentList "install winget -y --force" -NoNewWindow -Wait
|
Install-WinUtilWinget -Force
|
||||||
} catch {
|
} catch {
|
||||||
Write-Error "Failed to install winget: $_"
|
Write-Error "Failed to install winget: $_"
|
||||||
Set-WinUtilTaskbaritem -state "Error" -overlay "warning"
|
Set-WinUtilTaskbaritem -state "Error" -overlay "warning"
|
||||||
|
|||||||
@@ -451,13 +451,11 @@ $NavLogoPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size 25)) | Out-N
|
|||||||
$winutildir = @{}
|
$winutildir = @{}
|
||||||
|
|
||||||
# Set the path for the winutil directory
|
# Set the path for the winutil directory
|
||||||
$winutildir["path"] = "$env:LOCALAPPDATA\winutil\"
|
$winutildir = "$env:LocalAppData\winutil\"
|
||||||
[System.IO.Directory]::CreateDirectory($winutildir["path"]) | Out-Null
|
New-Item $winutildir -ItemType Directory -Force | Out-Null
|
||||||
|
|
||||||
$winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico"
|
if (Test-Path "$winutildir\logo.ico") {
|
||||||
|
$sync["logorender"] = "$winutildir\logo.ico"
|
||||||
if (Test-Path $winutildir["logo.ico"]) {
|
|
||||||
$sync["logorender"] = $winutildir["logo.ico"]
|
|
||||||
} else {
|
} else {
|
||||||
$sync["logorender"] = (Invoke-WinUtilAssets -Type "Logo" -Size 90 -Render)
|
$sync["logorender"] = (Invoke-WinUtilAssets -Type "Logo" -Size 90 -Render)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
|
|||||||
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
|
|
||||||
$logdir = "$env:localappdata\winutil\logs"
|
$logdir = "$env:localappdata\winutil\logs"
|
||||||
[System.IO.Directory]::CreateDirectory("$logdir") | Out-Null
|
New-Item $logdir -ItemType Directory -Force | Out-Null
|
||||||
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
|
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
|
||||||
|
|
||||||
# Set PowerShell window title
|
# Set PowerShell window title
|
||||||
|
|||||||
Reference in New Issue
Block a user