From 4a7c8a35bf2e874579504fb81d5b3589823da7a0 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sat, 30 Mar 2024 11:46:29 -0500 Subject: [PATCH] Sacrifice to the AV Gods test 24-03-28 branch (#1766) * Remove the Non-existing 'WPFMiscTweaksPower' found in the 'preset.json' File (#1763) * Compile Winutil * Update of Test-WinUtilPackageManager and Install-WinUtilWinget (#1757) * Updated Install-WinUtilWinget and Test-WinUtilPackageManager - Updated Test-WinUtilPackageManager to better handle the -Winget param and return a more verbose status. - Moved many of the "is installed"/"is not installed" outputs to the Test-WinUtilPackageManager function. - Changed Install-WinUtilWinget to use the GitHub install method as the primary method, and on error use the Chocolatey install method. - Updated various functions to use the Test-WinUtilPackageManager function. * Update Install-WinUtilWinget.ps1 - Changed handling of Test-WinUtilPackageManager in Install-WinUtilWinget, to prevent Test-WinUtilPackageManager from printing out to terminal twice. * Compile Winutil * Update Paint.NET Winget name. (#1758) Paint.NET's winget package name changed. * Compile Winutil * Fixed Programms names and urls and github actions (#1759) * Compile Winutil * trying to fix github actions * Update applications.json * Compile Winutil * updated winget package PaintDotNet * Compile Winutil * Update functions.Tests.ps1 * fixing typos in unittesting * fixed the issue that made pester not to work * Compile Winutil * found a bug and fixed it * Compile Winutil --------- Co-authored-by: YusufKhalifadev * Detect free space of installation drive and compare it with the ISO size and delete temporary MicroWin files from previous runs (#1761) * Detect free space of installation drive Compare the size of the ISO file with the free space of the installation drive (or the drive containing the User files) and, if the free size is below a certain threshold, the script will throw either a warning or an error * Delete temporary files from previous runs * Add Simple Feature to keep the Service Startup upon Applying Service Tweaks, but not when Undoing it (#1760) Added a new parameter that gives freedom of control on whether to disable this feature or not, and of course the simple feature in question. The way it works is by Getting the service using its name, and see if the Startup Value of this service is equal to the default type that Windows comes with it, if not (The User has changed it in the past), then WinUtil won't change it by default (The KeepServiceStartup is true by default), this is a more desirable behaviour when compared to how it previously worked. These changes were tested by the Author of this commit, Please read the commit patches for exact details on the changes. * Compile Winutil * Sacrifice to the AV Gods Remove Self Elevation and Disable UAC --------- Co-authored-by: Mr.k Co-authored-by: ChrisTitusTech Co-authored-by: Rux Co-authored-by: YusufKhalifadev Co-authored-by: YusufKhalifadev Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com> --- .github/workflows/unittests.yaml | 2 +- config/applications.json | 44 +- config/preset.json | 3 +- config/tweaks.json | 16 - functions/private/Install-WinUtilChoco.ps1 | 11 +- functions/private/Install-WinUtilWinget.ps1 | 65 +-- functions/private/Invoke-WinUtilGPU.ps1 | 2 +- ...tickyKeys => Invoke-WinUtilStickyKeys.ps1} | 0 functions/private/Invoke-WinUtilTweaks.ps1 | 33 +- .../private/Test-WinUtilPackageManager.ps1 | 85 ++-- functions/public/Invoke-WPFGetInstalled.ps1 | 7 +- functions/public/Invoke-WPFGetIso.ps1 | 36 ++ functions/public/Invoke-WPFInstallUpgrade.ps1 | 7 +- pester/functions.Tests.ps1 | 4 +- scripts/main.ps1 | 2 +- scripts/start.ps1 | 8 +- winutil.ps1 | 388 ++++++++++-------- xaml/inputApp.xaml | 70 ++-- xaml/inputTweaks.xaml | 1 - 19 files changed, 452 insertions(+), 332 deletions(-) mode change 100755 => 100644 config/applications.json rename functions/private/{Invoke-WinUtilStickyKeys => Invoke-WinUtilStickyKeys.ps1} (100%) diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index 6e64cdf2..bc2d8827 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -27,7 +27,7 @@ jobs: - name: Install Pester run: | Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process - Install-Module -Name Pester -Force -AllowClobber + Install-Module -Name Pester -Force -SkipPublisherCheck -AllowClobber shell: pwsh - name: Run Pester tests diff --git a/config/applications.json b/config/applications.json old mode 100755 new mode 100644 index b0cd217b..03600bab --- a/config/applications.json +++ b/config/applications.json @@ -44,7 +44,7 @@ "choco": "alacritty", "content": "Alacritty Terminal", "description": "Alacritty is a fast, cross-platform, and GPU-accelerated terminal emulator. It is designed for performance and aims to be the fastest terminal emulator available.", - "link": "https://github.com/alacritty/alacritty", + "link": "https://alacritty.org/", "winget": "Alacritty.Alacritty" }, "WPFInstallanaconda3": { @@ -196,7 +196,7 @@ "choco": "carnac", "content": "Carnac", "description": "Carnac is a keystroke visualizer for Windows. It displays keystrokes in an overlay, making it useful for presentations, tutorials, and live demonstrations.", - "link": "https://github.com/Code52/carnac", + "link": "https://carnackeys.com/", "winget": "code52.Carnac" }, "WPFInstallcemu": { @@ -256,7 +256,7 @@ "winget": "CloneHeroTeam.CloneHero" }, "WPFInstallcopyq": { - "category": "Multimedia Tools", + "category": "Utilities", "choco": "copyq", "content": "CopyQ (Clipboard Manager)", "description": "CopyQ is a clipboard manager with advanced features, allowing you to store, edit, and retrieve clipboard history.", @@ -402,7 +402,7 @@ "WPFInstallduplicati": { "category": "Utilities", "choco": "duplicati", - "content": "Duplicati 2", + "content": "Duplicati", "description": "Duplicati is an open-source backup solution that supports encrypted, compressed, and incremental backups. It is designed to securely store data on cloud storage services.", "link": "https://www.duplicati.com/", "winget": "Duplicati.Duplicati" @@ -514,9 +514,9 @@ "WPFInstallfileconverter": { "category": "Utilities", "choco": "files", - "content": "File Converter", + "content": "File-Converter", "description": "File Converter is a very simple tool which allows you to convert and compress one or several file(s) using the context menu in windows explorer.", - "link": "https://file-converter.org/", + "link": "https://file-converter.io/", "winget": "AdrienAllard.FileConverter" }, "WPFInstallfirealpaca": { @@ -540,7 +540,7 @@ "choco": "FirefoxESR", "content": "Firefox ESR", "description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions. Firefox ESR (Extended Support Release) receives major updates every 42 weeks with minor updates such as crash fixes, security fixes and policy updates as needed, but at least every four weeks.", - "link": "https://www.mozilla.org/en-US/firefox/new/", + "link": "https://www.mozilla.org/en-US/firefox/enterprise/", "winget": "Mozilla.Firefox.ESR" }, "WPFInstallflameshot": { @@ -570,7 +570,7 @@ "WPFInstallflux": { "category": "Utilities", "choco": "flux", - "content": "f.lux", + "content": "F.lux", "description": "f.lux adjusts the color temperature of your screen to reduce eye strain during nighttime use.", "link": "https://justgetflux.com/", "winget": "flux.flux" @@ -716,7 +716,7 @@ "choco": "gsudo", "content": "Gsudo", "description": "Gsudo is a sudo implementation for Windows, allowing elevated privilege execution.", - "link": "https://github.com/gerardog/gsudo", + "link": "https://gerardog.github.io/gsudo/", "winget": "gerardog.gsudo" }, "WPFInstallguilded": { @@ -876,7 +876,7 @@ "choco": "jellyfin-media-player", "content": "Jellyfin Media Player", "description": "Jellyfin Media Player is a client application for the Jellyfin media server, providing access to your media library.", - "link": "https://jellyfin.org/", + "link": "https://github.com/jellyfin/jellyfin-media-playerf", "winget": "Jellyfin.JellyfinMediaPlayer" }, "WPFInstalljellyfinserver": { @@ -1060,7 +1060,7 @@ "choco": "motrix", "content": "Motrix Download Manager", "description": "A full-featured download manager.", - "link": "https://github.com/agalwood/Motrix", + "link": "https://motrix.app/", "winget": "agalwood.Motrix" }, "WPFInstallmpc": { @@ -1180,7 +1180,7 @@ "choco": "nomacs", "content": "Nomacs (Image viewer)", "description": "Nomacs is a free, open-source image viewer that supports multiple platforms. It features basic image editing capabilities and supports a variety of image formats.", - "link": "https://github.com/nomacs/nomacs", + "link": "https://nomacs.org/", "winget": "nomacs.nomacs" }, "WPFInstallnotepadplus": { @@ -1341,7 +1341,7 @@ "content": "Paint.NET", "description": "Paint.NET is a free image and photo editing software for Windows. It features an intuitive user interface and supports a wide range of powerful editing tools.", "link": "https://www.getpaint.net/", - "winget": "dotPDNLLC.paintdotnet" + "winget": "dotPDN.PaintDotNet" }, "WPFInstallparsec": { "category": "Utilities", @@ -1404,7 +1404,7 @@ "choco": "portmaster", "content": "Portmaster", "description": "Portmaster is a free and open-source application that puts you back in charge over all your computers network connections.", - "link": "https://github.com/safing/portmaster", + "link": "https://safing.io/", "winget": "Safing.Portmaster" }, "WPFInstallposh": { @@ -1634,7 +1634,7 @@ "WPFInstallsimplewall": { "category": "Pro Tools", "choco": "simplewall", - "content": "simplewall", + "content": "Simplewall", "description": "simplewall is a free and open-source firewall application for Windows. It allows users to control and manage the inbound and outbound network traffic of applications.", "link": "https://github.com/henrypp/simplewall", "winget": "Henry++.simplewall" @@ -1692,7 +1692,7 @@ "choco": "strawberrymusicplayer", "content": "Strawberry (Music Player)", "description": "Strawberry is an open-source music player that focuses on music collection management and audio quality. It supports various audio formats and features a clean user interface.", - "link": "https://github.com/strawberrymusicplayer/strawberry/", + "link": "https://www.strawberrymusicplayer.org/", "winget": "StrawberryMusicPlayer.Strawberry" }, "WPFInstallstremio": { @@ -1964,7 +1964,7 @@ "choco": "na", "content": "Videomass", "description": "Videomass by GianlucaPernigotto is a cross-platform GUI for FFmpeg, streamlining multimedia file processing with batch conversions and user-friendly features.", - "link": "https://github.com/jeanslack/Videomass", + "link": "https://jeanslack.github.io/Videomass/", "winget": "GianlucaPernigotto.Videomass" }, "WPFInstallvisualstudio": { @@ -2068,7 +2068,7 @@ "choco": "wingetui", "content": "WingetUI", "description": "WingetUI is a graphical user interface for Microsoft's Windows Package Manager (winget).", - "link": "https://github.com/marticliment/WingetUI", + "link": "https://www.marticliment.com/wingetui/", "winget": "SomePythonThings.WingetUIStore" }, "WPFInstallwinmerge": { @@ -2140,11 +2140,11 @@ "choco": "xdm", "content": "Xtreme Download Manager", "description": "Xtreme Download Manager is an advanced download manager with support for various protocols and browsers.*Browser integration deprecated by google store. No official release.*", - "link": "https://github.com/subhra74/xdm", + "link": "https://xtremedownloadmanager.com/", "winget": "subhra74.XtremeDownloadManager" }, "WPFInstallxeheditor": { - "category": "Development", + "category": "Utilities", "choco": "HxD", "content": "HxD Hex Editor", "description": "HxD is a free hex editor that allows you to edit, view, search, and analyze binary files.", @@ -2250,7 +2250,7 @@ "WPFInstallsyncthingtray": { "category": "Utilities", "choco": "syncthingtray", - "content": "syncthingtray", + "content": "Syncthingtray", "description": "Might be the alternative for Synctrayzor. Windows tray utility / filesystem watcher / launcher for Syncthing", "link": "https://github.com/Martchus/syncthingtray", "winget": "Martchus.syncthingtray" @@ -2274,7 +2274,7 @@ "WPFInstallintelpresentmon": { "category": "Utilities", "choco": "na", - "content": "IntelĀ® PresentMon", + "content": "Intel-PresentMon", "description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.", "link": "https://game.intel.com/us/stories/intel-presentmon/", "winget": "Intel.PresentMon.Beta" diff --git a/config/preset.json b/config/preset.json index 51b48fa1..807f76a3 100644 --- a/config/preset.json +++ b/config/preset.json @@ -9,8 +9,7 @@ "WPFTweaksServices", "WPFTweaksStorage", "WPFTweaksTele", - "WPFTweaksWifi", - "WPFMiscTweaksPower" + "WPFTweaksWifi" ], "laptop": [ "WPFTweaksAH", diff --git a/config/tweaks.json b/config/tweaks.json index 68dea51b..cd074d65 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2420,22 +2420,6 @@ " ] }, - "WPFTweaksDisableUAC": { - "Content": "Disable UAC", - "Description": "Disables User Account Control. Only recommended for Expert Users.", - "category": "z__Advanced Tweaks - CAUTION", - "panel": "1", - "Order": "a023_", - "registry": [ - { - "Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", - "OriginalValue": "5", - "Name": "ConsentPromptBehaviorAdmin", - "Value": "0", - "Type": "DWord" - } - ] - }, "WPFTweaksDeleteTempFiles": { "Content": "Delete Temporary Files", "Description": "Erases TEMP Folders", diff --git a/functions/private/Install-WinUtilChoco.ps1 b/functions/private/Install-WinUtilChoco.ps1 index 83e7160d..24716bb1 100644 --- a/functions/private/Install-WinUtilChoco.ps1 +++ b/functions/private/Install-WinUtilChoco.ps1 @@ -10,20 +10,19 @@ function Install-WinUtilChoco { try { Write-Host "Checking if Chocolatey is Installed..." - if((Get-Command -Name choco -ErrorAction Ignore)) { - Write-Host "Chocolatey Already Installed" + if((Test-WinUtilPackageManager -choco) -eq "installed") { return } - Write-Host "Seems Chocolatey is not installed, installing now" + Write-Host "Seems Chocolatey is not installed, installing now." Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop powershell choco feature enable -n allowGlobalConfirmation } Catch { - Write-Host "===========================================" - Write-Host "-- Chocolatey failed to install ---" - Write-Host "===========================================" + Write-Host "===========================================" -Foregroundcolor Red + Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red + Write-Host "===========================================" -Foregroundcolor Red } } diff --git a/functions/private/Install-WinUtilWinget.ps1 b/functions/private/Install-WinUtilWinget.ps1 index a1da1f48..a0c7b7bd 100644 --- a/functions/private/Install-WinUtilWinget.ps1 +++ b/functions/private/Install-WinUtilWinget.ps1 @@ -7,52 +7,53 @@ function Install-WinUtilWinget { .DESCRIPTION This function will download the latest version of Winget and install it. If Winget is already installed, it will do nothing. #> - Try{ - Write-Host "Checking if Winget is Installed..." - if (Test-WinUtilPackageManager -Winget) { - # Checks if Winget executable exists and if the Windows Version is 1809 or higher - Write-Host "Winget Already Installed" + $isWingetInstalled = Test-WinUtilPackageManager -winget + + 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 { + } 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)" + Write-Host "Winget is not supported on this version of Windows (Pre-1809)" -ForegroundColor Red return } - if((Get-Command -Name choco -ErrorAction Ignore)) { - # Checks if Chocolatey is present (In case it didn't install properly), and installs Winget with choco, if so. - Write-Host "Chocolatey detected. Installing Winget via Chocolatey" - Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli" - Write-Host "Winget Installed" - Write-Output "Refreshing Environment Variables...`n" - $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + # Install Winget via GitHub method. + # Used part of my own script with some modification: ruxunderscore/windows-initialization + Write-Host "Downloading Winget Prerequsites`n" + Get-WinUtilWingetPrerequisites + Write-Host "Downloading Winget and License File`r" + Get-WinUtilWingetLatest + Write-Host "Installing Winget w/ Prerequsites`r" + Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml + Write-Host "Winget Installed" -ForegroundColor Green + # Winget only needs a refresh of the environment variables to be used. + Write-Output "Refreshing Environment Variables...`n" + $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + } Catch { + Write-Host "Failure detected while installing via GitHub method. Continuing with Chocolatey method as fallback." -ForegroundColor Red + # In case install fails via GitHub method. + Try { + Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli" + Write-Host "Winget Installed" -ForegroundColor Green + Write-Output "Refreshing Environment Variables...`n" + $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + } Catch { + throw [WingetFailedInstall]::new('Failed to install!') } - Else { - # If Chocolatey doesn't exist, it will install Winget through more manual means. - # Used part of my own script with some modification: ruxunderscore/windows-initialization - Write-Host "Downloading Winget Prerequsites" - Get-WinUtilWingetPrerequisites - Write-Host "Downloading Winget and License File" - Get-WinUtilWingetLatest - Write-Host "Installing Winget w/ Prerequsites" - Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml - Write-Host "Winget Installed" - # Winget only needs a refresh of the environment variables to be used. - Write-Output "Refreshing Environment Variables...`n" - $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") - } - } - Catch{ - throw [WingetFailedInstall]::new('Failed to install') } } diff --git a/functions/private/Invoke-WinUtilGPU.ps1 b/functions/private/Invoke-WinUtilGPU.ps1 index b7eac175..e5436f82 100644 --- a/functions/private/Invoke-WinUtilGPU.ps1 +++ b/functions/private/Invoke-WinUtilGPU.ps1 @@ -1,4 +1,4 @@ -function Invoke-GPUCheck { +function Invoke-WinUtilGPU { $gpuInfo = Get-CimInstance Win32_VideoController foreach ($gpu in $gpuInfo) { diff --git a/functions/private/Invoke-WinUtilStickyKeys b/functions/private/Invoke-WinUtilStickyKeys.ps1 similarity index 100% rename from functions/private/Invoke-WinUtilStickyKeys rename to functions/private/Invoke-WinUtilStickyKeys.ps1 diff --git a/functions/private/Invoke-WinUtilTweaks.ps1 b/functions/private/Invoke-WinUtilTweaks.ps1 index dfce78e6..843c91f0 100644 --- a/functions/private/Invoke-WinUtilTweaks.ps1 +++ b/functions/private/Invoke-WinUtilTweaks.ps1 @@ -10,11 +10,15 @@ function Invoke-WinUtilTweaks { .PARAMETER undo Indicates whether to undo the operation contained in the checkbox + .PARAMETER KeepServiceStartup + Indicates whether to override the startup of a service with the one given from WinUtil, + or to keep the startup of said service, if it was changed by the user, or another program, from its default value. #> param( $CheckBox, - $undo = $false + $undo = $false, + $KeepServiceStartup = $true ) Write-Debug "Tweaks: $($CheckBox)" @@ -32,6 +36,7 @@ function Invoke-WinUtilTweaks { Registry = "Value" ScheduledTask = "State" Service = "StartupType" + OriginalService = "OriginalType" ScriptType = "InvokeScript" } } @@ -42,9 +47,29 @@ function Invoke-WinUtilTweaks { } } if($sync.configs.tweaks.$CheckBox.service){ + Write-Debug "KeepServiceStartup is $KeepServiceStartup" $sync.configs.tweaks.$CheckBox.service | ForEach-Object { - Write-Debug "$($psitem.Name) and state is $($psitem.$($values.service))" - Set-WinUtilService -Name $psitem.Name -StartupType $psitem.$($values.Service) + $changeservice = $true + + # The check for !($undo) is required, without it the script will throw an error for accessing unavailable memeber, which's the 'OriginalService' Property + if($KeepServiceStartup -AND !($undo)) { + try { + # Check if the service exists + $service = Get-Service -Name $psitem.Name -ErrorAction Stop + if(!($service.StartType.ToString() -eq $psitem.$($values.OriginalService))) { + Write-Debug "Service $($service.Name) was changed in the past to $($service.StartType.ToString()) from it's original type of $($psitem.$($values.OriginalService)), will not change it to $($psitem.$($values.service))" + $changeservice = $false + } + } + catch [System.ServiceProcess.ServiceNotFoundException] { + Write-Warning "Service $($psitem.Name) was not found" + } + } + + if($changeservice) { + Write-Debug "$($psitem.Name) and state is $($psitem.$($values.service))" + Set-WinUtilService -Name $psitem.Name -StartupType $psitem.$($values.Service) + } } } if($sync.configs.tweaks.$CheckBox.registry){ @@ -70,4 +95,4 @@ function Invoke-WinUtilTweaks { } } -} \ No newline at end of file +} diff --git a/functions/private/Test-WinUtilPackageManager.ps1 b/functions/private/Test-WinUtilPackageManager.ps1 index acd9224b..768c671c 100644 --- a/functions/private/Test-WinUtilPackageManager.ps1 +++ b/functions/private/Test-WinUtilPackageManager.ps1 @@ -17,47 +17,70 @@ function Test-WinUtilPackageManager { [System.Management.Automation.SwitchParameter]$choco ) - # Install Winget if not detected - $wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue - if ($wingetExists) { - $wingetversionfull = (winget --version) - $wingetversiontrim = $wingetversionfull.Trim('v') - if ($wingetversiontrim.EndsWith("-preview")) { - $wingetversiontrim = $wingetversiontrim.Trim('-preview') - $wingetpreview = $true - } - $wingetVersion = [System.Version]::Parse($wingetversiontrim) - $minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691 - $wingetOutdated = $wingetVersion -le $minimumWingetVersion - - Write-Host "Winget $wingetVersionfull" - } - - if (!$wingetExists -or $wingetOutdated) { - if (!$wingetExists) { - Write-Host "Winget not detected" - } else { - Write-Host "- Winget out-dated" - } - } + $status = "not-installed" if ($winget) { - if ($wingetExists -and !$wingetOutdated) { - if (!$wingetpreview) { - Write-Host "- Winget up-to-date" + # Install Winget if not detected + $wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue + + if ($wingetExists) { + # Check Winget Version + $wingetVersionFull = (winget --version) # Full Version without 'v'. + + # Check if Preview Version + if ($wingetVersionFull.Contains("-preview")) { + $wingetVersion = $wingetVersionFull.Trim("-preview") + $wingetPreview = $true } else { - Write-Host "- Winget preview version detected. Unexptected problems may occur" -ForegroundColor Yellow + $wingetVersion = $wingetVersionFull + $wingetPreview = $false } - return $true + + # Check if Winget's Version is too old. + $wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v')) + $wingetBadVersion = [System.Version]::Parse("1.2.10691") # Windows 11 (22H2) comes with v1.2.10691, which is bugged. + $wingetOutdated = $wingetCurrentVersion -le $wingetBadVersion + Write-Host "===========================================" -ForegroundColor Green + Write-Host "-- Winget is installed ---" -ForegroundColor Green + Write-Host "===========================================" -ForegroundColor Green + Write-Host "Version: $wingetVersionFull" -ForegroundColor White + + 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 { + Write-Host "===========================================" -ForegroundColor Red + Write-Host "-- Winget is not installed ---" -ForegroundColor Red + Write-Host "===========================================" -ForegroundColor Red + $status = "not-installed" } } if ($choco) { if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)) { - Write-Host "Chocolatey v$chocoVersion" - return $true + Write-Host "===========================================" -ForegroundColor Green + Write-Host "-- Chocolatey is installed ---" -ForegroundColor Green + Write-Host "===========================================" -ForegroundColor Green + Write-Host "Version: v$chocoVersion" -ForegroundColor White + $status = "installed" + } else { + Write-Host "===========================================" -ForegroundColor Red + Write-Host "-- Chocolatey is not installed ---" -ForegroundColor Red + Write-Host "===========================================" -ForegroundColor Red + $status = "not-installed" } } - return $false + return $status } diff --git a/functions/public/Invoke-WPFGetInstalled.ps1 b/functions/public/Invoke-WPFGetInstalled.ps1 index b3df6a8d..18b690fd 100644 --- a/functions/public/Invoke-WPFGetInstalled.ps1 +++ b/functions/public/Invoke-WPFGetInstalled.ps1 @@ -16,10 +16,7 @@ function Invoke-WPFGetInstalled { return } - if(!(Get-Command -Name winget -ErrorAction SilentlyContinue) -and $checkbox -eq "winget"){ - Write-Host "===========================================" - Write-Host "-- Winget is not installed ---" - Write-Host "===========================================" + if(((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget"){ return } @@ -46,4 +43,4 @@ function Invoke-WPFGetInstalled { Write-Host "Done..." $sync.ProcessRunning = $false } -} \ No newline at end of file +} diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 95f866c2..1b448a4f 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -90,6 +90,29 @@ function Invoke-WPFGetIso { return } + # Detect the file size of the ISO and compare it with the free space of the system drive + $isoSize = (Get-Item -Path $filePath).Length + Write-Debug "Size of ISO file: $($isoSize) bytes" + # Use this procedure to get the free space of the drive depending on where the user profile folder is stored. + # This is done to guarantee a dynamic solution, as the installation drive may be mounted to a letter different than C + $driveSpace = (Get-Volume -DriveLetter ([IO.Path]::GetPathRoot([Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)).Replace(":\", "").Trim())).SizeRemaining + Write-Debug "Free space on installation drive: $($driveSpace) bytes" + if ($driveSpace -lt ($isoSize * 2)) + { + # It's not critical and we _may_ continue. Output a warning + Write-Warning "You may not have enough space for this operation. Proceed at your own risk." + } + elseif ($driveSpace -lt $isoSize) + { + # It's critical and we can't continue. Output an error + Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations." + return + } + else + { + Write-Host "You have enough space for this operation." + } + try { Write-Host "Mounting Iso. Please wait." $mountedISO = Mount-DiskImage -PassThru "$filePath" @@ -123,6 +146,19 @@ function Invoke-WPFGetIso { $sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\' } + + # Detect if the folders already exist and remove them + if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text)) + { + try { + Write-Host "Deleting temporary files from previous run. Please wait..." + Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force + Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force + } + catch { + Write-Host "Could not delete temporary files. You need to delete those manually." + } + } Write-Host "Setting up mount dir and scratch dirs" $timestamp = Get-Date -Format "yyyyMMdd_HHmmss" diff --git a/functions/public/Invoke-WPFInstallUpgrade.ps1 b/functions/public/Invoke-WPFInstallUpgrade.ps1 index 82184e80..a8e985bd 100644 --- a/functions/public/Invoke-WPFInstallUpgrade.ps1 +++ b/functions/public/Invoke-WPFInstallUpgrade.ps1 @@ -5,10 +5,7 @@ function Invoke-WPFInstallUpgrade { Invokes the function that upgrades all installed programs using winget #> - if(!(Get-Command -Name winget -ErrorAction SilentlyContinue)){ - Write-Host "===========================================" - Write-Host "-- Winget is not installed ---" - Write-Host "===========================================" + if((Test-WinUtilPackageManager -winget) -eq "not-installed"){ return } @@ -24,4 +21,4 @@ function Invoke-WPFInstallUpgrade { Write-Host "-- Updates started ---" Write-Host "-- You can close this window if desired ---" Write-Host "===========================================" -} \ No newline at end of file +} diff --git a/pester/functions.Tests.ps1 b/pester/functions.Tests.ps1 index d02a31a0..6606d5c7 100644 --- a/pester/functions.Tests.ps1 +++ b/pester/functions.Tests.ps1 @@ -37,8 +37,8 @@ Describe "Functions"{ basename = $($psitem.BaseName) fullname = $psitem.FullName } { - Get-ChildItem function:\$basename | should -Not -BeNullOrEmpty + Get-ChildItem function:\$basename | Should -Not -BeNullOrEmpty } } } -} +} \ No newline at end of file diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 4e776ad1..4a722022 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -53,7 +53,7 @@ $sync.runspace.Open() $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^ Terminal(Admin) ---" -Foregroundcolor Red + Write-Host "===========================================" -Foregroundcolor Red break } \ No newline at end of file diff --git a/winutil.ps1 b/winutil.ps1 index ab23d85d..2f5d7f82 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.03.28 + Version : 24.03.30 #> param ( [switch]$Debug, @@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.03.28" +$sync.version = "24.03.30" $sync.configs = @{} $sync.ProcessRunning = $false @@ -63,10 +63,10 @@ if ($principal.IsInRole($adminRole)) } else { - $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; - $newProcess.Arguments = $myInvocation.MyCommand.Definition; - $newProcess.Verb = "runas"; - [System.Diagnostics.Process]::Start($newProcess); + Write-Host "===========================================" -Foregroundcolor Red + Write-Host "-- Scripts must be run as Administrator ---" -Foregroundcolor Red + Write-Host "-- Right-Click Start -> Terminal(Admin) ---" -Foregroundcolor Red + Write-Host "===========================================" -Foregroundcolor Red break } function ConvertTo-Icon { @@ -672,20 +672,19 @@ function Install-WinUtilChoco { try { Write-Host "Checking if Chocolatey is Installed..." - if((Get-Command -Name choco -ErrorAction Ignore)) { - Write-Host "Chocolatey Already Installed" + if((Test-WinUtilPackageManager -choco) -eq "installed") { return } - Write-Host "Seems Chocolatey is not installed, installing now" + Write-Host "Seems Chocolatey is not installed, installing now." Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop powershell choco feature enable -n allowGlobalConfirmation } Catch { - Write-Host "===========================================" - Write-Host "-- Chocolatey failed to install ---" - Write-Host "===========================================" + Write-Host "===========================================" -Foregroundcolor Red + Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red + Write-Host "===========================================" -Foregroundcolor Red } } @@ -745,53 +744,54 @@ function Install-WinUtilWinget { .DESCRIPTION This function will download the latest version of Winget and install it. If Winget is already installed, it will do nothing. #> - Try{ - Write-Host "Checking if Winget is Installed..." - if (Test-WinUtilPackageManager -Winget) { - # Checks if Winget executable exists and if the Windows Version is 1809 or higher - Write-Host "Winget Already Installed" + $isWingetInstalled = Test-WinUtilPackageManager -winget + + 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 { + } 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)" + Write-Host "Winget is not supported on this version of Windows (Pre-1809)" -ForegroundColor Red return } - if((Get-Command -Name choco -ErrorAction Ignore)) { - # Checks if Chocolatey is present (In case it didn't install properly), and installs Winget with choco, if so. - Write-Host "Chocolatey detected. Installing Winget via Chocolatey" - Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli" - Write-Host "Winget Installed" - Write-Output "Refreshing Environment Variables...`n" - $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + # Install Winget via GitHub method. + # Used part of my own script with some modification: ruxunderscore/windows-initialization + Write-Host "Downloading Winget Prerequsites`n" + Get-WinUtilWingetPrerequisites + Write-Host "Downloading Winget and License File`r" + Get-WinUtilWingetLatest + Write-Host "Installing Winget w/ Prerequsites`r" + Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml + Write-Host "Winget Installed" -ForegroundColor Green + # Winget only needs a refresh of the environment variables to be used. + Write-Output "Refreshing Environment Variables...`n" + $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + } Catch { + Write-Host "Failure detected while installing via GitHub method. Continuing with Chocolatey method as fallback." -ForegroundColor Red + # In case install fails via GitHub method. + Try { + Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli" + Write-Host "Winget Installed" -ForegroundColor Green + Write-Output "Refreshing Environment Variables...`n" + $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + } Catch { + throw [WingetFailedInstall]::new('Failed to install!') } - Else { - # If Chocolatey doesn't exist, it will install Winget through more manual means. - # Used part of my own script with some modification: ruxunderscore/windows-initialization - Write-Host "Downloading Winget Prerequsites" - Get-WinUtilWingetPrerequisites - Write-Host "Downloading Winget and License File" - Get-WinUtilWingetLatest - Write-Host "Installing Winget w/ Prerequsites" - Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml - Write-Host "Winget Installed" - # Winget only needs a refresh of the environment variables to be used. - Write-Output "Refreshing Environment Variables...`n" - $ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") - } - } - Catch{ - throw [WingetFailedInstall]::new('Failed to install') } } function Invoke-MicroWin-Helper { @@ -1672,7 +1672,7 @@ function Invoke-WinUtilFeatureInstall { } } } -function Invoke-GPUCheck { +function Invoke-WinUtilGPU { $gpuInfo = Get-CimInstance Win32_VideoController foreach ($gpu in $gpuInfo) { @@ -1931,11 +1931,15 @@ function Invoke-WinUtilTweaks { .PARAMETER undo Indicates whether to undo the operation contained in the checkbox + .PARAMETER KeepServiceStartup + Indicates whether to override the startup of a service with the one given from WinUtil, + or to keep the startup of said service, if it was changed by the user, or another program, from its default value. #> param( $CheckBox, - $undo = $false + $undo = $false, + $KeepServiceStartup = $true ) Write-Debug "Tweaks: $($CheckBox)" @@ -1953,6 +1957,7 @@ function Invoke-WinUtilTweaks { Registry = "Value" ScheduledTask = "State" Service = "StartupType" + OriginalService = "OriginalType" ScriptType = "InvokeScript" } } @@ -1963,9 +1968,29 @@ function Invoke-WinUtilTweaks { } } if($sync.configs.tweaks.$CheckBox.service){ + Write-Debug "KeepServiceStartup is $KeepServiceStartup" $sync.configs.tweaks.$CheckBox.service | ForEach-Object { - Write-Debug "$($psitem.Name) and state is $($psitem.$($values.service))" - Set-WinUtilService -Name $psitem.Name -StartupType $psitem.$($values.Service) + $changeservice = $true + + # The check for !($undo) is required, without it the script will throw an error for accessing unavailable memeber, which's the 'OriginalService' Property + if($KeepServiceStartup -AND !($undo)) { + try { + # Check if the service exists + $service = Get-Service -Name $psitem.Name -ErrorAction Stop + if(!($service.StartType.ToString() -eq $psitem.$($values.OriginalService))) { + Write-Debug "Service $($service.Name) was changed in the past to $($service.StartType.ToString()) from it's original type of $($psitem.$($values.OriginalService)), will not change it to $($psitem.$($values.service))" + $changeservice = $false + } + } + catch [System.ServiceProcess.ServiceNotFoundException] { + Write-Warning "Service $($psitem.Name) was not found" + } + } + + if($changeservice) { + Write-Debug "$($psitem.Name) and state is $($psitem.$($values.service))" + Set-WinUtilService -Name $psitem.Name -StartupType $psitem.$($values.Service) + } } } if($sync.configs.tweaks.$CheckBox.registry){ @@ -2520,49 +2545,72 @@ function Test-WinUtilPackageManager { [System.Management.Automation.SwitchParameter]$choco ) - # Install Winget if not detected - $wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue - if ($wingetExists) { - $wingetversionfull = (winget --version) - $wingetversiontrim = $wingetversionfull.Trim('v') - if ($wingetversiontrim.EndsWith("-preview")) { - $wingetversiontrim = $wingetversiontrim.Trim('-preview') - $wingetpreview = $true - } - $wingetVersion = [System.Version]::Parse($wingetversiontrim) - $minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691 - $wingetOutdated = $wingetVersion -le $minimumWingetVersion - - Write-Host "Winget $wingetVersionfull" - } - - if (!$wingetExists -or $wingetOutdated) { - if (!$wingetExists) { - Write-Host "Winget not detected" - } else { - Write-Host "- Winget out-dated" - } - } + $status = "not-installed" if ($winget) { - if ($wingetExists -and !$wingetOutdated) { - if (!$wingetpreview) { - Write-Host "- Winget up-to-date" + # Install Winget if not detected + $wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue + + if ($wingetExists) { + # Check Winget Version + $wingetVersionFull = (winget --version) # Full Version without 'v'. + + # Check if Preview Version + if ($wingetVersionFull.Contains("-preview")) { + $wingetVersion = $wingetVersionFull.Trim("-preview") + $wingetPreview = $true } else { - Write-Host "- Winget preview version detected. Unexptected problems may occur" -ForegroundColor Yellow + $wingetVersion = $wingetVersionFull + $wingetPreview = $false } - return $true + + # Check if Winget's Version is too old. + $wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v')) + $wingetBadVersion = [System.Version]::Parse("1.2.10691") # Windows 11 (22H2) comes with v1.2.10691, which is bugged. + $wingetOutdated = $wingetCurrentVersion -le $wingetBadVersion + Write-Host "===========================================" -ForegroundColor Green + Write-Host "-- Winget is installed ---" -ForegroundColor Green + Write-Host "===========================================" -ForegroundColor Green + Write-Host "Version: $wingetVersionFull" -ForegroundColor White + + 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 { + Write-Host "===========================================" -ForegroundColor Red + Write-Host "-- Winget is not installed ---" -ForegroundColor Red + Write-Host "===========================================" -ForegroundColor Red + $status = "not-installed" } } if ($choco) { if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)) { - Write-Host "Chocolatey v$chocoVersion" - return $true + Write-Host "===========================================" -ForegroundColor Green + Write-Host "-- Chocolatey is installed ---" -ForegroundColor Green + Write-Host "===========================================" -ForegroundColor Green + Write-Host "Version: v$chocoVersion" -ForegroundColor White + $status = "installed" + } else { + Write-Host "===========================================" -ForegroundColor Red + Write-Host "-- Chocolatey is not installed ---" -ForegroundColor Red + Write-Host "===========================================" -ForegroundColor Red + $status = "not-installed" } } - return $false + return $status } Function Update-WinUtilProgramWinget { @@ -3124,10 +3172,7 @@ function Invoke-WPFGetInstalled { return } - if(!(Get-Command -Name winget -ErrorAction SilentlyContinue) -and $checkbox -eq "winget"){ - Write-Host "===========================================" - Write-Host "-- Winget is not installed ---" - Write-Host "===========================================" + if(((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget"){ return } @@ -3247,6 +3292,29 @@ function Invoke-WPFGetIso { return } + # Detect the file size of the ISO and compare it with the free space of the system drive + $isoSize = (Get-Item -Path $filePath).Length + Write-Debug "Size of ISO file: $($isoSize) bytes" + # Use this procedure to get the free space of the drive depending on where the user profile folder is stored. + # This is done to guarantee a dynamic solution, as the installation drive may be mounted to a letter different than C + $driveSpace = (Get-Volume -DriveLetter ([IO.Path]::GetPathRoot([Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)).Replace(":\", "").Trim())).SizeRemaining + Write-Debug "Free space on installation drive: $($driveSpace) bytes" + if ($driveSpace -lt ($isoSize * 2)) + { + # It's not critical and we _may_ continue. Output a warning + Write-Warning "You may not have enough space for this operation. Proceed at your own risk." + } + elseif ($driveSpace -lt $isoSize) + { + # It's critical and we can't continue. Output an error + Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations." + return + } + else + { + Write-Host "You have enough space for this operation." + } + try { Write-Host "Mounting Iso. Please wait." $mountedISO = Mount-DiskImage -PassThru "$filePath" @@ -3280,6 +3348,19 @@ function Invoke-WPFGetIso { $sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\' } + + # Detect if the folders already exist and remove them + if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text)) + { + try { + Write-Host "Deleting temporary files from previous run. Please wait..." + Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force + Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force + } + catch { + Write-Host "Could not delete temporary files. You need to delete those manually." + } + } Write-Host "Setting up mount dir and scratch dirs" $timestamp = Get-Date -Format "yyyyMMdd_HHmmss" @@ -3477,10 +3558,7 @@ function Invoke-WPFInstallUpgrade { Invokes the function that upgrades all installed programs using winget #> - if(!(Get-Command -Name winget -ErrorAction SilentlyContinue)){ - Write-Host "===========================================" - Write-Host "-- Winget is not installed ---" - Write-Host "===========================================" + if((Test-WinUtilPackageManager -winget) -eq "not-installed"){ return } @@ -4798,7 +4876,7 @@ $sync.configs.applications = '{ "choco": "alacritty", "content": "Alacritty Terminal", "description": "Alacritty is a fast, cross-platform, and GPU-accelerated terminal emulator. It is designed for performance and aims to be the fastest terminal emulator available.", - "link": "https://github.com/alacritty/alacritty", + "link": "https://alacritty.org/", "winget": "Alacritty.Alacritty" }, "WPFInstallanaconda3": { @@ -4950,7 +5028,7 @@ $sync.configs.applications = '{ "choco": "carnac", "content": "Carnac", "description": "Carnac is a keystroke visualizer for Windows. It displays keystrokes in an overlay, making it useful for presentations, tutorials, and live demonstrations.", - "link": "https://github.com/Code52/carnac", + "link": "https://carnackeys.com/", "winget": "code52.Carnac" }, "WPFInstallcemu": { @@ -5010,7 +5088,7 @@ $sync.configs.applications = '{ "winget": "CloneHeroTeam.CloneHero" }, "WPFInstallcopyq": { - "category": "Multimedia Tools", + "category": "Utilities", "choco": "copyq", "content": "CopyQ (Clipboard Manager)", "description": "CopyQ is a clipboard manager with advanced features, allowing you to store, edit, and retrieve clipboard history.", @@ -5156,7 +5234,7 @@ $sync.configs.applications = '{ "WPFInstallduplicati": { "category": "Utilities", "choco": "duplicati", - "content": "Duplicati 2", + "content": "Duplicati", "description": "Duplicati is an open-source backup solution that supports encrypted, compressed, and incremental backups. It is designed to securely store data on cloud storage services.", "link": "https://www.duplicati.com/", "winget": "Duplicati.Duplicati" @@ -5268,9 +5346,9 @@ $sync.configs.applications = '{ "WPFInstallfileconverter": { "category": "Utilities", "choco": "files", - "content": "File Converter", + "content": "File-Converter", "description": "File Converter is a very simple tool which allows you to convert and compress one or several file(s) using the context menu in windows explorer.", - "link": "https://file-converter.org/", + "link": "https://file-converter.io/", "winget": "AdrienAllard.FileConverter" }, "WPFInstallfirealpaca": { @@ -5294,7 +5372,7 @@ $sync.configs.applications = '{ "choco": "FirefoxESR", "content": "Firefox ESR", "description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions. Firefox ESR (Extended Support Release) receives major updates every 42 weeks with minor updates such as crash fixes, security fixes and policy updates as needed, but at least every four weeks.", - "link": "https://www.mozilla.org/en-US/firefox/new/", + "link": "https://www.mozilla.org/en-US/firefox/enterprise/", "winget": "Mozilla.Firefox.ESR" }, "WPFInstallflameshot": { @@ -5324,7 +5402,7 @@ $sync.configs.applications = '{ "WPFInstallflux": { "category": "Utilities", "choco": "flux", - "content": "f.lux", + "content": "F.lux", "description": "f.lux adjusts the color temperature of your screen to reduce eye strain during nighttime use.", "link": "https://justgetflux.com/", "winget": "flux.flux" @@ -5470,7 +5548,7 @@ $sync.configs.applications = '{ "choco": "gsudo", "content": "Gsudo", "description": "Gsudo is a sudo implementation for Windows, allowing elevated privilege execution.", - "link": "https://github.com/gerardog/gsudo", + "link": "https://gerardog.github.io/gsudo/", "winget": "gerardog.gsudo" }, "WPFInstallguilded": { @@ -5630,7 +5708,7 @@ $sync.configs.applications = '{ "choco": "jellyfin-media-player", "content": "Jellyfin Media Player", "description": "Jellyfin Media Player is a client application for the Jellyfin media server, providing access to your media library.", - "link": "https://jellyfin.org/", + "link": "https://github.com/jellyfin/jellyfin-media-playerf", "winget": "Jellyfin.JellyfinMediaPlayer" }, "WPFInstalljellyfinserver": { @@ -5814,7 +5892,7 @@ $sync.configs.applications = '{ "choco": "motrix", "content": "Motrix Download Manager", "description": "A full-featured download manager.", - "link": "https://github.com/agalwood/Motrix", + "link": "https://motrix.app/", "winget": "agalwood.Motrix" }, "WPFInstallmpc": { @@ -5934,7 +6012,7 @@ $sync.configs.applications = '{ "choco": "nomacs", "content": "Nomacs (Image viewer)", "description": "Nomacs is a free, open-source image viewer that supports multiple platforms. It features basic image editing capabilities and supports a variety of image formats.", - "link": "https://github.com/nomacs/nomacs", + "link": "https://nomacs.org/", "winget": "nomacs.nomacs" }, "WPFInstallnotepadplus": { @@ -6095,7 +6173,7 @@ $sync.configs.applications = '{ "content": "Paint.NET", "description": "Paint.NET is a free image and photo editing software for Windows. It features an intuitive user interface and supports a wide range of powerful editing tools.", "link": "https://www.getpaint.net/", - "winget": "dotPDNLLC.paintdotnet" + "winget": "dotPDN.PaintDotNet" }, "WPFInstallparsec": { "category": "Utilities", @@ -6158,7 +6236,7 @@ $sync.configs.applications = '{ "choco": "portmaster", "content": "Portmaster", "description": "Portmaster is a free and open-source application that puts you back in charge over all your computers network connections.", - "link": "https://github.com/safing/portmaster", + "link": "https://safing.io/", "winget": "Safing.Portmaster" }, "WPFInstallposh": { @@ -6388,7 +6466,7 @@ $sync.configs.applications = '{ "WPFInstallsimplewall": { "category": "Pro Tools", "choco": "simplewall", - "content": "simplewall", + "content": "Simplewall", "description": "simplewall is a free and open-source firewall application for Windows. It allows users to control and manage the inbound and outbound network traffic of applications.", "link": "https://github.com/henrypp/simplewall", "winget": "Henry++.simplewall" @@ -6446,7 +6524,7 @@ $sync.configs.applications = '{ "choco": "strawberrymusicplayer", "content": "Strawberry (Music Player)", "description": "Strawberry is an open-source music player that focuses on music collection management and audio quality. It supports various audio formats and features a clean user interface.", - "link": "https://github.com/strawberrymusicplayer/strawberry/", + "link": "https://www.strawberrymusicplayer.org/", "winget": "StrawberryMusicPlayer.Strawberry" }, "WPFInstallstremio": { @@ -6718,7 +6796,7 @@ $sync.configs.applications = '{ "choco": "na", "content": "Videomass", "description": "Videomass by GianlucaPernigotto is a cross-platform GUI for FFmpeg, streamlining multimedia file processing with batch conversions and user-friendly features.", - "link": "https://github.com/jeanslack/Videomass", + "link": "https://jeanslack.github.io/Videomass/", "winget": "GianlucaPernigotto.Videomass" }, "WPFInstallvisualstudio": { @@ -6822,7 +6900,7 @@ $sync.configs.applications = '{ "choco": "wingetui", "content": "WingetUI", "description": "WingetUI is a graphical user interface for Microsoft''s Windows Package Manager (winget).", - "link": "https://github.com/marticliment/WingetUI", + "link": "https://www.marticliment.com/wingetui/", "winget": "SomePythonThings.WingetUIStore" }, "WPFInstallwinmerge": { @@ -6894,11 +6972,11 @@ $sync.configs.applications = '{ "choco": "xdm", "content": "Xtreme Download Manager", "description": "Xtreme Download Manager is an advanced download manager with support for various protocols and browsers.*Browser integration deprecated by google store. No official release.*", - "link": "https://github.com/subhra74/xdm", + "link": "https://xtremedownloadmanager.com/", "winget": "subhra74.XtremeDownloadManager" }, "WPFInstallxeheditor": { - "category": "Development", + "category": "Utilities", "choco": "HxD", "content": "HxD Hex Editor", "description": "HxD is a free hex editor that allows you to edit, view, search, and analyze binary files.", @@ -7004,7 +7082,7 @@ $sync.configs.applications = '{ "WPFInstallsyncthingtray": { "category": "Utilities", "choco": "syncthingtray", - "content": "syncthingtray", + "content": "Syncthingtray", "description": "Might be the alternative for Synctrayzor. Windows tray utility / filesystem watcher / launcher for Syncthing", "link": "https://github.com/Martchus/syncthingtray", "winget": "Martchus.syncthingtray" @@ -7028,7 +7106,7 @@ $sync.configs.applications = '{ "WPFInstallintelpresentmon": { "category": "Utilities", "choco": "na", - "content": "Intel?? PresentMon", + "content": "Intel-PresentMon", "description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.", "link": "https://game.intel.com/us/stories/intel-presentmon/", "winget": "Intel.PresentMon.Beta" @@ -7364,8 +7442,7 @@ $sync.configs.preset = '{ "WPFTweaksServices", "WPFTweaksStorage", "WPFTweaksTele", - "WPFTweaksWifi", - "WPFMiscTweaksPower" + "WPFTweaksWifi" ], "laptop": [ "WPFTweaksAH", @@ -9902,22 +9979,6 @@ $sync.configs.tweaks = '{ " ] }, - "WPFTweaksDisableUAC": { - "Content": "Disable UAC", - "Description": "Disables User Account Control. Only recommended for Expert Users.", - "category": "z__Advanced Tweaks - CAUTION", - "panel": "1", - "Order": "a023_", - "registry": [ - { - "Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", - "OriginalValue": "5", - "Name": "ConsentPromptBehaviorAdmin", - "Value": "0", - "Type": "DWord" - } - ] - }, "WPFTweaksDeleteTempFiles": { "Content": "Delete Temporary Files", "Description": "Erases TEMP Folders", @@ -10886,7 +10947,7 @@ $inputXML = ' - + @@ -11100,9 +11161,6 @@ $inputXML = ' - - -