mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-27 16:44:46 -05:00
Test 2024 04 20 2 (#2030)
* Several Additions to 'applications.json' File (#1865) * Add 'ditto' App to 'applications.json' File * Add 'rdcman' App to 'applications.json' File * Add 'mp3tag' App to 'applications.json' File * Add 'fan control' App to 'applications.json' File * Compile Winutil * Add 'betterbird' App to 'applications.json' File (#1876) * Compile Winutil * Added fnm to the install menu (#1879) * Compile Winutil * Update applications.json (#1883) * Compile Winutil * Simple improvement: make WinUtil's Shortcut Function Do Less (Lazier) (#1903) * Add Extra Comments to 'Invoke-WPFShortcut' to make the Logic a Bit Clearer * Make The 'Invoke-WPFShortcut' Function Lazier for Added Efficiency and to not Display False Info whenever the User Cancels the 'Save As' Operation * Compile Winutil * Update applications.jsonremove Whatsapp because it is not being maintained and is named "outdated" when installed * Update applications.json remove Whatsapp because it is not being maintained and is named "outdated" when installed * Compile Winutil * Add option to remove Microsoft Copilot AI * Add option to remove MS Copilot * Update tweaks.json * fix bugs - remove appx caused a lockup - also it looks like copilot will be the dependency for some built-in windows searches Due to this I am changing it from a removal to a disable. * Compile Winutil * remove authy authy reached EOLhttps://help.twilio.com/articles/22771146070299-User-guide-End-of-Life-EOL-for-Twilio-Authy-Desktop-app * remove authy authy reached EOL https://help.twilio.com/articles/22771146070299-User-guide-End-of-Life-EOL-for-Twilio-Authy-Desktop-app * Compile Winutil * Update applications.jsonWindhawkThe customization marketplace for Windows programshttps://www.youtube.com/watch?v=ijG0nXnO2gQ * Update applications.json Windhawk The customization marketplace for Windows programs https://www.youtube.com/watch?v=ijG0nXnO2gQ * add MSEdgeRedirect to applications.jsonperhaps a good "tweak" that could be added to Tweaks section down the road. project is foss... could be a good resource for someone with enough skills.in the meantime, does what it says it will, and does it well. * add MSEdgeRedirect to applications.json perhaps a good "tweak" that could be added to Tweaks section down the road. project is foss... could be a good resource for someone with enough skills. in the meantime, does what it says it will, and does it well. * Fix Winget Detection by doing Proper Error Handling using a Try-Catch * Fix Winget Detection by doing Proper Error Handling using a Try-Catch * Remove unnecessary Variable Initialization of 'wingetFullVersion' Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com> * Add Comments to be make The Logic a Lot More Clear to Follow and Understand * Add Another Catch Statement with some 'Write-Warning' for Extra Information * Remove StartAllBack + Adobe Debloater Tweak + Add Netbird * remove StartAllBack * Added Adobe Service Debloater Sets Adobe Services to manual for people that sadly need to work with their apps. * Add Netbird https://netbird.io * Compile Winutil * Update applications.json * Compile Winutil * Added ability to import drivers * Added ability to import drivers Added the ability to import drivers from the active installation to the MicroWin image. * Merge branch 'test-2024-04-20-2' into CW-MicroWin-240420 * Update inputXML.xaml Removed warning because of a fluke * Update Invoke-WPFMicrowin.ps1 Use the driver injection directory if it is specified and if the directory exists * Merge branch 'test-2024-04-20-2' into CW-MicroWin-240420 * Merge branch 'test-2024-04-20-2' into CW-MicroWin-240420 * Compile Winutil * Test 2024 04 20 2 | 7 additions to applications.json * 7 additions to applications.json Adds: NetLimiter - https://www.netlimiter.com OneCommander - https://www.onecommander.com Borderless Gaming - https://github.com/Codeusa/Borderless-Gaming Equalizer APO - https://sourceforge.net/projects/equalizerapo FreeFileSync - https://freefilesync.org Elgato Stream Deck - https://www.elgato.com/uk/en/s/downloads Stardock Curtains - https://www.stardock.com/products/curtains * Added Compact GUI support Link: https://github.com/IridiumIO/CompactGUI Since I wasn't sure what category to put it in, I chose Utilities. * Added ExifCleaner support Link: https://github.com/szTheory/exifcleaner * Removed trial ware additions Removed: Net Limiter One Commander Elgato: Stream Deck Stardock Curtains * Compile Winutil * add GlazeWM to applications.js (#1891) Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * Remove old Win7 game tweak * Compile Winutil * Test 1715290913 fix ugly ifs (#1957) * fix nested ifs * Compile Winutil * fix syntax * Compile Winutil * Add Spotify and Choco Fallback * Compile Winutil --------- Co-authored-by: ty802 <ty802@users.noreply.github.com> Co-authored-by: Chris Titus <contact@christitus.com> Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com> * Compile Winutil * Fix incorrect url for jellyfin-media-player (#1912) * Compile Winutil * Update name and description for Element (#1930) - Fixed the name and description for Element to reflect the name of the client, rather than the underlying technology-Matrix. * Compile Winutil * Optimize winget download speed (#1931) * Optimize Winget Download Speed * Add Downloading Message * Compile Winutil * Include OOSU Config in winutil.ps1 (#1932) * Compile Winutil * Only install choco if needed (#1943) * Compile Winutil * Install Choco if needed * Compile Winutil * Added ForceAutoHDR application to applications.json (#1951) * Added ForceAutoHDR application to applications.json Entry added on line 2642 * Update config/applications.json Yep my bad I though games related tools should be under "Games" Co-authored-by: Mr.k <mineshtine28546271@gmail.com> --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * Compile Winutil * add Godot Engine to applications.json (#1933) Added Godot Engine (https://godotengine.org/). Godot Engine is a free, open-source 2D and 3D game engine with a focus on usability and flexibility. * Compile Winutil * Add GitKraken Client (#1927) Adds development utility client for git repository management * Compile Winutil * Simplified Admin Check and Added Code Comments (#1938) - Simplified the admin check by filtering the "WindowsIdentity" class for owner value and comparing against admin value - Removed the need for an if admin check by moving its commands under the if not admin check. - Added code comments * Compile Winutil * Main window handle (#1941) Condition is comparing $proc.Id with [System.IntPtr]::Zero. The Id property is an integer, representing the process ID, and it's not directly related to window handles. Instead, you should compare the MainWindowHandle property against [System.IntPtr]::Zero * Compile Winutil * Add SMPlayer to `applications.json` (#1948) * Add SMPlayer to `applications.json` * Fix formatting --------- Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * Adobe Network Blocking / Adobe Debloater / Tweak Fixes & more (#1954) * Added Applications AFFiNE: Open source Notion alternative with selfhostable option for syncing. Wazuh Agent: Adgent for open-source security monitoring platform * Change layout of toggles Change the layout of the toggles to first show toggles and then the content (text). - testet, works * added snap related toggles - disable snapping entirely (requires relogin of windows user) - disable suggestion to snap other windows next to the snapped window -tested * Layouted Checkboxes, redesigned Toggles & renamed RDCMan - Removed text inside toggle as it can be confusing because it sais "enable" while enabled and "disable" if disabled. The coloring should be enough to know in what state that setting is. - without the text i could make it a little bit smaller while still letting it look good. - Renamed "Remote Desktop Connection Manager (RDCMan)" to "RDCMan" because that name is shorter and also mostly used by the linked site. - layouted checkboxes so they are not more left than the title and look tidy. - tested * Disable Acrobat auto-updates - added script & undoscript to disable automatic downloads & installation of acrobat reader. The user gets a notified if there is an update available. I put some info to that inside the code * edited AFFiNE description * Tweak Adobe Debloater -disable Adobe Desktop Service by getting ownership and renaming it. - added AGMService service - disable AGMService and AGSService entirely * Block Adobe Network, Debloat Adobe & Compile - fixes order of tweaks to always run "WPFTweaksRestorePoint" first. Before it was only the case because if was one of the first letter0s of the alphabet - Fixed some stuff at Debloat Adobe & added Adobe Reader update stopper & "deactivated" Adobe Desktop Service. - Added Blocking of Adobe Servers (as of your suggestion) to it's own Tweak. - ran compile for testing & showing * undo compilation * added Note to AcrobatUpdates Management in Tweak "Debloat Adobe" * Fix Right Click Method to use accurate names * fixed my mistake in README --------- Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * Install flow rework (#1961) * Install flow rework Sperated Winget and Chocolatey setps when installing software add skip them when not needed * fix uninstall --------- Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * Made disabling Fullscreen optimizations its own tweak (#1934) * Removed "GameDVR_DXGIHonorFSEWindowsCompatible" modification from "Disable GameDVR" tweak * Created advanced tweak "Disable fullscreen optimizations" Disables fullscreen optimizations in all applications. (Which can cause problems with Color Management in Exclusive Fullscreen) * Compile Winutil * fix glaze * Compile Winutil * Fix Typo in the App Entry 'GlazeWM' in 'applications.json' File (#1958) * Reorder Tweaks * Fix ordering of Advanced Tweaks * Compile Winutil * Preset Update * Organize Tweaks * Compile Winutil * Add the pixi package manager * Add the pixi package manager * Compile Winutil * Add Arc Browser to the application list. * Add Arc Browser to the application list. * Compile Winutil * Update applications.json - Added NDI toolsNDI, or Network Device Interface, is developed by Newtek. It enables the encoding, transmission, and reception of high-quality, low latency, video and audio over IP.https://ndi.video/Apologies if I'm not doing this right. I have zero experience using Github. * Update applications.json - Added NDI tools NDI, or Network Device Interface, is developed by Newtek. It enables the encoding, transmission, and reception of high-quality, low latency, video and audio over IP. https://ndi.video/ Apologies if I'm not doing this right. I have zero experience using Github. * Compile Winutil * docs: minor spellchecking * docs: minor spellchecking * Fix scratch textbox bug * Fix scratch textbox bug * Fixing Microwin, no more errors and it creats image now without issues * Compile Winutil * Tweaks page overhaul: * Toggle page overhaul: * Modern toggles + Tweak: Disable Copilot + Tweak: Set hibernation to default (fix issue https://github.com/ChrisTitusTech/winutil/issues/1399) * Merge branch 'test-2024-04-20-2' into TweaksToggles * Compile Winutil * Able to set the Default Terminal to Powershell 7 in Windows Terminal * Run winget in open powershell window if possible and handle update * add return code reference * Seperated Logic for PS7 Profile change * Add tweak * Revert changes to last commit in Christitus Repo * Merge pull request #1 from Marterich/PS7profile Split Logic in different Script, Re-Add files with to reflect Chris's Repo * Compile Winutil * Update tweaks.json * Compile Winutil * Update tweaks.json * Compile Winutil * disables to disable * Compile Winutil * Update applications.json - Files, ditto, spotube, sagethumbs added & file converter choco variable fixed (#1996) Added Files, ditto, spotube and sagethumbs. Fixed File Converted by Adrien Allard with proper Choco variable. "files">"file-conveter" "WPFInstallfileconverter": { "category": "Utilities", "choco": "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.io/", "winget": "AdrienAllard.FileConverter" * Compile Winutil * Winget install return code handling & Window management (#1992) * Run winget in open powershell window if possible and handle update * add return code reference * Compile Winutil * Fix typo (#1965) Co-authored-by: Chris Titus <contact@christitus.com> * Change voicemeeter URL to their newer site (#1967) * Compile Winutil * Change voicemeeter URL to newest site * Compile Winutil --------- Co-authored-by: Yuuh15 <Yuuh15@users.noreply.github.com> Co-authored-by: Chris Titus <contact@christitus.com> * Removed broken winget from applications.json (#1968) The winget does not work for vencord. The installer downloads and then fails. (#1515) * Compile Winutil * Optimize Display Behaviour of Category Labels (#1979) * Hide Category title if empty * Changed labels to a hashtable for faster access * Extract WPFNamecreation to function, fix hide all if none match * Compile Winutil * ps1 ext add * Update oosu10 config files and ad missing fileextension (#1980) Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * Fix fallback bug and merge choco uninstall rework (#1962) * Implement Uninstall Command for Chocolatey, and Made a Starting Point on the Automatic Upgrade when a Package is Already Installed, similar to WinGet Install Command * Add Extra Guards/Checks in 'Install-WinUtilProgramChoco' Private Function * Fix fallback bug and merge choco uninstall rework - fixed return from wrong return from winget install Install-WinUtilProgramWinget - syntax/wording cleenup in Install-WinUtilProgramWinget - fix bugs in ty802/winutil#1 after merge --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * Update applications.json (#1976) added qgis in right format Co-authored-by: Chris Titus <contact@christitus.com> * Compile Winutil * fix sagethumbs error * Compile Winutil --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com> Co-authored-by: Melloni <66322451+MelloniDev@users.noreply.github.com> Co-authored-by: Justawildwolf <62820836+blusewill@users.noreply.github.com> Co-authored-by: MyDrift <personal@mdiana.ch> Co-authored-by: ModernTTY <165050080+ModernTTY@users.noreply.github.com> Co-authored-by: Kasim <kasim@rafique.co.uk> Co-authored-by: trenton4k <trenton4k@gmail.com> Co-authored-by: Evan Galvin <evan.galvin@blissroms.org> Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com> Co-authored-by: misspent <78914154+misspent@users.noreply.github.com> Co-authored-by: Federico Pulcino <78621373+FedeP14@users.noreply.github.com> Co-authored-by: kian yamamoto <kiany@thatnameisnotavailable.com> Co-authored-by: ty802 <ty802@users.noreply.github.com> Co-authored-by: Callum Carmicheal <callumcarmicheal@gmail.com> Co-authored-by: Rux <jonathan.e.rux@ruxunderscore.com> Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com> Co-authored-by: Andrew <121936658+7gxycn08@users.noreply.github.com> Co-authored-by: Jelle <89023848+mrjbongo@users.noreply.github.com> Co-authored-by: Marc Brooks <IDisposable@gmail.com> Co-authored-by: Hayden Plumley <mrhaydendp@gmail.com> Co-authored-by: Berrick Werkman <105836264+BKlaasWerkman@users.noreply.github.com> Co-authored-by: o-iu <168581616+o-iu@users.noreply.github.com> Co-authored-by: Luadih <50816896+Luadih@users.noreply.github.com> Co-authored-by: Morten Enemark Lund <melund@gmail.com> Co-authored-by: Pleș Alexandru <34649178+plesalex100@users.noreply.github.com> Co-authored-by: tvrepairguy <170785918+tvrepairguy@users.noreply.github.com> Co-authored-by: LazyStability <Klysmus@online.de> Co-authored-by: KonTy <9524513+KonTy@users.noreply.github.com> Co-authored-by: drabspirit <39843622+drabspirit@users.noreply.github.com> Co-authored-by: Yuri Gabriel <97139700+Yuuh15@users.noreply.github.com> Co-authored-by: Yuuh15 <Yuuh15@users.noreply.github.com> Co-authored-by: Owen <78411938+Owen-3456@users.noreply.github.com> Co-authored-by: Snoep <128747388+SnoepNFTs@users.noreply.github.com>
This commit is contained in:
@ -77,7 +77,13 @@ function Get-TabXaml {
|
||||
$panelcount++
|
||||
}
|
||||
}
|
||||
$blockXml += "<Label Content=""$($category -replace '^.__', '')"" FontSize=""16""/>`n"
|
||||
|
||||
# Dot-source the Get-WPFObjectName function
|
||||
. .\functions\private\Get-WPFObjectName
|
||||
|
||||
$categorycontent = $($category -replace '^.__', '')
|
||||
$categoryname = Get-WPFObjectName -type "Label" -name $categorycontent
|
||||
$blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`n"
|
||||
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
|
||||
foreach ($appName in $sortedApps) {
|
||||
$count++
|
||||
@ -91,8 +97,8 @@ function Get-TabXaml {
|
||||
}
|
||||
$appInfo = $organizedData[$panel][$category][$appName]
|
||||
if ("Toggle" -eq $appInfo.Type) {
|
||||
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,10,0,0`">`n<Label Content=`"$($appInfo.Content)`" Style=`"{StaticResource labelfortweaks}`" ToolTip=`"$($appInfo.Description)`" />`n"
|
||||
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`"/>`n</StackPanel>`n"
|
||||
$blockXml += "<DockPanel LastChildFill=`"True`">`n<Label Content=`"$($appInfo.Content)`" ToolTip=`"$($appInfo.Description)`" HorizontalAlignment=`"Left`"/>`n"
|
||||
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`" HorizontalAlignment=`"Right`"/>`n</DockPanel>`n"
|
||||
} elseif ("Combobox" -eq $appInfo.Type) {
|
||||
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`n"
|
||||
$blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`n"
|
||||
|
27
functions/private/Get-WPFObjectName.ps1
Normal file
27
functions/private/Get-WPFObjectName.ps1
Normal file
@ -0,0 +1,27 @@
|
||||
function Get-WPFObjectName {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
This is a helper function that generates an objectname with the prefix WPF that can be used as a Powershell Variable after compilation.
|
||||
To achieve this, all characters that are not a-z, A-Z or 0-9 are simply removed from the name.
|
||||
.PARAMETER type
|
||||
The type of object for which the name should be generated. (e.g. Label, Button, CheckBox...)
|
||||
.PARAMETER name
|
||||
The name or description to be used for the object. (invalid characters are removed)
|
||||
.OUTPUTS
|
||||
A string that can be used as a object/variable name in powershell.
|
||||
For example: WPFLabelMicrosoftTools
|
||||
|
||||
.EXAMPLE
|
||||
Get-WPFObjectName -type Label -name "Microsoft Tools"
|
||||
#>
|
||||
|
||||
param( [Parameter(Mandatory=$true)]
|
||||
$type,
|
||||
$name
|
||||
)
|
||||
|
||||
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', ''
|
||||
|
||||
return $Output
|
||||
|
||||
}
|
@ -5,9 +5,6 @@ Function Get-WinUtilCheckBoxes {
|
||||
.SYNOPSIS
|
||||
Finds all checkboxes that are checked on the specific tab and inputs them into a script.
|
||||
|
||||
.PARAMETER Group
|
||||
The group of checkboxes to check
|
||||
|
||||
.PARAMETER unCheck
|
||||
Whether to uncheck the checkboxes that are checked. Defaults to true
|
||||
|
||||
@ -32,23 +29,33 @@ Function Get-WinUtilCheckBoxes {
|
||||
|
||||
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] }
|
||||
|
||||
# First check and add WPFTweaksRestorePoint if checked
|
||||
$RestorePoint = $CheckBoxes | Where-Object { $_.Key -eq 'WPFTweaksRestorePoint' -and $_.Value.IsChecked -eq $true }
|
||||
if ($RestorePoint) {
|
||||
$Output["WPFTweaks"] = @('WPFTweaksRestorePoint')
|
||||
Write-Debug "Adding WPFTweaksRestorePoint as first in WPFTweaks"
|
||||
|
||||
if ($unCheck) {
|
||||
$RestorePoint.Value.IsChecked = $false
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($CheckBox in $CheckBoxes) {
|
||||
if ($CheckBox.Key -eq 'WPFTweaksRestorePoint') { continue } # Skip since it's already handled
|
||||
|
||||
$group = if ($CheckBox.Key.StartsWith("WPFInstall")) { "Install" }
|
||||
elseif ($CheckBox.Key.StartsWith("WPFTweaks")) { "WPFTweaks" }
|
||||
elseif ($CheckBox.Key.StartsWith("WPFFeature")) { "WPFFeature" }
|
||||
|
||||
if ($group) {
|
||||
if ($CheckBox.Value.IsChecked -eq $true) {
|
||||
$feature = switch ($group) {
|
||||
"Install" {
|
||||
# Get the winget value
|
||||
$wingetValue = $sync.configs.applications.$($CheckBox.Name).winget
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace($wingetValue) -and $wingetValue -ne "na") {
|
||||
$wingetValue -split ";"
|
||||
} else {
|
||||
$sync.configs.applications.$($CheckBox.Name).choco
|
||||
[PsCustomObject]@{
|
||||
winget="$($sync.configs.applications.$($CheckBox.Name).winget)";
|
||||
choco="$($sync.configs.applications.$($CheckBox.Name).choco)";
|
||||
}
|
||||
|
||||
}
|
||||
default {
|
||||
$CheckBox.Name
|
||||
@ -66,12 +73,11 @@ Function Get-WinUtilCheckBoxes {
|
||||
Write-Debug "Adding: $($feature) under: $($group)"
|
||||
$Output[$group] += $feature
|
||||
|
||||
if ($uncheck -eq $true) {
|
||||
if ($unCheck) {
|
||||
$CheckBox.Value.IsChecked = $false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $Output
|
||||
}
|
||||
|
@ -59,6 +59,15 @@ Function Get-WinUtilToggleStatus {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapWindow"){
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||
if($hidesnap -eq 0){
|
||||
return $false
|
||||
}
|
||||
else{
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapFlyout"){
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||
if($hidesnap -eq 0){
|
||||
@ -68,6 +77,15 @@ Function Get-WinUtilToggleStatus {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapSuggestion"){
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||
if($hidesnap -eq 0){
|
||||
return $false
|
||||
}
|
||||
else{
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){
|
||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||
|
@ -5,14 +5,17 @@ function Get-WinUtilWingetLatest {
|
||||
.DESCRIPTION
|
||||
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
||||
#>
|
||||
|
||||
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
||||
$PreviousProgressPreference = $ProgressPreference
|
||||
$ProgressPreference = "silentlyContinue"
|
||||
Try{
|
||||
# Grabs the latest release of Winget from the Github API for the install process.
|
||||
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
||||
$latestVersion = $response.tag_name #Stores version number of latest release.
|
||||
$licenseWingetUrl = $response.assets.browser_download_url[0] #Index value for License file.
|
||||
$licenseWingetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*License1.xml"} #Index value for License file.
|
||||
Write-Host "Latest Version:`t$($latestVersion)`n"
|
||||
$assetUrl = $response.assets.browser_download_url[2] #Index value for download URL.
|
||||
Write-Host "Downloading..."
|
||||
$assetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"}
|
||||
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
||||
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
||||
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
||||
@ -20,4 +23,5 @@ function Get-WinUtilWingetLatest {
|
||||
Catch{
|
||||
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
||||
}
|
||||
$ProgressPreference = $PreviousProgressPreference
|
||||
}
|
||||
|
91
functions/private/Install-WinUtilProgramChoco.ps1
Normal file
91
functions/private/Install-WinUtilProgramChoco.ps1
Normal file
@ -0,0 +1,91 @@
|
||||
function Install-WinUtilProgramChoco {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Manages the provided programs using Chocolatey
|
||||
|
||||
.PARAMETER ProgramsToInstall
|
||||
A list of programs to manage
|
||||
|
||||
.PARAMETER manage
|
||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||
|
||||
.NOTES
|
||||
The triple quotes are required any time you need a " in a normal script block.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory, Position=0)]
|
||||
[PsCustomObject]$ProgramsToInstall,
|
||||
|
||||
[Parameter(Position=1)]
|
||||
[String]$manage = "Installing"
|
||||
)
|
||||
|
||||
$x = 0
|
||||
$count = $ProgramsToInstall.Count
|
||||
|
||||
# This check isn't really necessary, as there's a couple of checks before this Private Function gets called, but just to make sure ;)
|
||||
if($count -le 0) {
|
||||
throw "Private Function 'Install-WinUtilProgramChoco' expected Parameter 'ProgramsToInstall' to be of size 1 or greater, instead got $count,`nPlease double check your code and re-compile WinUtil."
|
||||
}
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Configuring Chocolatey pacakages ---"
|
||||
Write-Host "==========================================="
|
||||
Foreach ($Program in $ProgramsToInstall){
|
||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.choco) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
if($manage -eq "Installing"){
|
||||
write-host "Starting install of $($Program.choco) with Chocolatey."
|
||||
try{
|
||||
$tryUpgrade = $false
|
||||
$installOutputFilePath = "$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt"
|
||||
New-Item -ItemType File -Path $installOutputFilePath
|
||||
$chocoInstallStatus = $(Start-Process -FilePath "choco" -ArgumentList "install $($Program.choco) -y" -Wait -PassThru -RedirectStandardOutput $installOutputFilePath).ExitCode
|
||||
if(($chocoInstallStatus -eq 0) -AND (Test-Path -Path $installOutputFilePath)) {
|
||||
$keywordsFound = Get-Content -Path $installOutputFilePath | Where-Object {$_ -match "reinstall" -OR $_ -match "already installed"}
|
||||
if ($keywordsFound) {
|
||||
$tryUpgrade = $true
|
||||
}
|
||||
}
|
||||
# TODO: Implement the Upgrade part using 'choco upgrade' command, this will make choco consistent with WinGet, as WinGet tries to Upgrade when you use the install command.
|
||||
if ($tryUpgrade) {
|
||||
throw "Automatic Upgrade for Choco isn't implemented yet, a feature to make it consistent with WinGet, the install command using choco simply failed because $($Program.choco) is already installed."
|
||||
}
|
||||
if(($chocoInstallStatus -eq 0) -AND ($tryUpgrade -eq $false)){
|
||||
Write-Host "$($Program.choco) installed successfully using Chocolatey."
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to install $($Program.choco) using Chocolatey, Chocolatey output:`n`n$(Get-Content -Path $installOutputFilePath)."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to install $($Program.choco) due to an error: $_"
|
||||
}
|
||||
}
|
||||
|
||||
if($manage -eq "Uninstalling"){
|
||||
write-host "Starting uninstall of $($Program.choco) with Chocolatey."
|
||||
try{
|
||||
$uninstallOutputFilePath = "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt"
|
||||
New-Item -ItemType File -Path $uninstallOutputFilePath
|
||||
$chocoUninstallStatus = $(Start-Process -FilePath "choco" -ArgumentList "uninstall $($Program.choco) -y" -Wait -PassThru).ExitCode
|
||||
if($chocoUninstallStatus -eq 0){
|
||||
Write-Host "$($Program.choco) uninstalled successfully using Chocolatey."
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to uninstall $($Program.choco) using Chocolatey, Chocolatey output:`n`n$(Get-Content -Path $uninstallOutputFilePath)."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to uninstall $($Program.choco) due to an error: $_"
|
||||
}
|
||||
}
|
||||
$x++
|
||||
}
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
|
||||
# Cleanup leftovers files
|
||||
if(Test-Path -Path $installOutputFilePath){ Remove-Item -Path $installOutputFilePath }
|
||||
if(Test-Path -Path $installOutputFilePath){ Remove-Item -Path $uninstallOutputFilePath }
|
||||
|
||||
return;
|
||||
}
|
@ -1,75 +1,103 @@
|
||||
Function Install-WinUtilProgramWinget {
|
||||
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Manages the provided programs using Winget
|
||||
|
||||
Manages the provided programs using Winget
|
||||
|
||||
.PARAMETER ProgramsToInstall
|
||||
A list of programs to manage
|
||||
|
||||
A list of programs to manage
|
||||
|
||||
.PARAMETER manage
|
||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||
|
||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||
|
||||
.NOTES
|
||||
The triple quotes are required any time you need a " in a normal script block.
|
||||
The triple quotes are required any time you need a " in a normal script block.
|
||||
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
|
||||
#>
|
||||
|
||||
|
||||
param(
|
||||
$ProgramsToInstall,
|
||||
$manage = "Installing"
|
||||
[Parameter(Mandatory, Position=0)]
|
||||
[PsCustomObject]$ProgramsToInstall,
|
||||
|
||||
[Parameter(Position=1)]
|
||||
[String]$manage = "Installing"
|
||||
)
|
||||
|
||||
$x = 0
|
||||
$count = $($ProgramsToInstall -split ",").Count
|
||||
|
||||
$count = $ProgramsToInstall.Count
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||
|
||||
Foreach ($Program in $($ProgramsToInstall -split ",")){
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Configuring winget packages ---"
|
||||
Write-Host "==========================================="
|
||||
Foreach ($Program in $ProgramsToInstall){
|
||||
$failedPackages = @()
|
||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
if($manage -eq "Installing"){
|
||||
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
||||
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
||||
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
||||
# This is up to the individual package maintainers to enable these options. Aka. not as clean as Linux Package Managers.
|
||||
Write-Host "Starting install of $($Program.winget) with winget."
|
||||
try {
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $Program --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru).ExitCode
|
||||
if($status -ne 0){
|
||||
Write-Host "Attempt with User scope"
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $Program --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru).ExitCode
|
||||
if($status -ne 0){
|
||||
Write-Host "Attempt with Unelevated prompt"
|
||||
$status = $(Start-Process -FilePath "powershell" -ArgumentList "-Command Start-Process winget -ArgumentList 'install --id $Program --silent --accept-source-agreements --accept-package-agreements' -Verb runAsUser" -Wait -PassThru).ExitCode
|
||||
if($status -ne 0){
|
||||
Write-Host "Failed to install $Program."
|
||||
} else {
|
||||
Write-Host "$Program installed successfully with Unelevated prompt."
|
||||
}
|
||||
} else {
|
||||
Write-Host "$Program installed successfully with User scope."
|
||||
}
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if($status -eq 0){
|
||||
Write-Host "$($Program.winget) installed successfully."
|
||||
continue
|
||||
}
|
||||
if ($status -eq -1978335189){
|
||||
Write-Host "$($Program.winget) No applicable update found"
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with User scope"
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if($status -eq 0){
|
||||
Write-Host "$($Program.winget) installed successfully with User scope."
|
||||
continue
|
||||
}
|
||||
if ($status -eq -1978335189){
|
||||
Write-Host "$($Program.winget) No applicable update found"
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with User prompt"
|
||||
$userChoice = [System.Windows.MessageBox]::Show("Do you want to attempt $($Program.winget) installation with specific user credentials? Select 'Yes' to proceed or 'No' to skip.", "User Credential Prompt", [System.Windows.MessageBoxButton]::YesNo)
|
||||
if ($userChoice -eq 'Yes') {
|
||||
$getcreds = Get-Credential
|
||||
$process = Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Credential $getcreds -PassThru -NoNewWindow
|
||||
Wait-Process -Id $process.Id
|
||||
$status = $process.ExitCode
|
||||
} else {
|
||||
Write-Host "$Program installed successfully."
|
||||
Write-Host "Skipping installation with specific user credentials."
|
||||
}
|
||||
if($status -eq 0){
|
||||
Write-Host "$($Program.winget) installed successfully with User prompt."
|
||||
continue
|
||||
}
|
||||
if ($status -eq -1978335189){
|
||||
Write-Host "$($Program.winget) No applicable update found"
|
||||
continue
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to install $Program due to an error: $_"
|
||||
Write-Host "Failed to install $($Program.winget). With winget"
|
||||
$failedPackages += $Program
|
||||
}
|
||||
}
|
||||
if($manage -eq "Uninstalling"){
|
||||
# Uninstall package via ID using winget directly.
|
||||
try {
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $Program --silent" -Wait -PassThru).ExitCode
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if($status -ne 0){
|
||||
Write-Host "Failed to uninstall $Program."
|
||||
Write-Host "Failed to uninstall $($Program.winget)."
|
||||
} else {
|
||||
Write-Host "$Program uninstalled successfully."
|
||||
Write-Host "$($Program.winget) uninstalled successfully."
|
||||
$failedPackages += $Program
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to uninstall $Program due to an error: $_"
|
||||
Write-Host "Failed to uninstall $($Program.winget) due to an error: $_"
|
||||
$failedPackages += $Program
|
||||
}
|
||||
}
|
||||
$X++
|
||||
}
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
return $failedPackages;
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ function Install-WinUtilWinget {
|
||||
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 {
|
||||
# Install Choco if not already present
|
||||
Install-WinUtilChoco
|
||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli"
|
||||
Write-Host "Winget Installed" -ForegroundColor Green
|
||||
Write-Output "Refreshing Environment Variables...`n"
|
||||
|
34
functions/private/Invoke-WinUtilSnapSuggestion.ps1
Normal file
34
functions/private/Invoke-WinUtilSnapSuggestion.ps1
Normal file
@ -0,0 +1,34 @@
|
||||
function Invoke-WinUtilSnapSuggestion {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Snap Assist Suggestions on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Snap Assist Suggestions on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
Try{
|
||||
if ($Enabled -eq $false){
|
||||
Write-Host "Enabling Snap Assist Suggestion On startup"
|
||||
$value = 1
|
||||
}
|
||||
else {
|
||||
Write-Host "Disabling Snap Assist Suggestion On startup"
|
||||
$value = 0
|
||||
}
|
||||
# taskkill.exe /F /IM "explorer.exe"
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
taskkill.exe /F /IM "explorer.exe"
|
||||
Set-ItemProperty -Path $Path -Name SnapAssist -Value $value
|
||||
Start-Process "explorer.exe"
|
||||
}
|
||||
Catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
}
|
||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
31
functions/private/Invoke-WinUtilSnapWindow.ps1
Normal file
31
functions/private/Invoke-WinUtilSnapWindow.ps1
Normal file
@ -0,0 +1,31 @@
|
||||
function Invoke-WinUtilSnapWindow {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Snapping Windows on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Snapping Windows on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
Try{
|
||||
if ($Enabled -eq $false){
|
||||
Write-Host "Enabling Snap Windows On startup | Relogin Required"
|
||||
$value = 1
|
||||
}
|
||||
else {
|
||||
Write-Host "Disabling Snap Windows On startup | Relogin Required"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Control Panel\Desktop"
|
||||
Set-ItemProperty -Path $Path -Name WindowArrangementActive -Value $value
|
||||
}
|
||||
Catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
}
|
||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -20,13 +20,22 @@ function Test-WinUtilPackageManager {
|
||||
$status = "not-installed"
|
||||
|
||||
if ($winget) {
|
||||
# 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 Winget is available while getting it's Version if it's available
|
||||
$wingetExists = $true
|
||||
try {
|
||||
$wingetVersionFull = winget --version
|
||||
} catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] {
|
||||
Write-Warning "Winget was not found due to un-availablity 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 funtion 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")
|
||||
|
@ -21,9 +21,8 @@ function Invoke-WPFButton {
|
||||
"WPFinstall" {Invoke-WPFInstall}
|
||||
"WPFuninstall" {Invoke-WPFUnInstall}
|
||||
"WPFInstallUpgrade" {Invoke-WPFInstallUpgrade}
|
||||
"WPFdesktop" {Invoke-WPFPresets "Desktop"}
|
||||
"WPFlaptop" {Invoke-WPFPresets "laptop"}
|
||||
"WPFminimal" {Invoke-WPFPresets "minimal"}
|
||||
"WPFstandard" {Invoke-WPFPresets "Standard"}
|
||||
"WPFminimal" {Invoke-WPFPresets "Minimal"}
|
||||
"WPFclear" {Invoke-WPFPresets -preset $null -imported $true}
|
||||
"WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "WPFInstall"}
|
||||
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
|
||||
|
@ -7,7 +7,8 @@ function Invoke-WPFFixesWinget {
|
||||
.DESCRIPTION
|
||||
BravoNorris for the fantastic idea of a button to reinstall winget
|
||||
#>
|
||||
|
||||
# Install Choco if not already present
|
||||
Install-WinUtilChoco
|
||||
Start-Process -FilePath "choco" -ArgumentList "install winget -y --force" -NoNewWindow -Wait
|
||||
|
||||
}
|
@ -12,7 +12,7 @@ function Invoke-WPFGetIso {
|
||||
return
|
||||
}
|
||||
|
||||
$sync.BusyMessage.Visibility="Visible"
|
||||
$sync.BusyMessage.Visibility="Visible"
|
||||
$sync.BusyText.Text="N Busy"
|
||||
|
||||
|
||||
@ -23,10 +23,6 @@ function Invoke-WPFGetIso {
|
||||
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
|
||||
|
||||
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
|
||||
if( ! (Test-Path $oscdimgPath -PathType Leaf) ) {
|
||||
$oscdimgPath = Join-Path '.\releases\' 'oscdimg.exe'
|
||||
}
|
||||
|
||||
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
|
||||
Write-Host "oscdimg.exe on system: $oscdImgFound"
|
||||
|
||||
@ -41,6 +37,8 @@ function Invoke-WPFGetIso {
|
||||
# you consent to downloading it, no need to show extra dialogs
|
||||
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
|
||||
# the step below needs choco to download oscdimg
|
||||
# Install Choco if not already present
|
||||
Install-WinUtilChoco
|
||||
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
|
||||
Write-Host "choco on system: $chocoFound"
|
||||
if (!$chocoFound)
|
||||
|
@ -12,23 +12,43 @@ function Invoke-WPFInstall {
|
||||
return
|
||||
}
|
||||
|
||||
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
|
||||
if ($wingetinstall.Count -eq 0) {
|
||||
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
Write-Host $PackagesToInstall
|
||||
if ($PackagesToInstall.Count -eq 0) {
|
||||
$WarningMsg = "Please select the program(s) to install or upgrade"
|
||||
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $WingetInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($WingetInstall, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
foreach ($package in $PackagesToInstall) {
|
||||
if ($package.winget -eq "na") {
|
||||
$packagesChoco.add($package)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey install"
|
||||
} else {
|
||||
$packagesWinget.add($package)
|
||||
Write-Host "Queueing $($package.winget) for Winget install"
|
||||
}
|
||||
}
|
||||
return $packagesWinget, $packagesChoco
|
||||
}.Invoke($PackagesToInstall)
|
||||
|
||||
try{
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
Install-WinUtilWinget
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall
|
||||
|
||||
$errorPackages = @()
|
||||
if($packagesWinget.Count -gt 0){
|
||||
Install-WinUtilWinget
|
||||
$errorPackages += Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget
|
||||
$errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}}
|
||||
}
|
||||
if($packagesChoco.Count -gt 0){
|
||||
Install-WinUtilChoco
|
||||
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco
|
||||
}
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Installs have finished ---"
|
||||
Write-Host "==========================================="
|
||||
|
@ -53,6 +53,7 @@ public class PowerManagement {
|
||||
$keepEdge = $sync.WPFMicrowinKeepEdge.IsChecked
|
||||
$copyToUSB = $sync.WPFMicrowinCopyToUsb.IsChecked
|
||||
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
|
||||
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
|
||||
|
||||
$mountDir = $sync.MicrowinMountDir.Text
|
||||
$scratchDir = $sync.MicrowinScratchDir.Text
|
||||
@ -111,13 +112,54 @@ public class PowerManagement {
|
||||
return
|
||||
}
|
||||
|
||||
if ($importDrivers)
|
||||
{
|
||||
Write-Host "Exporting drivers from active installation..."
|
||||
if (Test-Path "$env:TEMP\DRV_EXPORT")
|
||||
{
|
||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||
}
|
||||
if (($injectDrivers -and (Test-Path $sync.MicrowinDriverLocation.Text)))
|
||||
{
|
||||
Write-Host "Using specified driver source..."
|
||||
dism /english /online /export-driver /destination="$($sync.MicrowinDriverLocation.Text)" | Out-Host
|
||||
if ($?)
|
||||
{
|
||||
# Don't add exported drivers yet, that is run later
|
||||
Write-Host "Drivers have been exported successfully."
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Failed to export drivers."
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
New-Item -Path "$env:TEMP\DRV_EXPORT" -ItemType Directory -Force
|
||||
dism /english /online /export-driver /destination="$env:TEMP\DRV_EXPORT" | Out-Host
|
||||
if ($?)
|
||||
{
|
||||
Write-Host "Adding exported drivers..."
|
||||
dism /english /image="$scratchDir" /add-driver /driver="$env:TEMP\DRV_EXPORT" /recurse | Out-Host
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Failed to export drivers. Continuing without importing them..."
|
||||
}
|
||||
if (Test-Path "$env:TEMP\DRV_EXPORT")
|
||||
{
|
||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($injectDrivers)
|
||||
{
|
||||
$driverPath = $sync.MicrowinDriverLocation.Text
|
||||
if (Test-Path $driverPath)
|
||||
{
|
||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||
Add-WindowsDriver -Path "$scratchDir" -Recurse -Driver "$driverPath"
|
||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -202,26 +244,27 @@ public class PowerManagement {
|
||||
$desktopDir = "$($scratchDir)\Windows\Users\Default\Desktop"
|
||||
New-Item -ItemType Directory -Force -Path "$desktopDir"
|
||||
dism /English /image:$($scratchDir) /set-profilepath:"$($scratchDir)\Windows\Users\Default"
|
||||
$command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'"
|
||||
$shortcutPath = "$desktopDir\WinUtil.lnk"
|
||||
$shell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
|
||||
if (Test-Path -Path "$env:TEMP\cttlogo.png")
|
||||
{
|
||||
$pngPath = "$env:TEMP\cttlogo.png"
|
||||
$icoPath = "$env:TEMP\cttlogo.ico"
|
||||
ConvertTo-Icon -bitmapPath $pngPath -iconPath $icoPath
|
||||
Write-Host "ICO file created at: $icoPath"
|
||||
Copy-Item "$env:TEMP\cttlogo.png" "$($scratchDir)\Windows\cttlogo.png" -force
|
||||
Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\Windows\cttlogo.ico" -force
|
||||
$shortcut.IconLocation = "c:\Windows\cttlogo.ico"
|
||||
}
|
||||
# $command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'"
|
||||
# $shortcutPath = "$desktopDir\WinUtil.lnk"
|
||||
# $shell = New-Object -ComObject WScript.Shell
|
||||
# $shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
|
||||
$shortcut.TargetPath = "powershell.exe"
|
||||
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
||||
$shortcut.Save()
|
||||
Write-Host "Shortcut to winutil created at: $shortcutPath"
|
||||
# if (Test-Path -Path "$env:TEMP\cttlogo.png")
|
||||
# {
|
||||
# $pngPath = "$env:TEMP\cttlogo.png"
|
||||
# $icoPath = "$env:TEMP\cttlogo.ico"
|
||||
# ConvertTo-Icon -bitmapPath $pngPath -iconPath $icoPath
|
||||
# Write-Host "ICO file created at: $icoPath"
|
||||
# Copy-Item "$env:TEMP\cttlogo.png" "$($scratchDir)\Windows\cttlogo.png" -force
|
||||
# Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\Windows\cttlogo.ico" -force
|
||||
# $shortcut.IconLocation = "c:\Windows\cttlogo.ico"
|
||||
# }
|
||||
|
||||
# $shortcut.TargetPath = "powershell.exe"
|
||||
# $shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
||||
# $shortcut.Save()
|
||||
# Write-Host "Shortcut to winutil created at: $shortcutPath"
|
||||
# *************************** Automation black ***************************
|
||||
|
||||
Write-Host "Copy checkinstall.cmd into the ISO"
|
||||
@ -335,7 +378,7 @@ public class PowerManagement {
|
||||
if (Test-Path $driverPath)
|
||||
{
|
||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||
Add-WindowsDriver -Path "$scratchDir" -Driver "$driverPath" -Recurse
|
||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,27 +17,35 @@ function Invoke-WPFShortcut {
|
||||
[bool]$RunAsAdmin = $false
|
||||
)
|
||||
|
||||
$iconPath = $null
|
||||
Switch ($ShortcutToAdd) {
|
||||
"WinUtil" {
|
||||
$SourceExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
|
||||
$IRM = 'irm https://christitus.com/win | iex'
|
||||
$Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList'
|
||||
$ArgumentsToSourceExe = "$powershell '$IRM'"
|
||||
$DestinationName = "WinUtil.lnk"
|
||||
# Preper the Shortcut Fields and add an a Custom Icon if it's available at "$env:TEMP\cttlogo.png", else don't add a Custom Icon.
|
||||
$iconPath = $null
|
||||
Switch ($ShortcutToAdd) {
|
||||
"WinUtil" {
|
||||
$SourceExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
|
||||
$IRM = 'irm https://christitus.com/win | iex'
|
||||
$Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList'
|
||||
$ArgumentsToSourceExe = "$powershell '$IRM'"
|
||||
$DestinationName = "WinUtil.lnk"
|
||||
|
||||
if (Test-Path -Path "$env:TEMP\cttlogo.png") {
|
||||
$iconPath = "$env:SystempRoot\cttlogo.ico"
|
||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
|
||||
}
|
||||
if (Test-Path -Path "$env:TEMP\cttlogo.png") {
|
||||
$iconPath = "$env:SystempRoot\cttlogo.ico"
|
||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk"
|
||||
$FileBrowser.FileName = $DestinationName
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
# Do an Early Return if The Save Shortcut operation was cancel by User's Input.
|
||||
$FileBrowserResult = $FileBrowser.ShowDialog()
|
||||
$DialogResultEnum = New-Object System.Windows.Forms.DialogResult
|
||||
if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) {
|
||||
return
|
||||
}
|
||||
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
||||
@ -56,4 +64,4 @@ function Invoke-WPFShortcut {
|
||||
}
|
||||
|
||||
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin"
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ function Invoke-WPFToggle {
|
||||
"WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)}
|
||||
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)}
|
||||
"WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)}
|
||||
"WPFToggleSnapWindow" {Invoke-WinUtilSnapWindow $(Get-WinUtilToggleStatus WPFToggleSnapWindow)}
|
||||
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
|
||||
"WPFToggleSnapSuggestion" {Invoke-WinUtilSnapSuggestion $(Get-WinUtilToggleStatus WPFToggleSnapSuggestion)}
|
||||
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
|
||||
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
|
||||
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
||||
|
46
functions/public/Invoke-WPFTweakPS7.ps1
Normal file
46
functions/public/Invoke-WPFTweakPS7.ps1
Normal file
@ -0,0 +1,46 @@
|
||||
function Invoke-WPFTweakPS7{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
This will edit the config file of the Windows Terminal Replacing the Powershell 5 to Powershell 7 and install Powershell 7 if necessary
|
||||
.PARAMETER action
|
||||
PS7: Configures Powershell 7 to be the default Terminal
|
||||
PS5: Configures Powershell 5 to be the default Terminal
|
||||
#>
|
||||
param (
|
||||
[ValidateSet("PS7", "PS5")]
|
||||
[string]$action
|
||||
)
|
||||
|
||||
switch ($action) {
|
||||
"PS7"{
|
||||
if (Test-Path -Path "$env:ProgramFiles\PowerShell\7") {
|
||||
Write-Host "Powershell 7 is already installed."
|
||||
} else {
|
||||
Write-Host "Installing Powershell 7..."
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall @(@{"winget"="Microsoft.PowerShell"})
|
||||
}
|
||||
$targetTerminalName = "PowerShell"
|
||||
}
|
||||
"PS5"{
|
||||
$targetTerminalName = "Windows PowerShell"
|
||||
}
|
||||
}
|
||||
|
||||
$settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
|
||||
if (Test-Path -Path $settingsPath) {
|
||||
Write-Host "Settings file found."
|
||||
$settingsContent = Get-Content -Path $settingsPath | ConvertFrom-Json
|
||||
$ps7Profile = $settingsContent.profiles.list | Where-Object { $_.name -eq $targetTerminalName }
|
||||
if ($ps7Profile) {
|
||||
$settingsContent.defaultProfile = $ps7Profile.guid
|
||||
$updatedSettings = $settingsContent | ConvertTo-Json -Depth 100
|
||||
Set-Content -Path $settingsPath -Value $updatedSettings
|
||||
Write-Host "Default profile updated to $targetTerminalName using the name attribute."
|
||||
} else {
|
||||
Write-Host "No PowerShell 7 profile found in Windows Terminal settings using the name attribute."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Settings file not found at $settingsPath"
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ function Invoke-WPFUnInstall {
|
||||
return
|
||||
}
|
||||
|
||||
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
|
||||
if ($wingetinstall.Count -eq 0) {
|
||||
if ($PackagesToInstall.Count -eq 0) {
|
||||
$WarningMsg = "Please select the program(s) to install"
|
||||
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
@ -22,21 +22,39 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::YesNo
|
||||
$MessageboxTitle = "Are you sure?"
|
||||
$Messageboxbody = ("This will uninstall the following applications: `n $WingetInstall")
|
||||
$Messageboxbody = ("This will uninstall the following applications: `n $($PackagesToInstall | Format-Table | Out-String)")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
$confirm = [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
if($confirm -eq "No"){return}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $WingetInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($WingetInstall, $DebugPreference)
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
foreach ($package in $PackagesToInstall) {
|
||||
if ($package.winget -eq "na") {
|
||||
$packagesChoco.add($package)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey Uninstall"
|
||||
} else {
|
||||
$packagesWinget.add($package)
|
||||
Write-Host "Queueing $($package.winget) for Winget Uninstall"
|
||||
}
|
||||
}
|
||||
return $packagesWinget, $packagesChoco
|
||||
}.Invoke($PackagesToInstall)
|
||||
try{
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
# Install all selected programs in new window
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall -Manage "Uninstalling"
|
||||
if($packagesWinget.Count -gt 0){
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget -Manage "Uninstalling"
|
||||
}
|
||||
if($packagesChoco.Count -gt 0){
|
||||
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling"
|
||||
}
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Uninstalls are Finished "
|
||||
@ -51,7 +69,7 @@ function Invoke-WPFUnInstall {
|
||||
}
|
||||
Catch {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Winget failed to install ---"
|
||||
Write-Host "Error: $_"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
$sync.ProcessRunning = $False
|
||||
|
Reference in New Issue
Block a user