mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Compare commits
27 Commits
5b024a4723
...
24.07.31
Author | SHA1 | Date | |
---|---|---|---|
83bcf246f6 | |||
e2567bddc9 | |||
2508f28806 | |||
2d185e1919 | |||
5ac13f265e | |||
128593a950 | |||
e7328c2739 | |||
18f9f5e35d | |||
760fb3d30a | |||
a75c80057a | |||
514eddd0b6 | |||
3929459106 | |||
b4bf321e66 | |||
74f58e7957 | |||
875864060e | |||
e38615b4b4 | |||
9f33cb1b82 | |||
313c5f59de | |||
7de93ae208 | |||
140620e76c | |||
8ae328c4b5 | |||
1032d3d5aa | |||
84a84fd34d | |||
b23c685580 | |||
214eb1d332 | |||
5083b84233 | |||
4553f3e758 |
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@ -7,3 +7,5 @@ updates:
|
||||
ignore:
|
||||
- dependency-name: "actions/stale"
|
||||
versions: '>= 9'
|
||||
- dependency-name: "actions/setup-python"
|
||||
versions: '> 4'
|
||||
|
33
.github/workflows/close-discussion.yml
vendored
33
.github/workflows/close-discussion.yml
vendored
@ -8,31 +8,36 @@ jobs:
|
||||
closeDiscussion:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check if PR was merged
|
||||
if: github.event.pull_request.merged == true
|
||||
run: echo "PR was merged"
|
||||
|
||||
- name: Extract Discussion Number & Close If any Where Found
|
||||
- name: Extract Discussion Number & Close If any Were Found
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event.pull_request.merged == true
|
||||
id: extract-discussion
|
||||
run: |
|
||||
echo '${{ github.event.pull_request.body }}' > pr_body.txt
|
||||
pr_body="${{ github.event.pull_request.body }}"
|
||||
discussion_ids=$(echo "$pr_body" | grep -oP '(?i)(resolve|fix|close)[s|d]? #\K[0-9]+')
|
||||
|
||||
discussion_ids_arr=()
|
||||
cat pr_body.txt | grep -i -Po '^\s*(-|\d+\.)?\s*(Resolve(s|d)?)\s*#\d+\s*$|^\s*(-|\d+\.)?\s*(Fix(es|ed)?)\s*#\d+\s*$|^\s*(-|\d+\.)?\s*(Close(s|d)?)\s*#\d+\s*$' | awk -F '#' '{print $2}' > discussion_ids_list.txt
|
||||
while read -r line; do
|
||||
discussion_ids_arr+=("$line")
|
||||
done < discussion_ids_list.txt
|
||||
if [ -z "$discussion_ids" ]; then
|
||||
echo "No discussion IDs found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
number_of_ids=${#discussion_ids_arr[@]}
|
||||
for (( i=0; i<${number_of_ids}; i++ ));
|
||||
do
|
||||
discussion_id=${discussion_ids_arr[$i]}
|
||||
echo "$discussion_id"
|
||||
curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
|
||||
for discussion_id in $discussion_ids; do
|
||||
echo "Closing discussion #$discussion_id"
|
||||
response=$(curl -s -o /dev/null -w "%{http_code}" -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
|
||||
-d '{"state": "closed"}' \
|
||||
'https://api.github.com/repos/${{ github.repository }}/discussions/$discussion_id'
|
||||
"https://api.github.com/repos/${{ github.repository }}/discussions/$discussion_id")
|
||||
|
||||
if [ "$response" -ne 200 ]; then
|
||||
echo "Failed to close discussion #$discussion_id. HTTP status code: $response"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
shell: bash
|
2
.github/workflows/github-pages.yml
vendored
2
.github/workflows/github-pages.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
- uses: actions/cache@v4
|
||||
|
1
.github/workflows/sponsors.yml
vendored
1
.github/workflows/sponsors.yml
vendored
@ -8,6 +8,7 @@ permissions:
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: (github.event_name == 'schedule' && github.repository == 'ChrisTitusTech/winutil') || (github.event_name != 'schedule')
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v4
|
||||
|
12
README.md
12
README.md
@ -10,21 +10,20 @@ This utility is a compilation of Windows tasks I perform on each Windows system
|
||||
|
||||
## 💡 Usage
|
||||
|
||||
Winutil must be run in Admin mode because it performs system-wide tweaks. To achieve this, open PowerShell or Windows Terminal as an administrator. Here are a few ways to do it:
|
||||
Winutil must be run in Admin mode because it performs system-wide tweaks. To achieve this, run PowerShell as an administrator. Here are a few ways to do it:
|
||||
|
||||
1. **Right-Click Method:**
|
||||
1. **Start menu Method:**
|
||||
- Right-click on the start menu.
|
||||
- Choose "Windows PowerShell (Admin)" (for Windows 10) or "Terminal (Admin)" (for Windows 11).
|
||||
|
||||
2. **Search and Launch Method:**
|
||||
- Press the Windows key.
|
||||
- Type "PowerShell" or "Terminal" (for Windows 11).
|
||||
- Press `Ctrl + Shift + Enter` to launch it with administrator privileges.
|
||||
|
||||
- Press `Ctrl + Shift + Enter` or Right-click and choose "Run as administrator" to launch it with administrator privileges.
|
||||
|
||||
### Launch Command
|
||||
|
||||
#### Stable Branch
|
||||
#### Stable Branch (Recommended)
|
||||
|
||||
```ps1
|
||||
irm "https://christitus.com/win" | iex
|
||||
@ -45,7 +44,6 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
|
||||
|
||||
### [ChrisTitus.com Article](https://christitus.com/windows-tool/)
|
||||
|
||||
|
||||
## 💖 Support
|
||||
- To morally and mentally support the project, make sure to leave a ⭐️!
|
||||
- EXE Wrapper for $10 @ https://www.cttstore.com/windows-toolbox
|
||||
@ -54,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
|
||||
|
||||
These are the sponsors that help keep this project alive with monthly contributions.
|
||||
|
||||
<!-- sponsors --><a href="https://github.com/GregoryNavasarkian"><img src="https://github.com/GregoryNavasarkian.png" width="60px" alt="Gregory Navasarkian" /></a><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="Yusuke Saito" /></a><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="" /></a><a href="https://github.com/JennJones89"><img src="https://github.com/JennJones89.png" width="60px" alt="" /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="wyatt" /></a><a href="https://github.com/Cube707"><img src="https://github.com/Cube707.png" width="60px" alt="Jan Wille" /></a><a href="https://github.com/Owen-3456"><img src="https://github.com/Owen-3456.png" width="60px" alt="Owen" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="" /></a><a href="https://github.com/getsmor"><img src="https://github.com/getsmor.png" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="" /></a><a href="https://github.com/jeffnesbit"><img src="https://github.com/jeffnesbit.png" width="60px" alt="" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="Stefan" /></a><a href="https://github.com/thaddl"><img src="https://github.com/thaddl.png" width="60px" alt="thaddl" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="Dave Jones" /></a><!-- sponsors -->
|
||||
<!-- sponsors --><a href="https://github.com/GregoryNavasarkian"><img src="https://github.com/GregoryNavasarkian.png" width="60px" alt="Gregory Navasarkian" /></a><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="Yusuke Saito" /></a><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="" /></a><a href="https://github.com/JennJones89"><img src="https://github.com/JennJones89.png" width="60px" alt="" /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="wyatt" /></a><a href="https://github.com/Cube707"><img src="https://github.com/Cube707.png" width="60px" alt="Jan Wille" /></a><a href="https://github.com/Owen-3456"><img src="https://github.com/Owen-3456.png" width="60px" alt="Owen" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="" /></a><a href="https://github.com/getsmor"><img src="https://github.com/getsmor.png" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="" /></a><a href="https://github.com/jeffnesbit"><img src="https://github.com/jeffnesbit.png" width="60px" alt="" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="Stefan" /></a><a href="https://github.com/thaddl"><img src="https://github.com/thaddl.png" width="60px" alt="thaddl" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="Dave Jones" /></a><!-- sponsors -->
|
||||
|
||||
## 🏅 Thanks to all Contributors
|
||||
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||
|
@ -205,7 +205,7 @@
|
||||
"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.",
|
||||
"link": "https://www.advancedrenamer.com/",
|
||||
"winget": "XP9MD3S1KFCPH1"
|
||||
"winget": "HulubuluSoftware.AdvancedRenamer"
|
||||
},
|
||||
"calibre": {
|
||||
"category": "Document",
|
||||
@ -2466,8 +2466,8 @@
|
||||
"wingetui": {
|
||||
"category": "Utilities",
|
||||
"choco": "wingetui",
|
||||
"content": "UnigetUI",
|
||||
"description": "WingetUI is a graphical user interface for Microsoft's Windows Package Manager (winget).",
|
||||
"content": "UniGetUI",
|
||||
"description": "UniGetUI is a GUI for Winget, Chocolatey, and other Windows CLI package managers.",
|
||||
"link": "https://www.marticliment.com/wingetui/",
|
||||
"winget": "SomePythonThings.WingetUIStore"
|
||||
},
|
||||
|
@ -25,6 +25,10 @@
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
|
||||
"ProgressBarForegroundColor": "#FFAC1C",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#000000",
|
||||
|
||||
"ComboBoxBackgroundColor": "#FFFFFF",
|
||||
"LabelboxForegroundColor": "#000000",
|
||||
"MainForegroundColor": "#000000",
|
||||
@ -95,6 +99,10 @@
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
|
||||
"ProgressBarForegroundColor": "#222222",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#cccccc",
|
||||
|
||||
"ComboBoxBackgroundColor": "#000000",
|
||||
"LabelboxForegroundColor": "#FFEE58",
|
||||
"MainForegroundColor": "#9CCC65",
|
||||
@ -163,6 +171,10 @@
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
|
||||
"ProgressBarForegroundColor": "#222222",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#FFFFFF",
|
||||
|
||||
"ComboBoxBackgroundColor": "#000000",
|
||||
"LabelboxForegroundColor": "#FFEE58",
|
||||
"MainForegroundColor": "#9CCC65",
|
||||
|
@ -3016,6 +3016,22 @@
|
||||
"Enable-NetAdapterBinding -Name \"*\" -ComponentID ms_tcpip6"
|
||||
]
|
||||
},
|
||||
"WPFTweaksDisableBGapps": {
|
||||
"Content": "Disable Background Apps",
|
||||
"Description": "Disables all Microsoft Store apps from running in the background, which has to be done individually since Win11",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"Order": "a024_",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\BackgroundAccessApplications",
|
||||
"Name": "GlobalUserDisabled",
|
||||
"Value": "1",
|
||||
"OriginalValue": "0",
|
||||
"Type": "DWord"
|
||||
}
|
||||
]
|
||||
},
|
||||
"WPFTweaksDisableFSO": {
|
||||
"Content": "Disable Fullscreen Optimizations",
|
||||
"Description": "Disables FSO in all applications. NOTE: This will disable Color Management in Exclusive Fullscreen",
|
||||
@ -3152,6 +3168,14 @@
|
||||
"Order": "a204_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFToggleDetailedBSoD": {
|
||||
"Content": "Detailed BSoD",
|
||||
"Description": "If Enabled then you will see a detailed Blue Screen of Death (BSOD) with more information.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Order": "a205_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFOOSUbutton": {
|
||||
"Content": "Run OO Shutup 10",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
@ -3165,7 +3189,7 @@
|
||||
"panel": "1",
|
||||
"Order": "a040_",
|
||||
"Type": "Combobox",
|
||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Level3 Open_DNS Quad9"
|
||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult"
|
||||
},
|
||||
"WPFTweaksbutton": {
|
||||
"Content": "Run Tweaks",
|
||||
|
@ -1,4 +1,7 @@
|
||||
# FAQ's
|
||||
|
||||
## How do I uninstall WinUtil?
|
||||
* You do not have to uninstall WinUtil. As it is a script you run from PowerShell, it only loads into your RAM. This means that as soon as you close WinUtil, it will be deleted from your system.
|
||||
* You do not have to uninstall WinUtil. As it is a script you run from Powershell it only loads into your RAM. This means as soon as you close WinUtil it will be deleted off your system.
|
||||
|
||||
## I applied a tweak and now something doesn't work, what do I do?
|
||||
* If you applied a tweak and it breaks something, you can always revert the tweak by selecting the tweak and clicking "Undo Selected Tweaks".
|
||||
|
@ -154,4 +154,13 @@ Function Get-WinUtilToggleStatus {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
|
||||
$DetailedBSoD = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
|
||||
if($DetailedBSoD -eq 0) {
|
||||
return $false
|
||||
}
|
||||
else{
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,12 +54,18 @@ function Install-WinUtilProgramChoco {
|
||||
}
|
||||
if(($chocoInstallStatus -eq 0) -AND ($tryUpgrade -eq $false)){
|
||||
Write-Host "$($Program.choco) installed successfully using Chocolatey."
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value ($x/$count) })
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to install $($Program.choco) using Chocolatey, Chocolatey output:`n`n$(Get-Content -Path $installOutputFilePath)."
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to install $($Program.choco) due to an error: $_"
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,15 +77,20 @@ function Install-WinUtilProgramChoco {
|
||||
$chocoUninstallStatus = $(Start-Process -FilePath "choco" -ArgumentList "uninstall $($Program.choco) -y" -Wait -PassThru).ExitCode
|
||||
if($chocoUninstallStatus -eq 0){
|
||||
Write-Host "$($Program.choco) uninstalled successfully using Chocolatey."
|
||||
$x++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value ($x/$count) })
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to uninstall $($Program.choco) using Chocolatey, Chocolatey output:`n`n$(Get-Content -Path $uninstallOutputFilePath)."
|
||||
$x++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to uninstall $($Program.choco) due to an error: $_"
|
||||
$x++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
}
|
||||
$x++
|
||||
}
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
|
||||
|
@ -1,106 +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."
|
||||
continue
|
||||
}
|
||||
if ($status -eq -1978335189) {
|
||||
Write-Host "$($Program.winget) No applicable update found"
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with User scope"
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if($status -eq 0) {
|
||||
Write-Host "$($Program.winget) installed successfully with User scope."
|
||||
continue
|
||||
}
|
||||
if ($status -eq -1978335189) {
|
||||
Write-Host "$($Program.winget) No applicable update found"
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with User prompt"
|
||||
$userChoice = [System.Windows.MessageBox]::Show("Do you want to attempt $($Program.winget) installation with specific user credentials? Select 'Yes' to proceed or 'No' to skip.", "User Credential Prompt", [System.Windows.MessageBoxButton]::YesNo)
|
||||
if ($userChoice -eq 'Yes') {
|
||||
$getcreds = Get-Credential
|
||||
$process = Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Credential $getcreds -PassThru -NoNewWindow
|
||||
Wait-Process -Id $process.Id
|
||||
$status = $process.ExitCode
|
||||
} else {
|
||||
Write-Host "Skipping installation with specific user credentials."
|
||||
}
|
||||
if($status -eq 0) {
|
||||
Write-Host "$($Program.winget) installed successfully with User prompt."
|
||||
continue
|
||||
}
|
||||
if ($status -eq -1978335189) {
|
||||
Write-Host "$($Program.winget) No applicable update found"
|
||||
continue
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to install $($Program.winget). With winget"
|
||||
$failedPackages += $Program
|
||||
}
|
||||
}
|
||||
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)."
|
||||
} else {
|
||||
Write-Host "$($Program.winget) uninstalled successfully."
|
||||
$failedPackages += $Program
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to uninstall $($Program.winget) due to an error: $_"
|
||||
$failedPackages += $Program
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
return $failedPackages;
|
||||
}
|
@ -19,6 +19,7 @@ function Install-WinUtilWinget {
|
||||
Write-Host "`nWinget is not Installed. Continuing with install.`r" -ForegroundColor Red
|
||||
}
|
||||
|
||||
|
||||
# Gets the computer's information
|
||||
if ($null -eq $sync.ComputerInfo){
|
||||
$ComputerInfo = Get-ComputerInfo -ErrorAction Stop
|
||||
@ -63,4 +64,5 @@ function Install-WinUtilWinget {
|
||||
throw [WingetFailedInstall]::new('Failed to install!')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,90 +38,104 @@ function Remove-Features([switch] $dumpFeatures = $false, [switch] $keepDefender
|
||||
Remove-Features -keepDefender:$false
|
||||
|
||||
#>
|
||||
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
|
||||
if ($dumpFeatures)
|
||||
try
|
||||
{
|
||||
$featlist > allfeaturesdump.txt
|
||||
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
|
||||
if ($dumpFeatures)
|
||||
{
|
||||
$featlist > allfeaturesdump.txt
|
||||
}
|
||||
|
||||
$featlist = $featlist | Where-Object {
|
||||
$_ -NotLike "*Printing*" -AND
|
||||
$_ -NotLike "*TelnetClient*" -AND
|
||||
$_ -NotLike "*PowerShell*" -AND
|
||||
$_ -NotLike "*NetFx*" -AND
|
||||
$_ -NotLike "*Media*" -AND
|
||||
$_ -NotLike "*NFS*"
|
||||
}
|
||||
|
||||
if ($keepDefender) { $featlist = $featlist | Where-Object { $_ -NotLike "*Defender*" }}
|
||||
|
||||
foreach($feature in $featlist)
|
||||
{
|
||||
$status = "Removing feature $feature"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $feature"
|
||||
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $feature -Remove -ErrorAction SilentlyContinue -NoRestart
|
||||
}
|
||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||
}
|
||||
|
||||
$featlist = $featlist | Where-Object {
|
||||
$_ -NotLike "*Printing*" -AND
|
||||
$_ -NotLike "*TelnetClient*" -AND
|
||||
$_ -NotLike "*PowerShell*" -AND
|
||||
$_ -NotLike "*NetFx*" -AND
|
||||
$_ -NotLike "*Media*" -AND
|
||||
$_ -NotLike "*NFS*"
|
||||
}
|
||||
|
||||
if ($keepDefender) { $featlist = $featlist | Where-Object { $_ -NotLike "*Defender*" }}
|
||||
|
||||
foreach($feature in $featlist)
|
||||
catch
|
||||
{
|
||||
$status = "Removing feature $feature"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $feature"
|
||||
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $feature -Remove -ErrorAction SilentlyContinue -NoRestart
|
||||
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
||||
}
|
||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||
}
|
||||
|
||||
function Remove-Packages
|
||||
{
|
||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||
|
||||
$pkglist = $pkglist | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*.NET*" -AND
|
||||
$_ -NotLike "*Store*" -AND
|
||||
$_ -NotLike "*VCLibs*" -AND
|
||||
$_ -NotLike "*AAD.BrokerPlugin",
|
||||
$_ -NotLike "*LockApp*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*immersivecontrolpanel*" -AND
|
||||
$_ -NotLike "*ContentDeliveryManager*" -AND
|
||||
$_ -NotLike "*PinningConfirMationDialog*" -AND
|
||||
$_ -NotLike "*SecHealthUI*" -AND
|
||||
$_ -NotLike "*SecureAssessmentBrowser*" -AND
|
||||
$_ -NotLike "*PrintDialog*" -AND
|
||||
$_ -NotLike "*AssignedAccessLockApp*" -AND
|
||||
$_ -NotLike "*OOBENetworkConnectionFlow*" -AND
|
||||
$_ -NotLike "*Apprep.ChxApp*" -AND
|
||||
$_ -NotLike "*CBS*" -AND
|
||||
$_ -NotLike "*OOBENetworkCaptivePortal*" -AND
|
||||
$_ -NotLike "*PeopleExperienceHost*" -AND
|
||||
$_ -NotLike "*ParentalControls*" -AND
|
||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||
$_ -NotLike "*InputApp*" -AND
|
||||
$_ -NotLike "*AccountsControl*" -AND
|
||||
$_ -NotLike "*AsyncTextService*" -AND
|
||||
$_ -NotLike "*CapturePicker*" -AND
|
||||
$_ -NotLike "*CredDialogHost*" -AND
|
||||
$_ -NotLike "*BioEnrollMent*" -AND
|
||||
$_ -NotLike "*ShellExperienceHost*" -AND
|
||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*"
|
||||
}
|
||||
|
||||
foreach ($pkg in $pkglist)
|
||||
try
|
||||
{
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
}
|
||||
catch {
|
||||
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
||||
Write-Host "Could not remove OS package $($pkg)"
|
||||
continue
|
||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||
|
||||
$pkglist = $pkglist | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*.NET*" -AND
|
||||
$_ -NotLike "*Store*" -AND
|
||||
$_ -NotLike "*VCLibs*" -AND
|
||||
$_ -NotLike "*AAD.BrokerPlugin",
|
||||
$_ -NotLike "*LockApp*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*immersivecontrolpanel*" -AND
|
||||
$_ -NotLike "*ContentDeliveryManager*" -AND
|
||||
$_ -NotLike "*PinningConfirMationDialog*" -AND
|
||||
$_ -NotLike "*SecHealthUI*" -AND
|
||||
$_ -NotLike "*SecureAssessmentBrowser*" -AND
|
||||
$_ -NotLike "*PrintDialog*" -AND
|
||||
$_ -NotLike "*AssignedAccessLockApp*" -AND
|
||||
$_ -NotLike "*OOBENetworkConnectionFlow*" -AND
|
||||
$_ -NotLike "*Apprep.ChxApp*" -AND
|
||||
$_ -NotLike "*CBS*" -AND
|
||||
$_ -NotLike "*OOBENetworkCaptivePortal*" -AND
|
||||
$_ -NotLike "*PeopleExperienceHost*" -AND
|
||||
$_ -NotLike "*ParentalControls*" -AND
|
||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||
$_ -NotLike "*InputApp*" -AND
|
||||
$_ -NotLike "*AccountsControl*" -AND
|
||||
$_ -NotLike "*AsyncTextService*" -AND
|
||||
$_ -NotLike "*CapturePicker*" -AND
|
||||
$_ -NotLike "*CredDialogHost*" -AND
|
||||
$_ -NotLike "*BioEnrollMent*" -AND
|
||||
$_ -NotLike "*ShellExperienceHost*" -AND
|
||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*"
|
||||
}
|
||||
|
||||
foreach ($pkg in $pkglist)
|
||||
{
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
}
|
||||
catch {
|
||||
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
||||
Write-Host "Could not remove OS package $($pkg)"
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||
}
|
||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||
}
|
||||
|
||||
function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
|
||||
|
34
functions/private/Invoke-WinUtilDetailedBSoD.ps1
Normal file
34
functions/private/Invoke-WinUtilDetailedBSoD.ps1
Normal file
@ -0,0 +1,34 @@
|
||||
Function Invoke-WinUtilDetailedBSoD {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enables/Disables Detailed BSoD
|
||||
(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -Name 'DisplayParameters').DisplayParameters
|
||||
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
Try{
|
||||
if ($Enabled -eq $false){
|
||||
Write-Host "Enabling Detailed BSoD"
|
||||
$value = 1
|
||||
}
|
||||
else {
|
||||
Write-Host "Disabling Detailed BSoD"
|
||||
$value =0
|
||||
}
|
||||
|
||||
$Path = "HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl"
|
||||
Set-ItemProperty -Path $Path -Name DisplayParameters -Value $value
|
||||
}
|
||||
Catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
}
|
||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -10,6 +10,8 @@ function Invoke-WinUtilFeatureInstall {
|
||||
$CheckBox
|
||||
)
|
||||
|
||||
$x = 0
|
||||
|
||||
$CheckBox | ForEach-Object {
|
||||
if($sync.configs.feature.$psitem.feature){
|
||||
Foreach( $feature in $sync.configs.feature.$psitem.feature ){
|
||||
@ -20,9 +22,11 @@ function Invoke-WinUtilFeatureInstall {
|
||||
Catch{
|
||||
if ($psitem.Exception.Message -like "*requires elevation*"){
|
||||
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
@ -40,14 +44,18 @@ function Invoke-WinUtilFeatureInstall {
|
||||
Catch{
|
||||
if ($psitem.Exception.Message -like "*requires elevation*"){
|
||||
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||
}
|
||||
|
||||
else{
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$CheckBox.Count) })
|
||||
}
|
||||
}
|
||||
|
171
functions/private/Invoke-WinUtilWingetProgram.ps1
Normal file
171
functions/private/Invoke-WinUtilWingetProgram.ps1
Normal 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
|
||||
}
|
31
functions/private/Set-WinUtilProgressbar.ps1
Normal file
31
functions/private/Set-WinUtilProgressbar.ps1
Normal 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})
|
||||
|
||||
}
|
86
functions/private/Set-WinUtilTaskbarItem.ps1
Normal file
86
functions/private/Set-WinUtilTaskbarItem.ps1
Normal file
@ -0,0 +1,86 @@
|
||||
function Set-WinUtilTaskbaritem {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Modifies the Taskbaritem of the WPF Form
|
||||
|
||||
.PARAMETER value
|
||||
Value can be between 0 and 1, 0 being no progress done yet and 1 being fully completed
|
||||
Value does not affect item without setting the state to 'Normal', 'Error' or 'Paused'
|
||||
Set-WinUtilTaskbaritem -value 0.5
|
||||
|
||||
.PARAMETER state
|
||||
State can be 'None' > No progress, 'Indeterminate' > inf. loading gray, 'Normal' > Gray, 'Error' > Red, 'Paused' > Yellow
|
||||
no value needed:
|
||||
- Set-WinUtilTaskbaritem -state "None"
|
||||
- Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
value needed:
|
||||
- Set-WinUtilTaskbaritem -state "Error"
|
||||
- Set-WinUtilTaskbaritem -state "Normal"
|
||||
- Set-WinUtilTaskbaritem -state "Paused"
|
||||
|
||||
.PARAMETER overlay
|
||||
Overlay icon to display on the taskbar item, there are the presets 'None', 'logo' and 'checkmark' or you can specify a path/link to an image file.
|
||||
CTT logo preset:
|
||||
- Set-WinUtilTaskbaritem -overlay "logo"
|
||||
Checkmark preset:
|
||||
- Set-WinUtilTaskbaritem -overlay "checkmark"
|
||||
Warning preset:
|
||||
- Set-WinUtilTaskbaritem -overlay "warning"
|
||||
No overlay:
|
||||
- Set-WinUtilTaskbaritem -overlay "None"
|
||||
Custom icon (needs to be supported by WPF):
|
||||
- Set-WinUtilTaskbaritem -overlay "C:\path\to\icon.png"
|
||||
|
||||
.PARAMETER description
|
||||
Description to display on the taskbar item preview
|
||||
Set-WinUtilTaskbaritem -description "This is a description"
|
||||
#>
|
||||
param (
|
||||
[string]$state,
|
||||
[double]$value,
|
||||
[string]$overlay,
|
||||
[string]$description
|
||||
)
|
||||
|
||||
if ($value) {
|
||||
$sync["Form"].taskbarItemInfo.ProgressValue = $value
|
||||
}
|
||||
|
||||
if ($state) {
|
||||
switch ($state) {
|
||||
'None' { $sync["Form"].taskbarItemInfo.ProgressState = "None" }
|
||||
'Indeterminate' { $sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate" }
|
||||
'Normal' { $sync["Form"].taskbarItemInfo.ProgressState = "Normal" }
|
||||
'Error' { $sync["Form"].taskbarItemInfo.ProgressState = "Error" }
|
||||
'Paused' { $sync["Form"].taskbarItemInfo.ProgressState = "Paused" }
|
||||
default { throw "[Set-WinUtilTaskbarItem] Invalid state" }
|
||||
}
|
||||
}
|
||||
|
||||
if ($overlay) {
|
||||
switch ($overlay) {
|
||||
'logo' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\cttlogo.png"
|
||||
}
|
||||
'checkmark' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\checkmark.png"
|
||||
}
|
||||
'warning' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\warning.png"
|
||||
}
|
||||
'None' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = $null
|
||||
}
|
||||
default {
|
||||
if (Test-Path $overlay) {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = $overlay
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($description) {
|
||||
$sync["Form"].taskbarItemInfo.Description = $description
|
||||
}
|
||||
}
|
@ -14,6 +14,9 @@ function Invoke-WPFButton {
|
||||
|
||||
# Use this to get the name of the button
|
||||
#[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){
|
||||
|
||||
|
@ -16,12 +16,18 @@ function Invoke-WPFFeatureInstall {
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Features, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
if ($Features.count -eq 1){
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
|
||||
Invoke-WinUtilFeatureInstall $Features
|
||||
|
||||
$sync.ProcessRunning = $false
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
|
||||
Write-Host "==================================="
|
||||
Write-Host "--- Features are Installed ---"
|
||||
Write-Host "--- A Reboot may be required ---"
|
||||
|
@ -24,6 +24,7 @@ function Invoke-WPFGetInstalled {
|
||||
param($checkbox, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||
|
||||
if($checkbox -eq "winget"){
|
||||
Write-Host "Getting Installed Programs..."
|
||||
@ -42,5 +43,6 @@ function Invoke-WPFGetInstalled {
|
||||
|
||||
Write-Host "Done..."
|
||||
$sync.ProcessRunning = $false
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "None" })
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ function Invoke-WPFGetIso {
|
||||
$sync.BusyText.Text="N Busy"
|
||||
|
||||
|
||||
|
||||
Write-Host " _ __ __ _ "
|
||||
Write-Host " /\/\ (_) ___ _ __ ___ / / /\ \ \(_) _ __ "
|
||||
Write-Host " / \ | | / __|| '__| / _ \ \ \/ \/ /| || '_ \ "
|
||||
@ -88,6 +89,8 @@ function Invoke-WPFGetIso {
|
||||
return
|
||||
}
|
||||
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
|
||||
|
||||
# Detect the file size of the ISO and compare it with the free space of the system drive
|
||||
$isoSize = (Get-Item -Path $filePath).Length
|
||||
Write-Debug "Size of ISO file: $($isoSize) bytes"
|
||||
@ -104,6 +107,7 @@ function Invoke-WPFGetIso {
|
||||
{
|
||||
# It's critical and we can't continue. Output an error
|
||||
Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations."
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
else
|
||||
@ -122,6 +126,7 @@ function Invoke-WPFGetIso {
|
||||
Write-Error "Failed to mount the image. Error: $($_.Exception.Message)"
|
||||
Write-Error "This is NOT winutil's problem, your ISO might be corrupt, or there is a problem on the system"
|
||||
Write-Error "Please refer to this wiki for more details https://github.com/ChrisTitusTech/winutil/blob/main/wiki/Error-in-Winutil-MicroWin-during-ISO-mounting%2Cmd"
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
# storing off values in hidden fields for further steps
|
||||
@ -199,6 +204,7 @@ function Invoke-WPFGetIso {
|
||||
$msg = "Neither install.wim nor install.esd exist in the image, this could happen if you use unofficial Windows images. Please don't use shady images from the internet, use only official images. Here are instructions how to download ISO images if the Microsoft website is not showing the link to download and ISO. https://www.techrepublic.com/article/how-to-download-a-windows-10-iso-file-without-using-the-media-creation-tool/"
|
||||
Write-Host $msg
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
throw
|
||||
}
|
||||
elseif ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf))
|
||||
@ -239,6 +245,7 @@ function Invoke-WPFGetIso {
|
||||
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
$sync.ProcessRunning = $false
|
||||
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,17 +20,23 @@ function Invoke-WPFInstall {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1){
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
$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()
|
||||
foreach ($package in $PackagesToInstall) {
|
||||
if ($package.winget -eq "na") {
|
||||
$packagesChoco.add($package)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey install"
|
||||
} else {
|
||||
$packagesWinget.add($package)
|
||||
$null = $packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget install"
|
||||
}
|
||||
}
|
||||
@ -42,7 +48,7 @@ function Invoke-WPFInstall {
|
||||
$errorPackages = @()
|
||||
if($packagesWinget.Count -gt 0){
|
||||
Install-WinUtilWinget
|
||||
$errorPackages += Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget
|
||||
$errorPackages += Invoke-WinUtilWingetProgram -Action Install -Programs $packagesWinget
|
||||
$errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}}
|
||||
}
|
||||
if($packagesChoco.Count -gt 0){
|
||||
@ -52,13 +58,14 @@ function Invoke-WPFInstall {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Installs have finished ---"
|
||||
Write-Host "==========================================="
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
}
|
||||
Catch {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "Error: $_"
|
||||
Write-Host "==========================================="
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" })
|
||||
}
|
||||
Start-Sleep -Seconds 5
|
||||
$sync.ProcessRunning = $False
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ function Invoke-WPFInstallUpgrade {
|
||||
return
|
||||
}
|
||||
|
||||
# Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
|
||||
Update-WinUtilProgramWinget
|
||||
|
||||
Write-Host "==========================================="
|
||||
|
@ -4,6 +4,7 @@ function Invoke-WPFMicrowin {
|
||||
Invoke MicroWin routines...
|
||||
#>
|
||||
|
||||
|
||||
if($sync.ProcessRunning) {
|
||||
$msg = "GetIso process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
@ -39,9 +40,12 @@ public class PowerManagement {
|
||||
|
||||
if ($SaveDialog.FileName -eq "") {
|
||||
Write-Host "No file name for the target image was specified"
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
|
||||
|
||||
Write-Host "Target ISO location: $($SaveDialog.FileName)"
|
||||
|
||||
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
||||
@ -74,6 +78,7 @@ public class PowerManagement {
|
||||
$msg = "The export process has failed and MicroWin processing cannot continue"
|
||||
Write-Host "Failed to export the image"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -87,6 +92,7 @@ public class PowerManagement {
|
||||
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
||||
Write-Host $msg
|
||||
[System.Windows.MessageBox]::Show($dlg_msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Exclamation)
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
|
||||
@ -95,6 +101,7 @@ public class PowerManagement {
|
||||
if (-not $mountDirExists -or -not $scratchDirExists)
|
||||
{
|
||||
Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist."
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
|
||||
@ -109,6 +116,7 @@ public class PowerManagement {
|
||||
else
|
||||
{
|
||||
Write-Host "Could not mount image. Exiting..."
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
|
||||
@ -378,6 +386,7 @@ public class PowerManagement {
|
||||
if (-not (Test-Path -Path "$mountDir\sources\install.wim"))
|
||||
{
|
||||
Write-Error "Something went wrong and '$mountDir\sources\install.wim' doesn't exist. Please report this bug to the devs"
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
||||
Write-Host "Windows image completed. Continuing with boot.wim."
|
||||
@ -444,22 +453,16 @@ public class PowerManagement {
|
||||
}
|
||||
|
||||
Write-Host "[INFO] Using oscdimg.exe from: $oscdimgPath"
|
||||
#& oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir $env:temp\microwin.iso
|
||||
#Start-Process -FilePath $oscdimgPath -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir $env:temp\microwin.iso" -NoNewWindow -Wait
|
||||
#Start-Process -FilePath $oscdimgPath -ArgumentList '-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir `"$($SaveDialog.FileName)`"' -NoNewWindow -Wait
|
||||
$oscdimgProc = New-Object System.Diagnostics.Process
|
||||
$oscdimgProc.StartInfo.FileName = $oscdimgPath
|
||||
$oscdimgProc.StartInfo.Arguments = "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir `"$($SaveDialog.FileName)`""
|
||||
$oscdimgProc.StartInfo.CreateNoWindow = $True
|
||||
$oscdimgProc.StartInfo.WindowStyle = "Hidden"
|
||||
$oscdimgProc.StartInfo.UseShellExecute = $False
|
||||
$oscdimgProc.Start()
|
||||
$oscdimgProc.WaitForExit()
|
||||
|
||||
$oscdimgProc = Start-Process -FilePath "$oscdimgPath" -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin `"$mountDir`" `"$($SaveDialog.FileName)`"" -Wait -PassThru -NoNewWindow
|
||||
|
||||
$LASTEXITCODE = $oscdimgProc.ExitCode
|
||||
|
||||
Write-Host "OSCDIMG Error Level : $($oscdimgProc.ExitCode)"
|
||||
|
||||
if ($copyToUSB)
|
||||
{
|
||||
Write-Host "Copying target ISO to the USB drive"
|
||||
#Copy-ToUSB("$env:temp\microwin.iso")
|
||||
Copy-ToUSB("$($SaveDialog.FileName)")
|
||||
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
|
||||
}
|
||||
@ -476,12 +479,23 @@ public class PowerManagement {
|
||||
Write-Host "`n`nPerforming Cleanup..."
|
||||
Remove-Item -Recurse -Force "$($scratchDir)"
|
||||
Remove-Item -Recurse -Force "$($mountDir)"
|
||||
#$msg = "Done. ISO image is located here: $env:temp\microwin.iso"
|
||||
$msg = "Done. ISO image is located here: $($SaveDialog.FileName)"
|
||||
Write-Host $msg
|
||||
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Information)
|
||||
} else {
|
||||
Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed."
|
||||
try
|
||||
{
|
||||
# This creates a new Win32 exception from which we can extract a message in the system language.
|
||||
# Now, this will NOT throw an exception
|
||||
$exitCode = New-Object System.ComponentModel.Win32Exception($LASTEXITCODE)
|
||||
Write-Host "Reason: $($exitCode.Message)"
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Could not get error description from Windows APIs
|
||||
}
|
||||
}
|
||||
|
||||
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
|
||||
|
@ -17,8 +17,8 @@ function Invoke-WPFShortcut {
|
||||
[bool]$RunAsAdmin = $false
|
||||
)
|
||||
|
||||
# add an a Custom Icon if it's available at "$env:TEMP\cttlogo.png", else don't add a Custom Icon.
|
||||
$iconPath = $null
|
||||
# Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon.
|
||||
|
||||
Switch ($ShortcutToAdd) {
|
||||
"WinUtil" {
|
||||
# Use Powershell 7 if installed and fallback to PS5 if not
|
||||
@ -33,12 +33,6 @@ function Invoke-WPFShortcut {
|
||||
|
||||
$DestinationName = "WinUtil.lnk"
|
||||
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile "$env:TEMP\cttlogo.png"
|
||||
|
||||
if (Test-Path -Path "$env:TEMP\cttlogo.png") {
|
||||
$iconPath = "$env:LOCALAPPDATA\winutil\cttlogo.ico"
|
||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,10 +52,10 @@ function Invoke-WPFShortcut {
|
||||
# Prepare the Shortcut paramter
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
||||
$Shortcut.TargetPath = $shell
|
||||
$Shortcut.Arguments = $shellArgs
|
||||
if ($null -ne $iconPath) {
|
||||
$shortcut.IconLocation = $iconPath
|
||||
$Shortcut.TargetPath = $SourceExe
|
||||
$Shortcut.Arguments = $ArgumentsToSourceExe
|
||||
if (Test-Path -Path $winutildir["logo.ico"]) {
|
||||
$shortcut.IconLocation = $winutildir["logo.ico"]
|
||||
}
|
||||
|
||||
# Save the Shortcut to disk
|
||||
|
@ -32,5 +32,6 @@ function Invoke-WPFToggle {
|
||||
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
|
||||
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)}
|
||||
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)}
|
||||
"WPFToggleDetailedBSoD" {Invoke-WinUtilDetailedBSoD $(Get-WinUtilToggleStatus WPFToggleDetailedBSoD)}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ function Invoke-WPFTweakPS7{
|
||||
Write-Host "Powershell 7 is already installed."
|
||||
} else {
|
||||
Write-Host "Installing Powershell 7..."
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall @(@{"winget"="Microsoft.PowerShell"})
|
||||
Invoke-WinUtilWingetProgram -Action Install -Programs @("Microsoft.PowerShell")
|
||||
}
|
||||
$targetTerminalName = "PowerShell"
|
||||
}
|
||||
|
@ -29,8 +29,14 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
if($confirm -eq "No"){return}
|
||||
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1){
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
@ -39,7 +45,7 @@ function Invoke-WPFUnInstall {
|
||||
$packagesChoco.add($package)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey Uninstall"
|
||||
} else {
|
||||
$packagesWinget.add($package)
|
||||
$packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget Uninstall"
|
||||
}
|
||||
}
|
||||
@ -50,28 +56,24 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
# Install all selected programs in new window
|
||||
if($packagesWinget.Count -gt 0){
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget -Manage "Uninstalling"
|
||||
Invoke-WinUtilWingetProgram -Action Uninstall -Programs $packagesWinget
|
||||
}
|
||||
if($packagesChoco.Count -gt 0){
|
||||
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling"
|
||||
}
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Uninstalls are Finished "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Uninstalls have finished ---"
|
||||
Write-Host "==========================================="
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
}
|
||||
Catch {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "Error: $_"
|
||||
Write-Host "==========================================="
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" })
|
||||
}
|
||||
$sync.ProcessRunning = $False
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,15 +30,21 @@ function Invoke-WPFtweaksbutton {
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
$cnt = 0
|
||||
# Execute other selected tweaks
|
||||
foreach ($tweak in $Tweaks) {
|
||||
Write-Debug "This is a tweak to run $tweak count: $cnt"
|
||||
Invoke-WinUtilTweaks $tweak
|
||||
$cnt += 1
|
||||
if ($Tweaks.count -eq 1){
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
# Execute other selected tweaks
|
||||
|
||||
for ($i = 0; $i -lt $Tweaks.Count; $i++){
|
||||
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $Tweaks.Count * 100)
|
||||
Invoke-WinUtilTweaks $tweaks[$i]
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
|
||||
}
|
||||
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
|
||||
$sync.ProcessRunning = $false
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
Write-Host "================================="
|
||||
Write-Host "-- Tweaks are Finished ---"
|
||||
Write-Host "================================="
|
||||
|
@ -12,7 +12,7 @@ function Invoke-WPFundoall {
|
||||
return
|
||||
}
|
||||
|
||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||
$tweaks = (Get-WinUtilCheckBoxes)["WPFtweaks"]
|
||||
|
||||
if ($tweaks.count -eq 0){
|
||||
$msg = "Please check the tweaks you wish to undo."
|
||||
@ -20,177 +20,29 @@ function Invoke-WPFundoall {
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($tweaks, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
Foreach ($tweak in $tweaks){
|
||||
Invoke-WinUtilTweaks $tweak -undo $true
|
||||
if ($tweaks.count -eq 1){
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0; $i -lt $tweaks.Count; $i++){
|
||||
Set-WinUtilProgressBar -Label "Undoing $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
|
||||
Invoke-WinUtiltweaks $tweaks[$i] -undo $true
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$tweaks.Count) })
|
||||
}
|
||||
|
||||
Set-WinUtilProgressBar -Label "Undo Tweaks Finished" -Percent 100
|
||||
$sync.ProcessRunning = $false
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
Write-Host "=================================="
|
||||
Write-Host "--- Undo 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)
|
||||
}
|
||||
|
||||
<#
|
||||
|
||||
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 "================================="
|
||||
#>
|
||||
}
|
@ -154,6 +154,10 @@ Invoke-WPFRunspace -ScriptBlock {
|
||||
# Print the logo
|
||||
Invoke-WPFFormVariables
|
||||
|
||||
# Progress bar in taskbaritem > Set-WinUtilProgressbar
|
||||
$sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo
|
||||
Set-WinUtilTaskbaritem -state "None"
|
||||
|
||||
# Set the titlebar
|
||||
$sync["Form"].title = $sync["Form"].title + " " + $sync.version
|
||||
# Set the commands that will run when the form is closed
|
||||
@ -288,38 +292,6 @@ Add-Type @"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Using a TaskbarItem Overlay until someone figures out how to replace the icon correctly
|
||||
|
||||
# URL of the image
|
||||
$imageUrl = "https://christitus.com/images/logo-full.png"
|
||||
|
||||
# Download the image
|
||||
$imagePath = "$env:TEMP\logo-full.png"
|
||||
Invoke-WebRequest -Uri $imageUrl -OutFile $imagePath
|
||||
|
||||
# Read the image file as a byte array
|
||||
$imageBytes = [System.IO.File]::ReadAllBytes($imagePath)
|
||||
|
||||
# Convert the byte array to a Base64 string
|
||||
$base64String = [System.Convert]::ToBase64String($imageBytes)
|
||||
|
||||
# Create a streaming image by streaming the base64 string to a bitmap streamsource
|
||||
$bitmap = New-Object System.Windows.Media.Imaging.BitmapImage
|
||||
$bitmap.BeginInit()
|
||||
$bitmap.StreamSource = [System.IO.MemoryStream][System.Convert]::FromBase64String($base64String)
|
||||
$bitmap.EndInit()
|
||||
$bitmap.Freeze()
|
||||
|
||||
# Ensure TaskbarItemInfo is created if not already
|
||||
if (-not $sync["Form"].TaskbarItemInfo) {
|
||||
$sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo
|
||||
}
|
||||
|
||||
# Set the overlay icon for the taskbar
|
||||
$sync["Form"].TaskbarItemInfo.Overlay = $bitmap
|
||||
|
||||
|
||||
$rect = New-Object RECT
|
||||
[Window]::GetWindowRect($windowHandle, [ref]$rect)
|
||||
$width = $rect.Right - $rect.Left
|
||||
@ -458,6 +430,42 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
$label.Visibility = "Collapsed"}
|
||||
})
|
||||
|
||||
# Initialize the hashtable
|
||||
$winutildir = @{}
|
||||
|
||||
# Set the path for the winutil directory
|
||||
$winutildir["path"] = "$env:LOCALAPPDATA\winutil\"
|
||||
if (-NOT (Test-Path -Path $winutildir["path"])) {
|
||||
New-Item -Path $winutildir["path"] -ItemType Directory
|
||||
}
|
||||
|
||||
# Set the path for the logo and checkmark images
|
||||
$winutildir["logo.png"] = $winutildir["path"] + "cttlogo.png"
|
||||
$winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico"
|
||||
if (-NOT (Test-Path -Path $winutildir["logo.png"])) {
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $winutildir["logo.png"]
|
||||
}
|
||||
|
||||
if (-NOT (Test-Path -Path $winutildir["logo.ico"])) {
|
||||
ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"]
|
||||
}
|
||||
|
||||
$winutildir["checkmark.png"] = $winutildir["path"] + "checkmark.png"
|
||||
$winutildir["warning.png"] = $winutildir["path"] + "warning.png"
|
||||
if (-NOT (Test-Path -Path $winutildir["checkmark.png"])) {
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/checkmark.png" -OutFile $winutildir["checkmark.png"]
|
||||
}
|
||||
if (-NOT (Test-Path -Path $winutildir["warning.png"])) {
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/warning.png" -OutFile $winutildir["warning.png"]
|
||||
}
|
||||
|
||||
|
||||
Set-WinUtilTaskbaritem -overlay "logo"
|
||||
|
||||
$sync["Form"].Add_Activated({
|
||||
Set-WinUtilTaskbaritem -overlay "logo"
|
||||
})
|
||||
|
||||
# Define event handler for button click
|
||||
$sync["SettingsButton"].Add_Click({
|
||||
Write-Debug "SettingsButton clicked"
|
||||
|
1101
winutil.ps1
1101
winutil.ps1
File diff suppressed because it is too large
Load Diff
@ -632,6 +632,7 @@
|
||||
</ToggleButton>
|
||||
<Grid Background="{MainBackgroundColor}" ShowGridLines="False" Width="Auto" Height="Auto" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="50px"/>
|
||||
<ColumnDefinition Width="50px"/>
|
||||
@ -652,7 +653,7 @@
|
||||
Height="{SearchBarHeight}"
|
||||
FontSize="{SearchBarTextBoxFontSize}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0" BorderThickness="1" Padding="22,2,2,2"
|
||||
BorderThickness="1"
|
||||
Name="SearchBar"
|
||||
Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}"
|
||||
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}"
|
||||
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"
|
||||
Style="{StaticResource HoverButtonStyle}"
|
||||
Grid.Column="1" BorderBrush="Transparent"
|
||||
Grid.Column="2" BorderBrush="Transparent"
|
||||
Background="{MainBackgroundColor}"
|
||||
Foreground="{MainForegroundColor}"
|
||||
FontSize="{SettingsIconFontSize}"
|
||||
@ -687,7 +717,7 @@
|
||||
Margin="0,5,5,0"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Content=""/>
|
||||
<Popup Grid.Column="1" Name="SettingsPopup"
|
||||
<Popup Grid.Column="2" Name="SettingsPopup"
|
||||
IsOpen="False"
|
||||
PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||
@ -703,7 +733,7 @@
|
||||
</Popup>
|
||||
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Grid.Column="3"
|
||||
Content="×" BorderThickness="0"
|
||||
BorderBrush="Transparent"
|
||||
Background="{MainBackgroundColor}"
|
||||
|
Reference in New Issue
Block a user