mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 00:54:47 -05:00
Test 2024 01 12 (#1401)
* change logseq url and add .net 8 (#1385) * Update applications.json Add Official logseq url Add .net runtime 8.0 * compile with new logseq and .net 8 runtime * add thorium avx2 * Compile Winutil * Remove Cider Music Player (#1400) * Update winutil.ps1 * Update applications.json * Compile Winutil * Import/Export is now global, Settings menu added and many more improvements (#1398) * Anoter one of those huge PRs - Fix version inefficiency the version is already stored in sync, no need to slow down loading by one extra replace. - Created custom dialog and About message - Create a menu with Import/Export values - press on teh Settings cog in the right upper corner and save all the checkboxes - then you can either load them or load and run automatically - Made Import Export load accross the whole app - Optimized the way checkbox controls are looked up, it is 20% faster now - Added a switch to load all the boxes from a config file - example: .winutil.ps1 -Config "C:UsersasdfDesktop\111.json" - Added a switch to run all the action in unattended mode by passing -Run siwthc - example: .winutil.ps1 -Config "C:UsersasdfDesktop\111.json" -Run - This will run all the tweaks and install all the apps * Fixing a couple of bugs and blur fonts, also menu now closes when focus is lost --------- Co-authored-by: KonTy <KonTy@github.com> Co-authored-by: Chris Titus <contact@christitus.com> * Update applications.json * Compile Winutil * Add F8 Recovery Menu and Windows Reg Backup and others (#1389) * Update feature.json append F8 legacy startup and Win Reg Backup and web search suggestion in search app - enable automatic windows registry backup and do schedule for it as well (disabled by default in Win10, Win11) this will help when doing last known Good Configuration thru the F8 startup menu. - enable / disable legacy F8 startup recovery option. - enable / disable web search suggestions in the windows search in task bar. * new tick boxes features. F8 recovery, regbackup, search web suggestions - enable automatic windows registry backup and do schedule for it as well (disabled by default in Win10, Win11) this will help when doing last known Good Configuration thru the F8 startup menu. - enable / disable legacy F8 startup recovery option. - enable / disable web search suggestions in the windows search in task bar. * Compile Winutil * add Parsec to installable applications (#1157) (#1396) Identifiers: - Winget: Parsec.parsec - Chocolatey: parsec * Compile Winutil * add Konty to About page * Compile Winutil * fix description (#1388) (#1402) Co-authored-by: howell2024 <156375832+howell2024@users.noreply.github.com> --------- Co-authored-by: Cristian Negulescu <cristian@clamsen.com> Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com> Co-authored-by: Tommi Pöntinen <98650216+hamburgerghini1@users.noreply.github.com> Co-authored-by: KonTy <9524513+KonTy@users.noreply.github.com> Co-authored-by: KonTy <KonTy@github.com> Co-authored-by: Smartek <70715469+smartekIT@users.noreply.github.com> Co-authored-by: Saikrishnan K <53394202+K-Saikrishnan@users.noreply.github.com> Co-authored-by: howell2024 <156375832+howell2024@users.noreply.github.com>
This commit is contained in:
@ -24,10 +24,6 @@ function Invoke-WPFButton {
|
||||
"WPFdesktop" {Invoke-WPFPresets "Desktop"}
|
||||
"WPFlaptop" {Invoke-WPFPresets "laptop"}
|
||||
"WPFminimal" {Invoke-WPFPresets "minimal"}
|
||||
"WPFexport" {Invoke-WPFImpex -type "export" -CheckBox "WPFTweaks"}
|
||||
"WPFimport" {Invoke-WPFImpex -type "import" -CheckBox "WPFTweaks"}
|
||||
"WPFexportWinget" {Invoke-WPFImpex -type "export" -CheckBox "WPFInstall"}
|
||||
"WPFimportWinget" {Invoke-WPFImpex -type "import" -CheckBox "WPFInstall"}
|
||||
"WPFclear" {Invoke-WPFPresets -preset $null -imported $true}
|
||||
"WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "WPFInstall"}
|
||||
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
|
||||
|
@ -7,15 +7,15 @@ function Invoke-WPFFeatureInstall {
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running."
|
||||
$msg = "[Invoke-WPFFeatureInstall] Install process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
$Features = Get-WinUtilCheckBoxes -Group "WPFFeature"
|
||||
$Features = (Get-WinUtilCheckBoxes)["WPFFeatures"]
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Features -ScriptBlock {
|
||||
param($Features)
|
||||
Invoke-WPFRunspace -ArgumentList $Features,$DebugPreference -ScriptBlock {
|
||||
param($Features, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
@ -26,12 +26,5 @@ function Invoke-WPFFeatureInstall {
|
||||
Write-Host "--- Features are Installed ---"
|
||||
Write-Host "--- A Reboot may be required ---"
|
||||
Write-Host "==================================="
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "All features are now installed "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ function Invoke-WPFGetInstalled {
|
||||
param($checkbox)
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running."
|
||||
$msg = "[Invoke-WPFGetInstalled] Install process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
@ -23,8 +23,8 @@ function Invoke-WPFGetInstalled {
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox -ScriptBlock {
|
||||
param($checkbox)
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox,$DebugPreference -ScriptBlock {
|
||||
param($checkbox, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
|
@ -16,7 +16,7 @@ function Invoke-WPFImpex {
|
||||
#>
|
||||
param(
|
||||
$type,
|
||||
$checkbox
|
||||
$Config = $null
|
||||
)
|
||||
|
||||
if ($type -eq "export"){
|
||||
@ -26,20 +26,36 @@ function Invoke-WPFImpex {
|
||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
||||
}
|
||||
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
if (-not $Config){
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
if($FileBrowser.FileName -eq ""){
|
||||
return
|
||||
if($FileBrowser.FileName -eq ""){
|
||||
return
|
||||
}
|
||||
else{
|
||||
$Config = $FileBrowser.FileName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($type -eq "export"){
|
||||
$jsonFile = Get-WinUtilCheckBoxes $checkbox -unCheck $false
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
||||
}
|
||||
if ($type -eq "import"){
|
||||
$jsonFile = Get-Content $FileBrowser.FileName | ConvertFrom-Json
|
||||
Invoke-WPFPresets -preset $jsonFile -imported $true -CheckBox $checkbox
|
||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||
|
||||
$flattenedJson = @()
|
||||
$jsonFile.PSObject.Properties | ForEach-Object {
|
||||
$category = $_.Name
|
||||
foreach ($checkboxName in $_.Value) {
|
||||
if ($category -ne "Install") {
|
||||
$flattenedJson += $checkboxName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ function Invoke-WPFInstall {
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running."
|
||||
$msg = "[Invoke-WPFInstall] Install process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
$WingetInstall = Get-WinUtilCheckBoxes -Group "WPFInstall"
|
||||
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
|
||||
if ($wingetinstall.Count -eq 0) {
|
||||
$WarningMsg = "Please select the program(s) to install"
|
||||
@ -20,24 +20,15 @@ function Invoke-WPFInstall {
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $WingetInstall -scriptblock {
|
||||
param($WingetInstall)
|
||||
Invoke-WPFRunspace -ArgumentList $WingetInstall,$DebugPreference -ScriptBlock {
|
||||
param($WingetInstall, $DebugPreference)
|
||||
|
||||
try{
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
# Ensure winget is installed
|
||||
Install-WinUtilWinget
|
||||
|
||||
# Install all selected programs in new window
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Installs are Finished "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Installs have finished ---"
|
||||
Write-Host "==========================================="
|
||||
@ -47,6 +38,7 @@ function Invoke-WPFInstall {
|
||||
Write-Host "-- Winget failed to install ---"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
Start-Sleep -Seconds 5
|
||||
$sync.ProcessRunning = $False
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ function Invoke-WPFInstallUpgrade {
|
||||
}
|
||||
|
||||
if(Get-WinUtilInstallerProcess -Process $global:WinGetInstall){
|
||||
$msg = "Install process is currently running. Please check for a powershell window labeled 'Winget Install'"
|
||||
$msg = "[Invoke-WPFInstallUpgrade] Install process is currently running. Please check for a powershell window labeled 'Winget Install'"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ function Invoke-WPFPresets {
|
||||
|
||||
param(
|
||||
$preset,
|
||||
[bool]$imported = $false,
|
||||
$checkbox = "WPFTweaks"
|
||||
[bool]$imported = $false
|
||||
)
|
||||
|
||||
if($imported -eq $true){
|
||||
@ -28,23 +27,33 @@ function Invoke-WPFPresets {
|
||||
$CheckBoxesToCheck = $sync.configs.preset.$preset
|
||||
}
|
||||
|
||||
if($checkbox -eq "WPFTweaks"){
|
||||
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "*tweaks*"}
|
||||
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
|
||||
if ($CheckBoxesToCheck -contains $PSItem.name){
|
||||
$sync.$($PSItem.name).ischecked = $true
|
||||
}
|
||||
else{$sync.$($PSItem.name).ischecked = $false}
|
||||
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] }
|
||||
Write-Debug "Getting checkboxes to set $($CheckBoxes.Count)"
|
||||
|
||||
$CheckBoxesToCheck | ForEach-Object {
|
||||
if ($_ -ne $null) {
|
||||
Write-Debug $_
|
||||
}
|
||||
}
|
||||
if($checkbox -eq "WPFInstall"){
|
||||
|
||||
foreach ($CheckBox in $CheckBoxes) {
|
||||
$checkboxName = $CheckBox.Key
|
||||
|
||||
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPFInstall*"}
|
||||
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
|
||||
if($($sync.configs.applications.$($psitem.name).winget) -in $CheckBoxesToCheck){
|
||||
$sync.$($PSItem.name).ischecked = $true
|
||||
}
|
||||
else{$sync.$($PSItem.name).ischecked = $false}
|
||||
if (-not $CheckBoxesToCheck)
|
||||
{
|
||||
$sync.$checkboxName.IsChecked = $false
|
||||
continue
|
||||
}
|
||||
|
||||
# Check if the checkbox name exists in the flattened JSON hashtable
|
||||
if ($CheckBoxesToCheck.Contains($checkboxName)) {
|
||||
# If it exists, set IsChecked to true
|
||||
$sync.$checkboxName.IsChecked = $true
|
||||
Write-Debug "$checkboxName is checked"
|
||||
} else {
|
||||
# If it doesn't exist, set IsChecked to false
|
||||
$sync.$checkboxName.IsChecked = $false
|
||||
Write-Debug "$checkboxName is not checked"
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,8 @@ function Invoke-WPFRunspace {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
$ScriptBlock,
|
||||
$ArgumentList
|
||||
$ArgumentList,
|
||||
$DebugPreference
|
||||
)
|
||||
|
||||
# Create a PowerShell instance
|
||||
@ -30,6 +31,7 @@ function Invoke-WPFRunspace {
|
||||
# Add Scriptblock and Arguments to runspace
|
||||
$script:powershell.AddScript($ScriptBlock)
|
||||
$script:powershell.AddArgument($ArgumentList)
|
||||
$script:powershell.AddArgument($DebugPreference) # Pass DebugPreference to the script block
|
||||
$script:powershell.RunspacePool = $sync.runspace
|
||||
|
||||
# Execute the RunspacePool
|
||||
|
@ -13,19 +13,19 @@ function Invoke-WPFShortcut {
|
||||
|
||||
$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"
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
|
@ -7,12 +7,12 @@ function Invoke-WPFUnInstall {
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running"
|
||||
$msg = "[Invoke-WPFUnInstall] Install process is currently running"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
$WingetInstall = Get-WinUtilCheckBoxes -Group "WPFInstall"
|
||||
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
|
||||
if ($wingetinstall.Count -eq 0) {
|
||||
$WarningMsg = "Please select the program(s) to install"
|
||||
@ -29,8 +29,9 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
if($confirm -eq "No"){return}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $WingetInstall -scriptblock {
|
||||
param($WingetInstall)
|
||||
Invoke-WPFRunspace -ArgumentList $WingetInstall,$DebugPreference -ScriptBlock {
|
||||
param($WingetInstall, $DebugPreference)
|
||||
|
||||
try{
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
|
@ -7,13 +7,13 @@ function Invoke-WPFtweaksbutton {
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running."
|
||||
$msg = "[Invoke-WPFtweaksbutton] Install process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
$Tweaks = Get-WinUtilCheckBoxes -Group "WPFTweaks"
|
||||
|
||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||
|
||||
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
||||
|
||||
if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default"){
|
||||
@ -22,21 +22,20 @@ function Invoke-WPFtweaksbutton {
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -ScriptBlock {
|
||||
param($Tweaks)
|
||||
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $DebugPreference)
|
||||
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
# Executes first if selected
|
||||
if ("WPFEssTweaksRestorePoint" -in $Tweaks) {
|
||||
Invoke-WinUtilTweaks "WPFEssTweaksRestorePoint"
|
||||
}
|
||||
|
||||
$cnt = 0
|
||||
# Execute other selected tweaks
|
||||
foreach ($tweak in $tweaks) {
|
||||
if ($tweak -ne "WPFEssTweaksRestorePoint") {
|
||||
Invoke-WinUtilTweaks $tweak
|
||||
}
|
||||
foreach ($tweak in $Tweaks) {
|
||||
Write-Debug "This is a tweak to run $tweak count: $cnt"
|
||||
Invoke-WinUtilTweaks $tweak
|
||||
$cnt += 1
|
||||
}
|
||||
|
||||
$sync.ProcessRunning = $false
|
||||
@ -44,11 +43,10 @@ function Invoke-WPFtweaksbutton {
|
||||
Write-Host "-- Tweaks are Finished ---"
|
||||
Write-Host "================================="
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Tweaks are Finished "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
# $ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
# $MessageboxTitle = "Tweaks are Finished "
|
||||
# $Messageboxbody = ("Done")
|
||||
# $MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
# [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
}
|
||||
}
|
@ -7,12 +7,12 @@ function Invoke-WPFundoall {
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running."
|
||||
$msg = "[Invoke-WPFundoall] Install process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
$Tweaks = Get-WinUtilCheckBoxes -Group "WPFTweaks"
|
||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||
|
||||
if ($tweaks.count -eq 0){
|
||||
$msg = "Please check the tweaks you wish to undo."
|
||||
@ -20,8 +20,8 @@ function Invoke-WPFundoall {
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -ScriptBlock {
|
||||
param($Tweaks)
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks,$DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
|
Reference in New Issue
Block a user