This commit is contained in:
Chris Titus 2024-07-30 21:16:52 -05:00
commit 83bcf246f6
14 changed files with 552 additions and 612 deletions

View File

@ -8,6 +8,7 @@ permissions:
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: (github.event_name == 'schedule' && github.repository == 'ChrisTitusTech/winutil') || (github.event_name != 'schedule')
steps: steps:
- name: Checkout 🛎️ - name: Checkout 🛎️
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -205,7 +205,7 @@
"content": "Advanced Renamer", "content": "Advanced Renamer",
"description": "Advanced Renamer is a program for renaming multiple files and folders at once. By configuring renaming methods the names can be manipulated in various ways.", "description": "Advanced Renamer is a program for renaming multiple files and folders at once. By configuring renaming methods the names can be manipulated in various ways.",
"link": "https://www.advancedrenamer.com/", "link": "https://www.advancedrenamer.com/",
"winget": "XP9MD3S1KFCPH1" "winget": "HulubuluSoftware.AdvancedRenamer"
}, },
"calibre": { "calibre": {
"category": "Document", "category": "Document",

View File

@ -25,6 +25,10 @@
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"ProgressBarForegroundColor": "#FFAC1C",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#000000",
"ComboBoxBackgroundColor": "#FFFFFF", "ComboBoxBackgroundColor": "#FFFFFF",
"LabelboxForegroundColor": "#000000", "LabelboxForegroundColor": "#000000",
"MainForegroundColor": "#000000", "MainForegroundColor": "#000000",
@ -95,6 +99,10 @@
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"ProgressBarForegroundColor": "#222222",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#cccccc",
"ComboBoxBackgroundColor": "#000000", "ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58", "LabelboxForegroundColor": "#FFEE58",
"MainForegroundColor": "#9CCC65", "MainForegroundColor": "#9CCC65",
@ -163,6 +171,10 @@
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"ProgressBarForegroundColor": "#222222",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#FFFFFF",
"ComboBoxBackgroundColor": "#000000", "ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58", "LabelboxForegroundColor": "#FFEE58",
"MainForegroundColor": "#9CCC65", "MainForegroundColor": "#9CCC65",

View File

@ -1,116 +0,0 @@
Function Install-WinUtilProgramWinget {
<#
.SYNOPSIS
Manages the provided programs using Winget
.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.
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
#>
param(
[Parameter(Mandatory, Position=0)]
[PsCustomObject]$ProgramsToInstall,
[Parameter(Position=1)]
[String]$manage = "Installing"
)
$count = $ProgramsToInstall.Count
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
Write-Host "==========================================="
Write-Host "-- Configuring winget packages ---"
Write-Host "==========================================="
for ($i = 0; $i -lt $count; $i++) {
$Program = $ProgramsToInstall[$i]
$failedPackages = @()
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($i + 1) of $count" -PercentComplete $((($i + 1)/$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.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
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."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
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 "Skipping installation with specific user credentials."
}
if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully with User prompt."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
} catch {
Write-Host "Failed to install $($Program.winget). With winget"
$failedPackages += $Program
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
}
}
elseif($manage -eq "Uninstalling") {
# Uninstall package via ID using winget directly.
try {
$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.winget)."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
} else {
Write-Host "$($Program.winget) uninstalled successfully."
$failedPackages += $Program
}
} catch {
Write-Host "Failed to uninstall $($Program.winget) due to an error: $_"
$failedPackages += $Program
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
}
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
}
else {
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
}
}
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
return $failedPackages;
}

View File

@ -0,0 +1,171 @@
Function Invoke-WinUtilWingetProgram {
<#
.SYNOPSIS
Runs the designated action on the provided programs using Winget
.PARAMETER Programs
A list of programs to process
.PARAMETER action
The action to perform on the programs, can be either 'Install' or 'Uninstall'
.NOTES
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-actionr/winget/returnCodes.md
#>
param(
[Parameter(Mandatory, Position=0)]
$Programs,
[Parameter(Mandatory, Position=1)]
[ValidateSet("Install", "Uninstall")]
[String]$Action
)
Function Invoke-Winget {
<#
.SYNOPSIS
Invokes the winget.exe with the provided arguments and return the exit code
.PARAMETER wingetId
The Id of the Program that Winget should Install/Uninstall
.PARAMETER scope
Determines the installation mode. Can be "user" or "machine" (For more info look at the winget documentation)
.PARAMETER credential
The PSCredential Object of the user that should be used to run winget
.NOTES
Invoke Winget uses the public variable $Action defined outside the function to determine if a Program should be installed or removed
#>
param (
[string]$wingetId,
[string]$scope = "",
[PScredential]$credential = $null
)
$commonArguments = "--id $wingetId --silent"
$arguments = if ($Action -eq "Install"){
"install $commonArguments --accept-source-agreements --accept-package-agreements $(if ($scope) {" --scope $scope"})"
}
else {
"uninstall $commonArguments"
}
$processParams = @{
FilePath = "winget"
ArgumentList = $arguments
Wait = $true
PassThru = $true
NoNewWindow = $true
}
if ($credential) {
$processParams.credential = $credential
}
return (Start-Process @processParams).ExitCode
}
Function Invoke-Install {
<#
.SYNOPSIS
Contains the Install Logic and return code handling from winget
.PARAMETER Program
The Winget ID of the Program that should be installed
#>
param (
[string]$Program
)
$status = Invoke-Winget -wingetId $Program
if ($status -eq 0) {
Write-Host "$($Program) installed successfully."
return $true
} elseif ($status -eq -1978335189) {
Write-Host "$($Program) No applicable update found"
return $true
}
Write-Host "Attempt installation of $($Program) with User scope"
$status = Invoke-Winget -wingetId $Program -scope "user"
if ($status -eq 0) {
Write-Host "$($Program) installed successfully with User scope."
return $true
} elseif ($status -eq -1978335189) {
Write-Host "$($Program) No applicable update found"
return $true
}
$userChoice = [System.Windows.MessageBox]::Show("Do you want to attempt $($Program) 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
$status = Invoke-Winget -wingetId $Program -credential $getcreds
if ($status -eq 0) {
Write-Host "$($Program) installed successfully with User prompt."
return $true
}
} else {
Write-Host "Skipping installation with specific user credentials."
}
Write-Host "Failed to install $($Program)."
return $false
}
Function Invoke-Uninstall {
<#
.SYNOPSIS
Contains the Uninstall Logic and return code handling from winget
.PARAMETER Program
The Winget ID of the Program that should be uninstalled
#>
param (
[psobject]$Program
)
try {
$status = Invoke-Winget -wingetId $Program
if ($status -eq 0) {
Write-Host "$($Program) uninstalled successfully."
return $true
} else {
Write-Host "Failed to uninstall $($Program)."
return $false
}
} catch {
Write-Host "Failed to uninstall $($Program) due to an error: $_"
return $false
}
}
$count = $Programs.Count
$failedPackages = @()
Write-Host "==========================================="
Write-Host "-- Configuring winget packages ---"
Write-Host "==========================================="
for ($i = 0; $i -lt $count; $i++) {
$Program = $Programs[$i]
$result = $false
Set-WinUtilProgressBar -label "$Action $($Program)" -percent ($i / $count * 100)
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i / $count)})
$result = switch ($Action) {
"Install" {Invoke-Install -Program $Program}
"Uninstall" {Invoke-Uninstall -Program $Program}
default {throw "[Install-WinUtilProgramWinget] Invalid action: $Action"}
}
if (-not $result) {
$failedPackages += $Program
}
}
Set-WinUtilProgressBar -label "$($Action)ation done" -percent 100
return $failedPackages
}

