mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-05 20:53:50 -05:00
Compare commits
7 Commits
24.06.29
...
27792dc8a3
Author | SHA1 | Date | |
---|---|---|---|
27792dc8a3 | |||
790e0b22a5 | |||
73973d7101 | |||
a86b07a826 | |||
b47036630c | |||
e5ca44a0bd | |||
e7d49fe48b |
4
.github/workflows/close-old-issues.yaml
vendored
4
.github/workflows/close-old-issues.yaml
vendored
@ -30,6 +30,10 @@ jobs:
|
|||||||
# Sends a message for both the Stale and Close events of an issue.
|
# Sends a message for both the Stale and Close events of an issue.
|
||||||
stale-issue-message: "This issue was marked as stale because it has been inactive for 7 days"
|
stale-issue-message: "This issue was marked as stale because it has been inactive for 7 days"
|
||||||
close-issue-message: "This issue was closed because it has been inactive for 7 days since it was marked as stale"
|
close-issue-message: "This issue was closed because it has been inactive for 7 days since it was marked as stale"
|
||||||
|
# Increase this value if the project receives a lot of
|
||||||
|
# PRs (yes.. apparently they're processed no matter what) & Issues.
|
||||||
|
# Default value for it (according to the docs) is 30
|
||||||
|
operations-per-run: 100
|
||||||
# Make this field equal true if you want to test your configuration if it works correctly or not
|
# Make this field equal true if you want to test your configuration if it works correctly or not
|
||||||
debug-only: false
|
debug-only: false
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
2
.github/workflows/pre-release.yaml
vendored
2
.github/workflows/pre-release.yaml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
$version = ''
|
$version = ''
|
||||||
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
|
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
|
||||||
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
|
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
|
||||||
$version = $matches[1]
|
$version = "pre"+$matches[1]
|
||||||
echo "version=$version" >> $GITHUB_ENV
|
echo "version=$version" >> $GITHUB_ENV
|
||||||
echo "::set-output name=version::$version"
|
echo "::set-output name=version::$version"
|
||||||
break
|
break
|
||||||
|
1
.github/workflows/release.yaml
vendored
1
.github/workflows/release.yaml
vendored
@ -38,5 +38,6 @@ jobs:
|
|||||||
name: Release ${{ steps.extract_version.outputs.version }}
|
name: Release ${{ steps.extract_version.outputs.version }}
|
||||||
files: ./winutil.ps1
|
files: ./winutil.ps1
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
make_latest: "true"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -1,4 +1,37 @@
|
|||||||
## Known Issues and Fixes
|
## Known Issues and Fixes
|
||||||
|
|
||||||
|
### Launch Issues:
|
||||||
|
|
||||||
|
- Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
|
||||||
|
- If possible: Allow script in Anti-Virus software settings.
|
||||||
|
|
||||||
|
- If you are having TLS 1.2 issues, or are having trouble resolving `christitus.com/win` then run with the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;iex(New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1')
|
||||||
|
```
|
||||||
|
|
||||||
|
- If you are unable to resolve `christitus.com/win` and are getting errors launching the tool, it might be due to India blocking GitHub's content domain and preventing downloads.
|
||||||
|
- Source: <https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms>
|
||||||
|
|
||||||
|
If you are still having issues try using a **VPN**, or changing your **DNS provider** to:
|
||||||
|
|
||||||
|
| `1.1.1.1` | `1.0.0.1` | or | `8.8.8.8` | `8.8.4.4` |
|
||||||
|
|---------|---------|-----|---------|---------|
|
||||||
|
|
||||||
|
- Script doesn't run/PowerShell crashes:
|
||||||
|
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
|
||||||
|
2. Run:
|
||||||
|
```
|
||||||
|
Set-ExecutionPolicy Unrestricted -Scope Process -Force
|
||||||
|
```
|
||||||
|
3. Run:
|
||||||
|
```
|
||||||
|
irm christitus.com/win | iex
|
||||||
|
```
|
||||||
|
|
||||||
|
### Other Issues:
|
||||||
|
|
||||||
- Windows taking longer to shut down:
|
- Windows taking longer to shut down:
|
||||||
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) Turn on fast startup: Press Windows key + R, then type:
|
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) Turn on fast startup: Press Windows key + R, then type:
|
||||||
```
|
```
|
||||||
@ -16,6 +49,9 @@ Get-Service -Name "XboxGipSvc" | Set-Service -StartupType Automatic
|
|||||||
|
|
||||||
- Winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue
|
- Winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue
|
||||||
- (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
|
- (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
|
||||||
|
|
||||||
|
- Explorer no longer launches: Go to Control Panel, File Explorer Options, Change the 'Open File Explorer to' option to 'This PC'.
|
||||||
|
|
||||||
- Script doesn't run/PowerShell crashes:
|
- Script doesn't run/PowerShell crashes:
|
||||||
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
|
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
|
||||||
2. Run:
|
2. Run:
|
||||||
|
18
README.md
18
README.md
@ -34,6 +34,9 @@ If this site is not reachable from your country, please try running it directly
|
|||||||
irm "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1" | iex
|
irm "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1" | iex
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you still have Issues, refer to [Known Issues](https://github.com/ChrisTitusTech/winutil/blob/main/KnownIssues.md).
|
||||||
|
|
||||||
|
|
||||||
#### Automation
|
#### Automation
|
||||||
|
|
||||||
Some features are available through automation. This allows you to save your config file pass it to Winutil walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
Some features are available through automation. This allows you to save your config file pass it to Winutil walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
||||||
@ -52,21 +55,6 @@ iex "& { $(irm christitus.com/win) } -Config [path-to-your-config] -Run"
|
|||||||
7. Have a cup of coffee! Come back when it's done.
|
7. Have a cup of coffee! Come back when it's done.
|
||||||
|
|
||||||
|
|
||||||
## Issues:
|
|
||||||
|
|
||||||
- If you are unable to resolve christitus.com/win and are getting errors launching the tool, it might be due to India blocking GitHub's content domain and preventing downloads. You may use a VPN or change your DNS provider to Google/Cloudflare/etc.
|
|
||||||
|
|
||||||
Source: <https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms>
|
|
||||||
|
|
||||||
- Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
|
|
||||||
|
|
||||||
- If you are having TLS 1.2 issues, or are having trouble resolving `christitus.com/win` then run with the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;iex(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winutil.ps1')
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.0.1 or 8.8.8.8 || 8.8.4.4
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
- To morally and mentally support the project, make sure to leave a ⭐️!
|
- To morally and mentally support the project, make sure to leave a ⭐️!
|
||||||
|
@ -14,15 +14,19 @@ function Install-WinUtilChoco {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||||
|
|
||||||
Write-Host "Seems Chocolatey is not installed, installing now."
|
Write-Host "Seems Chocolatey is not installed, installing now."
|
||||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
||||||
powershell choco feature enable -n allowGlobalConfirmation
|
powershell choco feature enable -n allowGlobalConfirmation
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
|
|
||||||
}
|
}
|
||||||
Catch {
|
Catch {
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
Write-Host "===========================================" -Foregroundcolor Red
|
||||||
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
Write-Host "===========================================" -Foregroundcolor Red
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ function Install-WinUtilProgramChoco {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$x++
|
$x++
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value $using:x/$using:count })
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$X++
|
$X++
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value $using:x/$using:count })
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||||
return $failedPackages;
|
return $failedPackages;
|
||||||
|
@ -19,6 +19,8 @@ function Install-WinUtilWinget {
|
|||||||
Write-Host "`nWinget is not Installed. Continuing with install.`r" -ForegroundColor Red
|
Write-Host "`nWinget is not Installed. Continuing with install.`r" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||||
|
|
||||||
# Gets the computer's information
|
# Gets the computer's information
|
||||||
if ($null -eq $sync.ComputerInfo){
|
if ($null -eq $sync.ComputerInfo){
|
||||||
$ComputerInfo = Get-ComputerInfo -ErrorAction Stop
|
$ComputerInfo = Get-ComputerInfo -ErrorAction Stop
|
||||||
@ -63,4 +65,6 @@ function Install-WinUtilWinget {
|
|||||||
throw [WingetFailedInstall]::new('Failed to install!')
|
throw [WingetFailedInstall]::new('Failed to install!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ function Invoke-WinUtilFeatureInstall {
|
|||||||
$CheckBox
|
$CheckBox
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 1/$using:CheckBox.Count })
|
||||||
|
|
||||||
$CheckBox | ForEach-Object {
|
$CheckBox | ForEach-Object {
|
||||||
if($sync.configs.feature.$psitem.feature){
|
if($sync.configs.feature.$psitem.feature){
|
||||||
Foreach( $feature in $sync.configs.feature.$psitem.feature ){
|
Foreach( $feature in $sync.configs.feature.$psitem.feature ){
|
||||||
@ -23,6 +25,7 @@ function Invoke-WinUtilFeatureInstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
|
Set-WinUtilTaskbaritem -state "Error"
|
||||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
@ -36,6 +39,7 @@ function Invoke-WinUtilFeatureInstall {
|
|||||||
|
|
||||||
Write-Host "Running Script for $psitem"
|
Write-Host "Running Script for $psitem"
|
||||||
Invoke-Command $scriptblock -ErrorAction stop
|
Invoke-Command $scriptblock -ErrorAction stop
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
}
|
}
|
||||||
Catch{
|
Catch{
|
||||||
if ($psitem.Exception.Message -like "*requires elevation*"){
|
if ($psitem.Exception.Message -like "*requires elevation*"){
|
||||||
@ -43,6 +47,7 @@ function Invoke-WinUtilFeatureInstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
67
functions/private/Set-WinUtilTaskbarItem.ps1
Normal file
67
functions/private/Set-WinUtilTaskbarItem.ps1
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<#
|
||||||
|
|
||||||
|
.SYNOPSIS
|
||||||
|
Modifies the Taskbaritem of the WPF Form
|
||||||
|
|
||||||
|
.PARAMETER state & value
|
||||||
|
Value can be between 0 and 1, 0 being no progress done yet and 1 being fully completed
|
||||||
|
State can be 'None' > No progress, 'Indeterminate' > Without value, 'Normal' > when using value, 'Error' > Red (when using value), 'Paused' > Yellow (when using value)
|
||||||
|
|
||||||
|
.PARAMETER overlay
|
||||||
|
Overlay icon to display on the taskbar item
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Set-WinUtilTaskbaritem -value 0.5 -state "Normal"
|
||||||
|
Set-WinUtilTaskbaritem -state "Error"
|
||||||
|
Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||||
|
Set-WinUtilTaskbaritem -description "This is a description"
|
||||||
|
Set-WinUtilTaskbaritem -overlay "C:\path\to\icon.png"
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
|
||||||
|
function Set-WinUtilTaskbaritem {
|
||||||
|
param (
|
||||||
|
[double]$value,
|
||||||
|
$state,
|
||||||
|
$overlay,
|
||||||
|
$description
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($value) {
|
||||||
|
$sync["Form"].taskbarItemInfo.ProgressValue = $value
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($state) {
|
||||||
|
$sync["Form"].taskbarItemInfo.ProgressState = $state
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($overlay -and (Test-Path $overlay)) {
|
||||||
|
# Read the image file as a byte array
|
||||||
|
$imageBytes = [System.IO.File]::ReadAllBytes($overlay)
|
||||||
|
|
||||||
|
# Convert the byte array to a Base64 string
|
||||||
|
[System.Convert]::ToBase64String($imageBytes)
|
||||||
|
|
||||||
|
# Load the image file as a bitmap
|
||||||
|
$bitmap = [System.Drawing.Bitmap]::new($overlay)
|
||||||
|
|
||||||
|
# Create a streaming image by streaming the bitmap to a memory stream
|
||||||
|
$memoryStream = [System.IO.MemoryStream]::new()
|
||||||
|
$bitmap.Save($memoryStream, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||||
|
$memoryStream.Position = 0
|
||||||
|
|
||||||
|
# Create a bitmap image from the memory stream
|
||||||
|
$bitmapImage = [System.Windows.Media.Imaging.BitmapImage]::new()
|
||||||
|
$bitmapImage.BeginInit()
|
||||||
|
$bitmapImage.StreamSource = $memoryStream
|
||||||
|
$bitmapImage.EndInit()
|
||||||
|
$bitmapImage.Freeze()
|
||||||
|
|
||||||
|
$sync["Form"].taskbarItemInfo.Overlay = $bitmapImage
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($description) {
|
||||||
|
$sync["Form"].taskbarItemInfo.Description = $description
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@ function Invoke-WPFGetInstalled {
|
|||||||
param($checkbox, $DebugPreference)
|
param($checkbox, $DebugPreference)
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||||
|
|
||||||
if($checkbox -eq "winget"){
|
if($checkbox -eq "winget"){
|
||||||
Write-Host "Getting Installed Programs..."
|
Write-Host "Getting Installed Programs..."
|
||||||
@ -42,5 +43,6 @@ function Invoke-WPFGetInstalled {
|
|||||||
|
|
||||||
Write-Host "Done..."
|
Write-Host "Done..."
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "None" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.BusyText.Text="N Busy"
|
$sync.BusyText.Text="N Busy"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Write-Host " _ __ __ _ "
|
Write-Host " _ __ __ _ "
|
||||||
Write-Host " /\/\ (_) ___ _ __ ___ / / /\ \ \(_) _ __ "
|
Write-Host " /\/\ (_) ___ _ __ ___ / / /\ \ \(_) _ __ "
|
||||||
Write-Host " / \ | | / __|| '__| / _ \ \ \/ \/ /| || '_ \ "
|
Write-Host " / \ | | / __|| '__| / _ \ \ \/ \/ /| || '_ \ "
|
||||||
@ -88,6 +89,8 @@ function Invoke-WPFGetIso {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||||
|
|
||||||
# Detect the file size of the ISO and compare it with the free space of the system drive
|
# Detect the file size of the ISO and compare it with the free space of the system drive
|
||||||
$isoSize = (Get-Item -Path $filePath).Length
|
$isoSize = (Get-Item -Path $filePath).Length
|
||||||
Write-Debug "Size of ISO file: $($isoSize) bytes"
|
Write-Debug "Size of ISO file: $($isoSize) bytes"
|
||||||
@ -239,6 +242,7 @@ function Invoke-WPFGetIso {
|
|||||||
|
|
||||||
$sync.BusyMessage.Visibility="Hidden"
|
$sync.BusyMessage.Visibility="Hidden"
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
Set-WinUtilTaskbaritem -state "None"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,8 +20,10 @@ function Invoke-WPFInstall {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($PackagesToInstall, $DebugPreference)
|
param($PackagesToInstall, $DebugPreference)
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 1/$using:PackagesToInstall.Count })
|
||||||
$packagesWinget, $packagesChoco = {
|
$packagesWinget, $packagesChoco = {
|
||||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||||
@ -52,11 +54,13 @@ function Invoke-WPFInstall {
|
|||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "-- Installs have finished ---"
|
Write-Host "-- Installs have finished ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
}
|
}
|
||||||
Catch {
|
Catch {
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "Error: $_"
|
Write-Host "Error: $_"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
}
|
}
|
||||||
Start-Sleep -Seconds 5
|
Start-Sleep -Seconds 5
|
||||||
$sync.ProcessRunning = $False
|
$sync.ProcessRunning = $False
|
||||||
|
@ -4,6 +4,7 @@ function Invoke-WPFMicrowin {
|
|||||||
Invoke MicroWin routines...
|
Invoke MicroWin routines...
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
||||||
if($sync.ProcessRunning) {
|
if($sync.ProcessRunning) {
|
||||||
$msg = "GetIso process is currently running."
|
$msg = "GetIso process is currently running."
|
||||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||||
@ -42,6 +43,8 @@ public class PowerManagement {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||||
|
|
||||||
Write-Host "Target ISO location: $($SaveDialog.FileName)"
|
Write-Host "Target ISO location: $($SaveDialog.FileName)"
|
||||||
|
|
||||||
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
||||||
@ -477,5 +480,6 @@ public class PowerManagement {
|
|||||||
# Allow the machine to sleep again (optional)
|
# Allow the machine to sleep again (optional)
|
||||||
[PowerManagement]::SetThreadExecutionState(0)
|
[PowerManagement]::SetThreadExecutionState(0)
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
Set-WinUtilTaskbaritem -state "None"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,8 +29,10 @@ function Invoke-WPFUnInstall {
|
|||||||
|
|
||||||
if($confirm -eq "No"){return}
|
if($confirm -eq "No"){return}
|
||||||
|
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($PackagesToInstall, $DebugPreference)
|
param($PackagesToInstall, $DebugPreference)
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 1/$using:PackagesToInstall.Count })
|
||||||
$packagesWinget, $packagesChoco = {
|
$packagesWinget, $packagesChoco = {
|
||||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||||
@ -66,11 +68,13 @@ function Invoke-WPFUnInstall {
|
|||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "-- Uninstalls have finished ---"
|
Write-Host "-- Uninstalls have finished ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
}
|
}
|
||||||
Catch {
|
Catch {
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "Error: $_"
|
Write-Host "Error: $_"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
}
|
}
|
||||||
$sync.ProcessRunning = $False
|
$sync.ProcessRunning = $False
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,18 @@ function Invoke-WPFtweaksbutton {
|
|||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
|
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 1/$Tweaks.Count })
|
||||||
$cnt = 0
|
$cnt = 0
|
||||||
# Execute other selected tweaks
|
# Execute other selected tweaks
|
||||||
foreach ($tweak in $Tweaks) {
|
foreach ($tweak in $Tweaks) {
|
||||||
Write-Debug "This is a tweak to run $tweak count: $cnt"
|
Write-Debug "This is a tweak to run $tweak count: $cnt"
|
||||||
Invoke-WinUtilTweaks $tweak
|
Invoke-WinUtilTweaks $tweak
|
||||||
$cnt += 1
|
$cnt += 1
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($using:cnt/$using:Tweaks.Count)})
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
Write-Host "================================="
|
Write-Host "================================="
|
||||||
Write-Host "-- Tweaks are Finished ---"
|
Write-Host "-- Tweaks are Finished ---"
|
||||||
Write-Host "================================="
|
Write-Host "================================="
|
||||||
|
@ -24,12 +24,14 @@ function Invoke-WPFundoall {
|
|||||||
param($Tweaks, $DebugPreference)
|
param($Tweaks, $DebugPreference)
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
|
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value $using:Tweaks.Count })
|
||||||
|
|
||||||
Foreach ($tweak in $tweaks){
|
Foreach ($tweak in $tweaks){
|
||||||
Invoke-WinUtilTweaks $tweak -undo $true
|
Invoke-WinUtilTweaks $tweak -undo $true
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||||
Write-Host "=================================="
|
Write-Host "=================================="
|
||||||
Write-Host "--- Undo Tweaks are Finished ---"
|
Write-Host "--- Undo Tweaks are Finished ---"
|
||||||
Write-Host "=================================="
|
Write-Host "=================================="
|
||||||
|
@ -153,6 +153,16 @@ Invoke-WPFRunspace -ScriptBlock {
|
|||||||
# Print the logo
|
# Print the logo
|
||||||
Invoke-WPFFormVariables
|
Invoke-WPFFormVariables
|
||||||
|
|
||||||
|
# download the logo
|
||||||
|
$logoUrl = "https://christitus.com/images/logo-full.png"
|
||||||
|
# Download the image
|
||||||
|
$logoPath = "$env:TEMP\cttlogo.png"
|
||||||
|
Invoke-WebRequest -Uri $logoUrl -OutFile $logoPath
|
||||||
|
|
||||||
|
# Progress bar in taskbaritem > Set-WinUtilProgressbar
|
||||||
|
$sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo
|
||||||
|
Set-WinUtilTaskbaritem -state "None"
|
||||||
|
|
||||||
# Set the titlebar
|
# Set the titlebar
|
||||||
$sync["Form"].title = $sync["Form"].title + " " + $sync.version
|
$sync["Form"].title = $sync["Form"].title + " " + $sync.version
|
||||||
# Set the commands that will run when the form is closed
|
# Set the commands that will run when the form is closed
|
||||||
@ -287,37 +297,8 @@ 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
|
# Set the overlay icon for the taskbar
|
||||||
$sync["Form"].TaskbarItemInfo.Overlay = $bitmap
|
Set-WinUtilTaskbaritem -overlay $logoPath
|
||||||
|
|
||||||
|
|
||||||
$rect = New-Object RECT
|
$rect = New-Object RECT
|
||||||
[Window]::GetWindowRect($windowHandle, [ref]$rect)
|
[Window]::GetWindowRect($windowHandle, [ref]$rect)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
function Get-LatestRelease {
|
function Get-LatestRelease {
|
||||||
try {
|
try {
|
||||||
$releases = Invoke-RestMethod -Uri 'https://api.github.com/repos/ChrisTitusTech/winutil/releases'
|
$releases = Invoke-RestMethod -Uri 'https://api.github.com/repos/ChrisTitusTech/winutil/releases'
|
||||||
$latestRelease = $releases | Select-Object -First 1
|
$latestRelease = $releases | Where-Object {$_.prerelease -eq $true} | Select-Object -First 1
|
||||||
return $latestRelease.tag_name
|
return $latestRelease.tag_name
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "Error fetching release data: $_" -ForegroundColor Red
|
Write-Host "Error fetching release data: $_" -ForegroundColor Red
|
||||||
|
12123
winutil.ps1
12123
winutil.ps1
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user