View File

@ -0,0 +1,31 @@
function Set-WinUtilProgressbar{
<#
.SYNOPSIS
This function is used to Update the Progress Bar displayed in the winutil GUI.
It will be automatically hidden if the user clicks something and no process is running
.PARAMETER Label
The Text to be overlayed onto the Progress Bar
.PARAMETER PERCENT
The percentage of the Progress Bar that should be filled (0-100)
.PARAMETER Hide
If provided, the Progress Bar and the label will be hidden
#>
param(
[string]$Label,
[ValidateRange(0,100)]
[int]$Percent,
$Hide
)
if ($hide){
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Collapsed"})
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Collapsed"})
}
else{
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Visible"})
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Visible"})
}
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.Text = $label})
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.ToolTip = $label})
$sync.form.Dispatcher.Invoke([action]{ $sync.ProgressBar.Value = $percent})
}

View File

@ -14,9 +14,12 @@ function Invoke-WPFButton {
# Use this to get the name of the button # Use this to get the name of the button
#[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info") #[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info")
if (-not $sync.ProcessRunning){
Set-WinUtilProgressBar -label "" -percent 0 -hide $true
}
Switch -Wildcard ($Button){ Switch -Wildcard ($Button){
"WPFTab?BT" {Invoke-WPFTab $Button} "WPFTab?BT" {Invoke-WPFTab $Button}
"WPFinstall" {Invoke-WPFInstall} "WPFinstall" {Invoke-WPFInstall}
"WPFuninstall" {Invoke-WPFUnInstall} "WPFuninstall" {Invoke-WPFUnInstall}

View File

@ -29,14 +29,14 @@ function Invoke-WPFInstall {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
$packagesWinget, $packagesChoco = { $packagesWinget, $packagesChoco = {
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new() $packagesWinget = [System.Collections.ArrayList]::new()
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new() $packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
foreach ($package in $PackagesToInstall) { foreach ($package in $PackagesToInstall) {
if ($package.winget -eq "na") { if ($package.winget -eq "na") {
$packagesChoco.add($package) $packagesChoco.add($package)
Write-Host "Queueing $($package.choco) for Chocolatey install" Write-Host "Queueing $($package.choco) for Chocolatey install"
} else { } else {
$packagesWinget.add($package) $null = $packagesWinget.add($($package.winget))
Write-Host "Queueing $($package.winget) for Winget install" Write-Host "Queueing $($package.winget) for Winget install"
} }
} }
@ -48,7 +48,7 @@ function Invoke-WPFInstall {
$errorPackages = @() $errorPackages = @()
if($packagesWinget.Count -gt 0){ if($packagesWinget.Count -gt 0){
Install-WinUtilWinget Install-WinUtilWinget
$errorPackages += Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget $errorPackages += Invoke-WinUtilWingetProgram -Action Install -Programs $packagesWinget
$errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}} $errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}}
} }
if($packagesChoco.Count -gt 0){ if($packagesChoco.Count -gt 0){

View File

@ -17,7 +17,7 @@ function Invoke-WPFTweakPS7{
Write-Host "Powershell 7 is already installed." Write-Host "Powershell 7 is already installed."
} else { } else {
Write-Host "Installing Powershell 7..." Write-Host "Installing Powershell 7..."
Install-WinUtilProgramWinget -ProgramsToInstall @(@{"winget"="Microsoft.PowerShell"}) Invoke-WinUtilWingetProgram -Action Install -Programs @("Microsoft.PowerShell")
} }
$targetTerminalName = "PowerShell" $targetTerminalName = "PowerShell"
} }

View File

@ -45,7 +45,7 @@ function Invoke-WPFUnInstall {
$packagesChoco.add($package) $packagesChoco.add($package)
Write-Host "Queueing $($package.choco) for Chocolatey Uninstall" Write-Host "Queueing $($package.choco) for Chocolatey Uninstall"
} else { } else {
$packagesWinget.add($package) $packagesWinget.add($($package.winget))
Write-Host "Queueing $($package.winget) for Winget Uninstall" Write-Host "Queueing $($package.winget) for Winget Uninstall"
} }
} }
@ -56,14 +56,12 @@ function Invoke-WPFUnInstall {
# Install all selected programs in new window # Install all selected programs in new window
if($packagesWinget.Count -gt 0){ if($packagesWinget.Count -gt 0){
Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget -Manage "Uninstalling" Invoke-WinUtilWingetProgram -Action Uninstall -Programs $packagesWinget
} }
if($packagesChoco.Count -gt 0){ if($packagesChoco.Count -gt 0){
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling" Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling"
} }
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
Write-Host "===========================================" Write-Host "==========================================="
Write-Host "-- Uninstalls have finished ---" Write-Host "-- Uninstalls have finished ---"
Write-Host "===========================================" Write-Host "==========================================="

View File

@ -35,15 +35,14 @@ function Invoke-WPFtweaksbutton {
} else { } else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
$cnt = 0
# Execute other selected tweaks # Execute other selected tweaks
foreach ($tweak in $Tweaks) {
Write-Debug "This is a tweak to run $tweak count: $cnt" for ($i = 0; $i -lt $Tweaks.Count; $i++){
Invoke-WinUtilTweaks $tweak Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $Tweaks.Count * 100)
$cnt += 1 Invoke-WinUtilTweaks $tweaks[$i]
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($cnt/$Tweaks.Count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
} }
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
$sync.ProcessRunning = $false $sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
Write-Host "=================================" Write-Host "================================="

View File

@ -12,7 +12,7 @@ function Invoke-WPFundoall {
return return
} }
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"] $tweaks = (Get-WinUtilCheckBoxes)["WPFtweaks"]
if ($tweaks.count -eq 0){ if ($tweaks.count -eq 0){
$msg = "Please check the tweaks you wish to undo." $msg = "Please check the tweaks you wish to undo."
@ -20,186 +20,29 @@ function Invoke-WPFundoall {
return return
} }
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $tweaks -DebugPreference $DebugPreference -ScriptBlock {
param($Tweaks, $DebugPreference) param($tweaks, $DebugPreference)
$sync.ProcessRunning = $true $sync.ProcessRunning = $true
if ($Tweaks.count -eq 1){ if ($tweaks.count -eq 1){
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
} else { } else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
$cnt = 0
Foreach ($tweak in $tweaks){ for ($i = 0; $i -lt $tweaks.Count; $i++){
Invoke-WinUtilTweaks $tweak -undo $true Set-WinUtilProgressBar -Label "Undoing $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
$cnt += 1 Invoke-WinUtiltweaks $tweaks[$i] -undo $true
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($cnt/$Tweaks.Count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$tweaks.Count) })
} }
Set-WinUtilProgressBar -Label "Undo Tweaks Finished" -Percent 100
$sync.ProcessRunning = $false $sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
Write-Host "==================================" Write-Host "=================================="
Write-Host "--- Undo Tweaks are Finished ---" Write-Host "--- Undo Tweaks are Finished ---"
Write-Host "==================================" 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)
} }
<#
Write-Host "Creating Restore Point in case something bad happens"
Enable-ComputerRestore -Drive "$env:SystemDrive"
Checkpoint-Computer -Description "RestorePoint1" -RestorePointType "MODIFY_SETTINGS"
Write-Host "Enabling Telemetry..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 1
Write-Host "Enabling Wi-Fi Sense"
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1
Write-Host "Enabling Application suggestions..."
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "ContentDeliveryAllowed" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEverEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353698Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 1
If (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent") {
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 0
Write-Host "Enabling Activity History..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value 1
Write-Host "Enable Location Tracking..."
If (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location") {
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Type String -Value "Allow"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1
Write-Host "Enabling automatic Maps updates..."
Set-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 1
Write-Host "Enabling Feedback..."
If (Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules") {
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Type DWord -Value 0
Write-Host "Enabling Tailored Experiences..."
If (Test-Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent") {
Remove-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Type DWord -Value 0
Write-Host "Disabling Advertising ID..."
If (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo") {
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Type DWord -Value 0
Write-Host "Allow Error reporting..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Type DWord -Value 0
Write-Host "Allowing Diagnostics Tracking Service..."
Stop-Service "DiagTrack" -WarningAction SilentlyContinue
Set-Service "DiagTrack" -StartupType Manual
Write-Host "Allowing WAP Push Service..."
Stop-Service "dmwappushservice" -WarningAction SilentlyContinue
Set-Service "dmwappushservice" -StartupType Manual
Write-Host "Allowing Home Groups services..."
Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue
Set-Service "HomeGroupListener" -StartupType Manual
Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue
Set-Service "HomeGroupProvider" -StartupType Manual
Write-Host "Enabling Storage Sense..."
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" | Out-Null
Write-Host "Allowing Superfetch service..."
Stop-Service "SysMain" -WarningAction SilentlyContinue
Set-Service "SysMain" -StartupType Manual
Write-Host "Setting BIOS time to Local Time instead of UTC..."
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Type DWord -Value 0
Write-Host "Enabling Hibernation..."
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Session Manager\Power" -Name "HibernteEnabled" -Type Dword -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowHibernateOption" -Type Dword -Value 1
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -ErrorAction SilentlyContinue
Write-Host "Hiding file operations details..."
If (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager") {
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -Type DWord -Value 0
Write-Host "Showing Task View button..."
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Type DWord -Value 1
Write-Host "Changing default Explorer view to Quick Access..."
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 0
Write-Host "Unrestricting AutoLogger directory"
$autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null
Write-Host "Enabling and starting Diagnostics Tracking Service"
Set-Service "DiagTrack" -StartupType Automatic
Start-Service "DiagTrack"
Write-Host "Hiding known file extensions"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
Write-Host "Reset Local Group Policies to Stock Defaults"
# cmd /c secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose
cmd /c RD /S /Q "%WinDir%\System32\GroupPolicyUsers"
cmd /c RD /S /Q "%WinDir%\System32\GroupPolicy"
cmd /c gpupdate /force
# Considered using Invoke-GPUpdate but requires module most people won't have installed
Write-Host "Adjusting visual effects for appearance..."
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 400
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](158, 30, 7, 128, 18, 0, 0, 0))
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue
Write-Host "Restoring Clipboard History..."
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Clipboard" -Name "EnableClipboardHistory" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "AllowClipboardHistory" -ErrorAction SilentlyContinue
Write-Host "Enabling Notifications and Action Center"
Remove-Item -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled"
Write-Host "Restoring Default Right Click Menu Layout"
Remove-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" -Recurse -Confirm:$false -Force
Write-Host "Reset News and Interests"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type DWord -Value 1
# Remove "News and Interest" from taskbar
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds" -Name "ShellFeedsTaskbarViewMode" -Type DWord -Value 0
Write-Host "Done - Reverted to Stock Settings"
Write-Host "Essential Undo Completed"
$ButtonType = [System.Windows.MessageBoxButton]::OK
$MessageboxTitle = "Undo All"
$Messageboxbody = ("Done")
$MessageIcon = [System.Windows.MessageBoxImage]::Information
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
Write-Host "================================="
Write-Host "--- Undo All is Finished ---"
Write-Host "================================="
#>
} }

View File

@ -997,122 +997,6 @@ function Install-WinUtilProgramChoco {
return; return;
} }
Function Install-WinUtilProgramWinget {
<#
.SYNOPSIS
Manages the provided programs using Winget
.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.
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
#>
param(
[Parameter(Mandatory, Position=0)]
[PsCustomObject]$ProgramsToInstall,
[Parameter(Position=1)]
[String]$manage = "Installing"
)
$count = $ProgramsToInstall.Count
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
Write-Host "==========================================="
Write-Host "-- Configuring winget packages ---"
Write-Host "==========================================="
for ($i = 0; $i -lt $count; $i++) {
$Program = $ProgramsToInstall[$i]
$failedPackages = @()
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($i + 1) of $count" -PercentComplete $((($i + 1)/$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.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
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."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
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 "Skipping installation with specific user credentials."
}
if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully with User prompt."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue
}
} catch {
Write-Host "Failed to install $($Program.winget). With winget"
$failedPackages += $Program
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
}
}
elseif($manage -eq "Uninstalling") {
# Uninstall package via ID using winget directly.
try {
$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.winget)."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
} else {
Write-Host "$($Program.winget) uninstalled successfully."
$failedPackages += $Program
}
} catch {
Write-Host "Failed to uninstall $($Program.winget) due to an error: $_"
$failedPackages += $Program
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
}
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
}
else {
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
}
}
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
return $failedPackages;
}
function Install-WinUtilWinget { function Install-WinUtilWinget {
<# <#
@ -2765,6 +2649,177 @@ function Invoke-WinUtilVerboseLogon {
Write-Warning $psitem.Exception.StackTrace Write-Warning $psitem.Exception.StackTrace
} }
} }
Function Invoke-WinUtilWingetProgram {
<#
.SYNOPSIS
Runs the designated action on the provided programs using Winget
.PARAMETER Programs
A list of programs to process
.PARAMETER action
The action to perform on the programs, can be either 'Install' or 'Uninstall'
.NOTES
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-actionr/winget/returnCodes.md
#>
param(
[Parameter(Mandatory, Position=0)]
$Programs,
[Parameter(Mandatory, Position=1)]
[ValidateSet("Install", "Uninstall")]
[String]$Action
)
Function Invoke-Winget {
<#
.SYNOPSIS
Invokes the winget.exe with the provided arguments and return the exit code
.PARAMETER wingetId
The Id of the Program that Winget should Install/Uninstall
.PARAMETER scope
Determines the installation mode. Can be "user" or "machine" (For more info look at the winget documentation)
.PARAMETER credential
The PSCredential Object of the user that should be used to run winget
.NOTES
Invoke Winget uses the public variable $Action defined outside the function to determine if a Program should be installed or removed
#>
param (
[string]$wingetId,
[string]$scope = "",
[PScredential]$credential = $null
)
$commonArguments = "--id $wingetId --silent"
$arguments = if ($Action -eq "Install"){
"install $commonArguments --accept-source-agreements --accept-package-agreements $(if ($scope) {" --scope $scope"})"
}
else {
"uninstall $commonArguments"
}
$processParams = @{
FilePath = "winget"
ArgumentList = $arguments
Wait = $true
PassThru = $true
NoNewWindow = $true
}
if ($credential) {
$processParams.credential = $credential
}
return (Start-Process @processParams).ExitCode
}
Function Invoke-Install {
<#
.SYNOPSIS
Contains the Install Logic and return code handling from winget
.PARAMETER Program
The Winget ID of the Program that should be installed
#>
param (
[string]$Program
)
$status = Invoke-Winget -wingetId $Program
if ($status -eq 0) {
Write-Host "$($Program) installed successfully."
return $true
} elseif ($status -eq -1978335189) {
Write-Host "$($Program) No applicable update found"
return $true
}
Write-Host "Attempt installation of $($Program) with User scope"
$status = Invoke-Winget -wingetId $Program -scope "user"
if ($status -eq 0) {
Write-Host "$($Program) installed successfully with User scope."
return $true
} elseif ($status -eq -1978335189) {
Write-Host "$($Program) No applicable update found"
return $true
}
$userChoice = [System.Windows.MessageBox]::Show("Do you want to attempt $($Program) 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
$status = Invoke-Winget -wingetId $Program -credential $getcreds
if ($status -eq 0) {
Write-Host "$($Program) installed successfully with User prompt."
return $true
}
} else {
Write-Host "Skipping installation with specific user credentials."
}
Write-Host "Failed to install $($Program)."
return $false
}
Function Invoke-Uninstall {
<#
.SYNOPSIS
Contains the Uninstall Logic and return code handling from winget
.PARAMETER Program
The Winget ID of the Program that should be uninstalled
#>
param (
[psobject]$Program
)
try {
$status = Invoke-Winget -wingetId $Program
if ($status -eq 0) {
Write-Host "$($Program) uninstalled successfully."
return $true
} else {
Write-Host "Failed to uninstall $($Program)."
return $false
}
} catch {
Write-Host "Failed to uninstall $($Program) due to an error: $_"
return $false
}
}
$count = $Programs.Count
$failedPackages = @()
Write-Host "==========================================="
Write-Host "-- Configuring winget packages ---"
Write-Host "==========================================="
for ($i = 0; $i -lt $count; $i++) {
$Program = $Programs[$i]
$result = $false
Set-WinUtilProgressBar -label "$Action $($Program)" -percent ($i / $count * 100)
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i / $count)})
$result = switch ($Action) {
"Install" {Invoke-Install -Program $Program}
"Uninstall" {Invoke-Uninstall -Program $Program}
default {throw "[Install-WinUtilProgramWinget] Invalid action: $Action"}
}
if (-not $result) {
$failedPackages += $Program
}
}
Set-WinUtilProgressBar -label "$($Action)ation done" -percent 100
return $failedPackages
}
function Remove-WinUtilAPPX { function Remove-WinUtilAPPX {
<# <#
@ -2836,6 +2891,37 @@ function Set-WinUtilDNS {
Write-Warning $psitem.Exception.StackTrace Write-Warning $psitem.Exception.StackTrace
} }
} }
function Set-WinUtilProgressbar{
<#
.SYNOPSIS
This function is used to Update the Progress Bar displayed in the winutil GUI.
It will be automatically hidden if the user clicks something and no process is running
.PARAMETER Label
The Text to be overlayed onto the Progress Bar
.PARAMETER PERCENT
The percentage of the Progress Bar that should be filled (0-100)
.PARAMETER Hide
If provided, the Progress Bar and the label will be hidden
#>
param(
[string]$Label,
[ValidateRange(0,100)]
[int]$Percent,
$Hide
)
if ($hide){
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Collapsed"})
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Collapsed"})
}
else{
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Visible"})
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Visible"})
}
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.Text = $label})
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.ToolTip = $label})
$sync.form.Dispatcher.Invoke([action]{ $sync.ProgressBar.Value = $percent})
}
function Set-WinUtilRegistry { function Set-WinUtilRegistry {
<# <#
@ -3568,9 +3654,12 @@ function Invoke-WPFButton {
# Use this to get the name of the button # Use this to get the name of the button
#[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info") #[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info")
if (-not $sync.ProcessRunning){
Set-WinUtilProgressBar -label "" -percent 0 -hide $true
}
Switch -Wildcard ($Button){ Switch -Wildcard ($Button){
"WPFTab?BT" {Invoke-WPFTab $Button} "WPFTab?BT" {Invoke-WPFTab $Button}
"WPFinstall" {Invoke-WPFInstall} "WPFinstall" {Invoke-WPFInstall}
"WPFuninstall" {Invoke-WPFUnInstall} "WPFuninstall" {Invoke-WPFUnInstall}
@ -4442,14 +4531,14 @@ function Invoke-WPFInstall {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
$packagesWinget, $packagesChoco = { $packagesWinget, $packagesChoco = {
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new() $packagesWinget = [System.Collections.ArrayList]::new()
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new() $packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
foreach ($package in $PackagesToInstall) { foreach ($package in $PackagesToInstall) {
if ($package.winget -eq "na") { if ($package.winget -eq "na") {
$packagesChoco.add($package) $packagesChoco.add($package)
Write-Host "Queueing $($package.choco) for Chocolatey install" Write-Host "Queueing $($package.choco) for Chocolatey install"
} else { } else {
$packagesWinget.add($package) $null = $packagesWinget.add($($package.winget))
Write-Host "Queueing $($package.winget) for Winget install" Write-Host "Queueing $($package.winget) for Winget install"
} }
} }
@ -4461,7 +4550,7 @@ function Invoke-WPFInstall {
$errorPackages = @() $errorPackages = @()
if($packagesWinget.Count -gt 0){ if($packagesWinget.Count -gt 0){
Install-WinUtilWinget Install-WinUtilWinget
$errorPackages += Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget $errorPackages += Invoke-WinUtilWingetProgram -Action Install -Programs $packagesWinget
$errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}} $errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}}
} }
if($packagesChoco.Count -gt 0){ if($packagesChoco.Count -gt 0){
@ -5378,7 +5467,7 @@ function Invoke-WPFTweakPS7{
Write-Host "Powershell 7 is already installed." Write-Host "Powershell 7 is already installed."
} else { } else {
Write-Host "Installing Powershell 7..." Write-Host "Installing Powershell 7..."
Install-WinUtilProgramWinget -ProgramsToInstall @(@{"winget"="Microsoft.PowerShell"}) Invoke-WinUtilWingetProgram -Action Install -Programs @("Microsoft.PowerShell")
} }
$targetTerminalName = "PowerShell" $targetTerminalName = "PowerShell"
} }
@ -5449,15 +5538,14 @@ function Invoke-WPFtweaksbutton {
} else { } else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
$cnt = 0
# Execute other selected tweaks # Execute other selected tweaks
foreach ($tweak in $Tweaks) {
Write-Debug "This is a tweak to run $tweak count: $cnt" for ($i = 0; $i -lt $Tweaks.Count; $i++){
Invoke-WinUtilTweaks $tweak Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $Tweaks.Count * 100)
$cnt += 1 Invoke-WinUtilTweaks $tweaks[$i]
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($cnt/$Tweaks.Count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
} }
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
$sync.ProcessRunning = $false $sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
Write-Host "=================================" Write-Host "================================="
@ -5538,7 +5626,7 @@ function Invoke-WPFundoall {
return return
} }
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"] $tweaks = (Get-WinUtilCheckBoxes)["WPFtweaks"]
if ($tweaks.count -eq 0){ if ($tweaks.count -eq 0){
$msg = "Please check the tweaks you wish to undo." $msg = "Please check the tweaks you wish to undo."
@ -5546,188 +5634,31 @@ function Invoke-WPFundoall {
return return
} }
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $tweaks -DebugPreference $DebugPreference -ScriptBlock {
param($Tweaks, $DebugPreference) param($tweaks, $DebugPreference)
$sync.ProcessRunning = $true $sync.ProcessRunning = $true
if ($Tweaks.count -eq 1){ if ($tweaks.count -eq 1){
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
} else { } else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
$cnt = 0
Foreach ($tweak in $tweaks){ for ($i = 0; $i -lt $tweaks.Count; $i++){
Invoke-WinUtilTweaks $tweak -undo $true Set-WinUtilProgressBar -Label "Undoing $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
$cnt += 1 Invoke-WinUtiltweaks $tweaks[$i] -undo $true
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($cnt/$Tweaks.Count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$tweaks.Count) })
} }
Set-WinUtilProgressBar -Label "Undo Tweaks Finished" -Percent 100
$sync.ProcessRunning = $false $sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
Write-Host "==================================" Write-Host "=================================="
Write-Host "--- Undo Tweaks are Finished ---" Write-Host "--- Undo Tweaks are Finished ---"
Write-Host "==================================" 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)
} }
<#
Write-Host "Creating Restore Point in case something bad happens"
Enable-ComputerRestore -Drive "$env:SystemDrive"
Checkpoint-Computer -Description "RestorePoint1" -RestorePointType "MODIFY_SETTINGS"
Write-Host "Enabling Telemetry..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 1
Write-Host "Enabling Wi-Fi Sense"
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1
Write-Host "Enabling Application suggestions..."
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "ContentDeliveryAllowed" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEverEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353698Enabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 1
If (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent") {
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 0
Write-Host "Enabling Activity History..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value 1
Write-Host "Enable Location Tracking..."
If (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location") {
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Type String -Value "Allow"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1
Write-Host "Enabling automatic Maps updates..."
Set-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 1
Write-Host "Enabling Feedback..."
If (Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules") {
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Type DWord -Value 0
Write-Host "Enabling Tailored Experiences..."
If (Test-Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent") {
Remove-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Type DWord -Value 0
Write-Host "Disabling Advertising ID..."
If (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo") {
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Type DWord -Value 0
Write-Host "Allow Error reporting..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Type DWord -Value 0
Write-Host "Allowing Diagnostics Tracking Service..."
Stop-Service "DiagTrack" -WarningAction SilentlyContinue
Set-Service "DiagTrack" -StartupType Manual
Write-Host "Allowing WAP Push Service..."
Stop-Service "dmwappushservice" -WarningAction SilentlyContinue
Set-Service "dmwappushservice" -StartupType Manual
Write-Host "Allowing Home Groups services..."
Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue
Set-Service "HomeGroupListener" -StartupType Manual
Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue
Set-Service "HomeGroupProvider" -StartupType Manual
Write-Host "Enabling Storage Sense..."
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" | Out-Null
Write-Host "Allowing Superfetch service..."
Stop-Service "SysMain" -WarningAction SilentlyContinue
Set-Service "SysMain" -StartupType Manual
Write-Host "Setting BIOS time to Local Time instead of UTC..."
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Type DWord -Value 0
Write-Host "Enabling Hibernation..."
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Session Manager\Power" -Name "HibernteEnabled" -Type Dword -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowHibernateOption" -Type Dword -Value 1
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -ErrorAction SilentlyContinue
Write-Host "Hiding file operations details..."
If (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager") {
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Recurse -ErrorAction SilentlyContinue
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -Type DWord -Value 0
Write-Host "Showing Task View button..."
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Type DWord -Value 1
Write-Host "Changing default Explorer view to Quick Access..."
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 0
Write-Host "Unrestricting AutoLogger directory"
$autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null
Write-Host "Enabling and starting Diagnostics Tracking Service"
Set-Service "DiagTrack" -StartupType Automatic
Start-Service "DiagTrack"
Write-Host "Hiding known file extensions"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
Write-Host "Reset Local Group Policies to Stock Defaults"
# cmd /c secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose
cmd /c RD /S /Q "%WinDir%\System32\GroupPolicyUsers"
cmd /c RD /S /Q "%WinDir%\System32\GroupPolicy"
cmd /c gpupdate /force
# Considered using Invoke-GPUpdate but requires module most people won't have installed
Write-Host "Adjusting visual effects for appearance..."
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 400
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](158, 30, 7, 128, 18, 0, 0, 0))
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue
Write-Host "Restoring Clipboard History..."
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Clipboard" -Name "EnableClipboardHistory" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "AllowClipboardHistory" -ErrorAction SilentlyContinue
Write-Host "Enabling Notifications and Action Center"
Remove-Item -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled"
Write-Host "Restoring Default Right Click Menu Layout"
Remove-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" -Recurse -Confirm:$false -Force
Write-Host "Reset News and Interests"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type DWord -Value 1
# Remove "News and Interest" from taskbar
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds" -Name "ShellFeedsTaskbarViewMode" -Type DWord -Value 0
Write-Host "Done - Reverted to Stock Settings"
Write-Host "Essential Undo Completed"
$ButtonType = [System.Windows.MessageBoxButton]::OK
$MessageboxTitle = "Undo All"
$Messageboxbody = ("Done")
$MessageIcon = [System.Windows.MessageBoxImage]::Information
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
Write-Host "================================="
Write-Host "--- Undo All is Finished ---"
Write-Host "================================="
#>
} }
function Invoke-WPFUnInstall { function Invoke-WPFUnInstall {
<# <#
@ -5776,7 +5707,7 @@ function Invoke-WPFUnInstall {
$packagesChoco.add($package) $packagesChoco.add($package)
Write-Host "Queueing $($package.choco) for Chocolatey Uninstall" Write-Host "Queueing $($package.choco) for Chocolatey Uninstall"
} else { } else {
$packagesWinget.add($package) $packagesWinget.add($($package.winget))
Write-Host "Queueing $($package.winget) for Winget Uninstall" Write-Host "Queueing $($package.winget) for Winget Uninstall"
} }
} }
@ -5787,14 +5718,12 @@ function Invoke-WPFUnInstall {
# Install all selected programs in new window # Install all selected programs in new window
if($packagesWinget.Count -gt 0){ if($packagesWinget.Count -gt 0){
Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget -Manage "Uninstalling" Invoke-WinUtilWingetProgram -Action Uninstall -Programs $packagesWinget
} }
if($packagesChoco.Count -gt 0){ if($packagesChoco.Count -gt 0){
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling" Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling"
} }
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
Write-Host "===========================================" Write-Host "==========================================="
Write-Host "-- Uninstalls have finished ---" Write-Host "-- Uninstalls have finished ---"
Write-Host "===========================================" Write-Host "==========================================="
@ -6150,7 +6079,7 @@ $sync.configs.applications = '{
"content": "Advanced Renamer", "content": "Advanced Renamer",
"description": "Advanced Renamer is a program for renaming multiple files and folders at once. By configuring renaming methods the names can be manipulated in various ways.", "description": "Advanced Renamer is a program for renaming multiple files and folders at once. By configuring renaming methods the names can be manipulated in various ways.",
"link": "https://www.advancedrenamer.com/", "link": "https://www.advancedrenamer.com/",
"winget": "XP9MD3S1KFCPH1" "winget": "HulubuluSoftware.AdvancedRenamer"
}, },
"WPFInstallcalibre": { "WPFInstallcalibre": {
"category": "Document", "category": "Document",
@ -9271,6 +9200,9 @@ $sync.configs.themes = '{
"WinUtilIconSize": "Auto", "WinUtilIconSize": "Auto",
"SettingsIconFontSize": "18", "SettingsIconFontSize": "18",
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"ProgressBarForegroundColor": "#FFAC1C",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#000000",
"ComboBoxBackgroundColor": "#FFFFFF", "ComboBoxBackgroundColor": "#FFFFFF",
"LabelboxForegroundColor": "#000000", "LabelboxForegroundColor": "#000000",
"MainForegroundColor": "#000000", "MainForegroundColor": "#000000",
@ -9332,6 +9264,9 @@ $sync.configs.themes = '{
"WinUtilIconSize": "Auto", "WinUtilIconSize": "Auto",
"SettingsIconFontSize": "18", "SettingsIconFontSize": "18",
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"ProgressBarForegroundColor": "#222222",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#cccccc",
"ComboBoxBackgroundColor": "#000000", "ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58", "LabelboxForegroundColor": "#FFEE58",
"MainForegroundColor": "#9CCC65", "MainForegroundColor": "#9CCC65",
@ -9391,6 +9326,9 @@ $sync.configs.themes = '{
"WinUtilIconSize": "Auto", "WinUtilIconSize": "Auto",
"SettingsIconFontSize": "18", "SettingsIconFontSize": "18",
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"ProgressBarForegroundColor": "#222222",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#FFFFFF",
"ComboBoxBackgroundColor": "#000000", "ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58", "LabelboxForegroundColor": "#FFEE58",
"MainForegroundColor": "#9CCC65", "MainForegroundColor": "#9CCC65",
@ -13295,6 +13233,7 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
</ToggleButton> </ToggleButton>
<Grid Background="{MainBackgroundColor}" ShowGridLines="False" Width="Auto" Height="Auto" HorizontalAlignment="Stretch"> <Grid Background="{MainBackgroundColor}" ShowGridLines="False" Width="Auto" Height="Auto" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="50px"/> <ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/> <ColumnDefinition Width="50px"/>
@ -13315,7 +13254,7 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
Height="{SearchBarHeight}" Height="{SearchBarHeight}"
FontSize="{SearchBarTextBoxFontSize}" FontSize="{SearchBarTextBoxFontSize}"
VerticalAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="10,0,0,0" BorderThickness="1" Padding="22,2,2,2" BorderThickness="1"
Name="SearchBar" Name="SearchBar"
Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}" Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}"
ToolTip="Press Ctrl-F and type app name to filter application list below. Press Esc to reset the filter"> ToolTip="Press Ctrl-F and type app name to filter application list below. Press Esc to reset the filter">
@ -13339,9 +13278,38 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
Style="{StaticResource SearchBarClearButtonStyle}" Style="{StaticResource SearchBarClearButtonStyle}"
Margin="193,0,0,0" Visibility="Collapsed"/> Margin="193,0,0,0" Visibility="Collapsed"/>
<ProgressBar
Grid.Column="1"
Minimum="0"
Maximum="100"
Width="250"
Height="{SearchBarHeight}"
Foreground="{ProgressBarForegroundColor}" Background="{ProgressBarBackgroundColor}" BorderBrush="{ProgressBarForegroundColor}"
Visibility="Collapsed"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="2,0,0,0" BorderThickness="1" Padding="6,2,2,2"
Name="ProgressBar">
</ProgressBar>
<Label
Grid.Column="1"
Width="250"
Height="{SearchBarHeight}"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="{SearchBarTextBoxFontSize}"
Background="Transparent"
Visibility="Collapsed"
Margin="2,0,0,0" BorderThickness="0" Padding="6,2,2,2"
Name="ProgressBarLabel">
<TextBlock
TextTrimming="CharacterEllipsis"
Background="Transparent"
Foreground="{ProgressBarTextColor}">
</TextBlock>
</Label>
<Button Name="SettingsButton" <Button Name="SettingsButton"
Style="{StaticResource HoverButtonStyle}" Style="{StaticResource HoverButtonStyle}"
Grid.Column="1" BorderBrush="Transparent" Grid.Column="2" BorderBrush="Transparent"
Background="{MainBackgroundColor}" Background="{MainBackgroundColor}"
Foreground="{MainForegroundColor}" Foreground="{MainForegroundColor}"
FontSize="{SettingsIconFontSize}" FontSize="{SettingsIconFontSize}"
@ -13350,7 +13318,7 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
Margin="0,5,5,0" Margin="0,5,5,0"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
Content="&#xE713;"/> Content="&#xE713;"/>
<Popup Grid.Column="1" Name="SettingsPopup" <Popup Grid.Column="2" Name="SettingsPopup"
IsOpen="False" IsOpen="False"
PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom" PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom"
HorizontalAlignment="Right" VerticalAlignment="Top"> HorizontalAlignment="Right" VerticalAlignment="Top">
@ -13366,7 +13334,7 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
</Popup> </Popup>
<Button <Button
Grid.Column="2" Grid.Column="3"
Content="&#xD7;" BorderThickness="0" Content="&#xD7;" BorderThickness="0"
BorderBrush="Transparent" BorderBrush="Transparent"
Background="{MainBackgroundColor}" Background="{MainBackgroundColor}"

View File

@ -632,6 +632,7 @@
</ToggleButton> </ToggleButton>
<Grid Background="{MainBackgroundColor}" ShowGridLines="False" Width="Auto" Height="Auto" HorizontalAlignment="Stretch"> <Grid Background="{MainBackgroundColor}" ShowGridLines="False" Width="Auto" Height="Auto" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="50px"/> <ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/> <ColumnDefinition Width="50px"/>
@ -652,7 +653,7 @@
Height="{SearchBarHeight}" Height="{SearchBarHeight}"
FontSize="{SearchBarTextBoxFontSize}" FontSize="{SearchBarTextBoxFontSize}"
VerticalAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="10,0,0,0" BorderThickness="1" Padding="22,2,2,2" BorderThickness="1"
Name="SearchBar" Name="SearchBar"
Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}" Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}"
ToolTip="Press Ctrl-F and type app name to filter application list below. Press Esc to reset the filter"> ToolTip="Press Ctrl-F and type app name to filter application list below. Press Esc to reset the filter">
@ -676,9 +677,38 @@
Style="{StaticResource SearchBarClearButtonStyle}" Style="{StaticResource SearchBarClearButtonStyle}"
Margin="193,0,0,0" Visibility="Collapsed"/> Margin="193,0,0,0" Visibility="Collapsed"/>
<ProgressBar
Grid.Column="1"
Minimum="0"
Maximum="100"
Width="250"
Height="{SearchBarHeight}"
Foreground="{ProgressBarForegroundColor}" Background="{ProgressBarBackgroundColor}" BorderBrush="{ProgressBarForegroundColor}"
Visibility="Collapsed"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="2,0,0,0" BorderThickness="1" Padding="6,2,2,2"
Name="ProgressBar">
</ProgressBar>
<Label
Grid.Column="1"
Width="250"
Height="{SearchBarHeight}"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="{SearchBarTextBoxFontSize}"
Background="Transparent"
Visibility="Collapsed"
Margin="2,0,0,0" BorderThickness="0" Padding="6,2,2,2"
Name="ProgressBarLabel">
<TextBlock
TextTrimming="CharacterEllipsis"
Background="Transparent"
Foreground="{ProgressBarTextColor}">
</TextBlock>
</Label>
<Button Name="SettingsButton" <Button Name="SettingsButton"
Style="{StaticResource HoverButtonStyle}" Style="{StaticResource HoverButtonStyle}"
Grid.Column="1" BorderBrush="Transparent" Grid.Column="2" BorderBrush="Transparent"
Background="{MainBackgroundColor}" Background="{MainBackgroundColor}"
Foreground="{MainForegroundColor}" Foreground="{MainForegroundColor}"
FontSize="{SettingsIconFontSize}" FontSize="{SettingsIconFontSize}"
@ -687,7 +717,7 @@
Margin="0,5,5,0" Margin="0,5,5,0"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
Content="&#xE713;"/> Content="&#xE713;"/>
<Popup Grid.Column="1" Name="SettingsPopup" <Popup Grid.Column="2" Name="SettingsPopup"
IsOpen="False" IsOpen="False"
PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom" PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom"
HorizontalAlignment="Right" VerticalAlignment="Top"> HorizontalAlignment="Right" VerticalAlignment="Top">
@ -703,7 +733,7 @@
</Popup> </Popup>
<Button <Button
Grid.Column="2" Grid.Column="3"
Content="&#xD7;" BorderThickness="0" Content="&#xD7;" BorderThickness="0"
BorderBrush="Transparent" BorderBrush="Transparent"
Background="{MainBackgroundColor}" Background="{MainBackgroundColor}"