Compare commits

..

21 Commits

Author SHA1 Message Date
Meenbeese
d4dc9aec9b
Attempt to simplify the launch command (#2214) 2024-06-28 18:29:28 -05:00
ChrisTitusTech
e4d0e16b26 Compile Winutil 2024-06-28 23:29:10 +00:00
Mr.k
d6102e8954
Add 'OFGB (Oh Frick Go Back)' App into 'applications.json' File (#2213) 2024-06-28 18:28:46 -05:00
ChrisTitusTech
227cb21c24 Compile Winutil 2024-06-28 22:16:05 +00:00
Mr.k
1891ea7966
Remove trailing whitespace characters (#2149)
* Remove All Trailing Whitespace Characters in '.ps1' Files

* Remove All Trailing Whitespace Characters in '.json' Files

* Remove All Trailing Whitespace Characters in '.yaml' Files

* Remove All Trailing Whitespace Characters in Different Files

* Remove Even More Trailing Whitespace Characters
2024-06-28 17:15:39 -05:00
ChrisTitusTech
6c49a8f2c9 Compile Winutil 2024-06-28 22:02:55 +00:00
Martin Wiethan
ab384029f1
Replace Where-Object with .where Method (#2212)
* initialize Windev branch

* Formatting

* more Formatting

* fix applications

* init

* remove timer

* Compile Winutil

* revert winutil.ps1

* revert winutil.ps1

* update Get Winutilvariables to use .where method

---------

Co-authored-by: Marterich <Marterich@users.noreply.github.com>
2024-06-28 17:02:32 -05:00
Mr.k
0c32d016b4
Compiler simple improvements and remove app prefix from app list (#2117)
* Re-formate Comments to be a bit Clear-er

* Add New Helper Function to be an Interface for writing Progress Bar when Compiling

* Remove the Need to add 'WPFInstall' for every App Entry Name in 'applications.json' File

* Add 'ValidateRange' to 'Percent' Parameter for 'Update-Progress' Helper Function

This will insure that the passed value is neither below zero nor higher than 100

Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com>

* Remove the 'WPFInstall' prefix for several newly added apps

---------

Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com>
2024-06-28 16:59:38 -05:00
ChrisTitusTech
45818fd80c Compile Winutil 2024-06-28 21:27:55 +00:00
Roshan Studley
d08954945c
Add 'voicemeeter potato' and 'windowgrid' to 'applications.json' (#2190)
* Add Voicemeeter Potato

* add WindowGrid

---------

Co-authored-by: Roshan Studley <OnyxAbove@users.noreply.github.com>
2024-06-28 16:27:34 -05:00
ChrisTitusTech
a7ab24e3c9 Compile Winutil 2024-06-28 21:24:06 +00:00
Mr.k
a924d91d65
Fix New Line Character for 'winutil.ps1' File (#2150)
* Change New Line Character from LF to CRLF in 'Get-TabXaml.ps1' Private Function

* Update '.gitattributes' File

Provide stricter rules to be used for multiple file types in the repo.
2024-06-28 16:23:41 -05:00
Mr.k
676e46f59f
Add New Escape Character 'Em Dash' to 'Compile.ps1' File (#2153)
This will Insure that an App Entry can use the '—' Character (aka. the 'Em Dash' Character) in their Content (Title) and Description Fields without any worries.
2024-06-28 16:23:21 -05:00
Martin Wiethan
37b9c552df
Rework OneDrive removal Tweak (#2155)
* Revamp Onedrive Tweak

* fixes Description

* Add Reg key to Cleanup and Errorhandling
2024-06-28 16:23:05 -05:00
Martin Wiethan
2e12176b2d
Create Windev.ps1 loader (#2210)
* initialize Windev branch

* Formatting

* more Formatting
2024-06-28 16:13:12 -05:00
Real-MullaC
7d1e4a8d82
Update README.md (#2209)
Added automated release number.
2024-06-28 16:09:05 -05:00
ChrisTitusTech
4f8e7a8ea7 Compile Winutil 2024-06-28 21:08:42 +00:00
Mr.k
6c4c24b26d
Change WinGet ID for 'Fastfetch' to be 'Fastfetch-cli.Fastfetch' instead of 'fastfetch' (#2204)
This will insure no ambiguity would happen in the near future for this App Entry.
2024-06-28 16:08:08 -05:00
Ikko Eltociear Ashimine
d205e75030
docs: update README.md (#2203)
avaliable -> available
2024-06-28 16:07:42 -05:00
ChrisTitusTech
12561aba2c Compile Winutil 2024-06-28 21:06:13 +00:00
Chris Titus
84fd1bc71c Update applications.json 2024-06-28 16:05:52 -05:00
41 changed files with 1437 additions and 1173 deletions

11
.gitattributes vendored
View File

@ -1,3 +1,12 @@
* text=auto
*.ps1 text eol=crlf
*.json text eol=crlf
*.cfg text eol=crlf
*.png binary
*.jpg binary
config/* diff config/* diff
config/applications.json diff config/applications.json diff
*.json diff *.json diff

View File

@ -15,7 +15,7 @@ jobs:
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Extract Version from winutil.ps1 - name: Extract Version from winutil.ps1
id: extract_version id: extract_version
run: | run: |

View File

@ -11,7 +11,7 @@ jobs:
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Extract Version from winutil.ps1 - name: Extract Version from winutil.ps1
id: extract_version id: extract_version
run: | run: |

View File

@ -1,7 +1,7 @@
name: Unit Tests name: Unit Tests
on: on:
push: push:
jobs: jobs:
lint: lint:
@ -34,7 +34,7 @@ jobs:
run: | run: |
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
Invoke-Pester -Path 'pester/*.Tests.ps1' -Output Detailed Invoke-Pester -Path 'pester/*.Tests.ps1' -Output Detailed
shell: pwsh shell: pwsh
env: env:
TEMP: ${{ runner.temp }} TEMP: ${{ runner.temp }}

View File

@ -10,6 +10,22 @@ $sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot $sync.PSScriptRoot = $PSScriptRoot
$sync.configs = @{} $sync.configs = @{}
function Update-Progress {
param (
[Parameter(Mandatory, position=0)]
[string]$StatusMessage,
[Parameter(Mandatory, position=1)]
[ValidateRange(0,100)]
[int]$Percent,
[Parameter(position=2)]
[string]$Activity = "Compiling"
)
Write-Progress -Activity $Activity -Status $StatusMessage -PercentComplete $Percent
}
$header = @" $header = @"
################################################################################################################ ################################################################################################################
### ### ### ###
@ -18,48 +34,64 @@ $header = @"
################################################################################################################ ################################################################################################################
"@ "@
# Create the script in memory. # Create the script in memory.
Update-Progress "Pre-req: Allocating Memory" 0
$script_content = [System.Collections.Generic.List[string]]::new() $script_content = [System.Collections.Generic.List[string]]::new()
Write-Progress -Activity "Compiling" -Status "Adding: Header" -PercentComplete 5 Update-Progress "Adding: Header" 5
$script_content.Add($header) $script_content.Add($header)
Write-Progress -Activity "Compiling" -Status "Adding: Version" -PercentComplete 10 Update-Progress "Adding: Version" 10
$script_content.Add($(Get-Content .\scripts\start.ps1).replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)")) $script_content.Add($(Get-Content .\scripts\start.ps1).replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)"))
Write-Progress -Activity "Compiling" -Status "Adding: Functions" -PercentComplete 20 Update-Progress "Adding: Functions" 20
Get-ChildItem .\functions -Recurse -File | ForEach-Object { Get-ChildItem .\functions -Recurse -File | ForEach-Object {
$script_content.Add($(Get-Content $psitem.FullName)) $script_content.Add($(Get-Content $psitem.FullName))
} }
Write-Progress -Activity "Compiling" -Status "Adding: Config *.json" -PercentComplete 40 Update-Progress "Adding: Config *.json" 40
Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object { Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
$json = (Get-Content $psitem.FullName).replace("'","''") $json = (Get-Content $psitem.FullName).replace("'","''")
# Replace every XML Special Character so it'll render correctly in final build # Replace every XML Special Character so it'll render correctly in final build
# Only do so if json files has content to be displayed (for example the applications, tweaks, features json files) # Only do so if json files has content to be displayed (for example the applications, tweaks, features json files)
# Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method # Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method
$jsonAsObject = $json | convertfrom-json $jsonAsObject = $json | convertfrom-json
$firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object { $firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object {
$_.Replace('=}','').Replace('@{','').Replace(' ','') $_.Replace('=}','').Replace('@{','').Replace(' ','')
} }
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) { # Note:
# Avoid using HTML Entity Codes, for example '&rdquo;' (stands for "Right Double Quotation Mark"),
# Use **HTML decimal/hex codes instead**, as using HTML Entity Codes will result in XML parse Error when running the compiled script.
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
$firstLevelName = $firstLevelJsonList[$i] $firstLevelName = $firstLevelJsonList[$i]
# Note: Avoid using HTML Entity Codes (for example '&rdquo;' (stands for "Right Double Quotation Mark")), and use HTML decimal/hex codes instead.
# as using HTML Entity Codes will result in XML parse Error when running the compiled script.
if ($jsonAsObject.$firstLevelName.content -ne $null) { if ($jsonAsObject.$firstLevelName.content -ne $null) {
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;') $jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;').replace('—','&#8212;')
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop $jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop
} }
if ($jsonAsObject.$firstLevelName.description -ne $null) { if ($jsonAsObject.$firstLevelName.description -ne $null) {
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;') $jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;').replace('—','&#8212;')
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop $jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop
} }
} }
# The replace at the end is required, as without it the output of converto-json will be somewhat weird for Multiline String
# Most Notably is the scripts in json files, making it harder for users who want to review these scripts that are found in the final compiled script # Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n") if ($psitem.Name -eq "applications.json") {
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
$appEntryName = $firstLevelJsonList[$i]
$appEntryContent = $jsonAsObject.$appEntryName
# Remove the entire app entry, so we could add it later with a different name
$jsonAsObject.PSObject.Properties.Remove($appEntryName)
# Add the app entry, but with a different name (WPFInstall + The App Entry Name)
$jsonAsObject | Add-Member -MemberType NoteProperty -Name "WPFInstall$appEntryName" -Value $appEntryContent
}
}
# The replace at the end is required, as without it the output of 'converto-json' will be somewhat weird for Multiline Strings
# Most Notably is the scripts in some json files, making it harder for users who want to review these scripts, which're found in the compiled script
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json $sync.configs.$($psitem.BaseName) = $json | convertfrom-json
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" )) $script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
@ -70,13 +102,13 @@ $xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")
# Dot-source the Get-TabXaml function # Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1 . .\functions\private\Get-TabXaml.ps1
Write-Progress -Activity "Compiling" -Status "Building: Xaml " -PercentComplete 75 Update-Progress "Building: Xaml " 75
$appXamlContent = Get-TabXaml "applications" 5 $appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks" $tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature" $featuresXamlContent = Get-TabXaml "feature"
Write-Progress -Activity "Compiling" -Status "Adding: Xaml " -PercentComplete 90 Update-Progress "Adding: Xaml " 90
# Replace the placeholder in $inputXML with the content of inputApp.xaml # Replace the placeholder in $inputXML with the content of inputApp.xaml
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent $xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent $xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
@ -87,13 +119,13 @@ $script_content.Add($(Write-output "`$inputXML = '$xaml'"))
$script_content.Add($(Get-Content .\scripts\main.ps1)) $script_content.Add($(Get-Content .\scripts\main.ps1))
if ($Debug){ if ($Debug){
Write-Progress -Activity "Compiling" -Status "Writing debug files" -PercentComplete 95 Update-Progress "Writing debug files" 95
$appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii $appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii
$tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii $tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
$featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii $featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
} }
else { else {
Write-Progress -Activity "Compiling" -Status "Removing temporary files" -PercentComplete 99 Update-Progress "Removing temporary files" 99
Remove-Item ".\xaml\inputApp.xaml" -ErrorAction SilentlyContinue Remove-Item ".\xaml\inputApp.xaml" -ErrorAction SilentlyContinue
Remove-Item ".\xaml\inputTweaks.xaml" -ErrorAction SilentlyContinue Remove-Item ".\xaml\inputTweaks.xaml" -ErrorAction SilentlyContinue
Remove-Item ".\xaml\inputFeatures.xaml" -ErrorAction SilentlyContinue Remove-Item ".\xaml\inputFeatures.xaml" -ErrorAction SilentlyContinue
@ -109,5 +141,5 @@ if ($run){
catch { catch {
Start-Process -FilePath "powershell" -ArgumentList ".\$scriptname" Start-Process -FilePath "powershell" -ArgumentList ".\$scriptname"
} }
} }

View File

@ -1,6 +1,8 @@
# Chris Titus Tech's Windows Utility # Chris Titus Tech's Windows Utility
This utility is a compilation of Windows tasks I perform on each Windows system I use. It is meant to streamline *installs*, debloat with *tweaks*, troubleshoot with *config*, and fix Windows *updates*. I am extremely picky about any contributions to keep this project clean and efficient. [![Version](https://img.shields.io/github/v/release/ChrisTitusTech/winutil?color=7a39fb)](https://github.com/ChrisTitusTech/winutil/releases/latest)
This utility is a compilation of Windows tasks I perform on each Windows system I use. It is meant to streamline *installs*, debloat with *tweaks*, troubleshoot with *config*, and fix Windows *updates*. I am extremely picky about any contributions to keep this project clean and efficient.
![screen-install](screen-install.png) ![screen-install](screen-install.png)
@ -22,24 +24,19 @@ Winutil must be run in Admin mode because it performs system-wide tweaks. To ach
#### Simple way #### Simple way
```ps1
irm "https://christitus.com/win" | iex
``` ```
irm https://christitus.com/win | iex Courtesy of the issue: [#144](/../../issues/144)
```
Courtesy of the issue raised at: [#144](/../../issues/144)
or by executing: If this site is not reachable from your country, please try running it directly from GitHub.
``` ```ps1
iwr -useb https://christitus.com/win | iex
```
if for some reason this site is not reachable from your country please try running it directly from github.
```
irm "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1" | iex irm "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1" | iex
``` ```
#### Automation #### Automation
Some features are avaliable 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
1. On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system 1. On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system
![GetInstalled](/wiki/Get-Installed.png) ![GetInstalled](/wiki/Get-Installed.png)
@ -83,15 +80,15 @@ If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.
- Install - Install
- Install Selection: Organize programs by category and facilitate installation by enabling users to select programs and initiate the installation process with a single click. - Install Selection: Organize programs by category and facilitate installation by enabling users to select programs and initiate the installation process with a single click.
- Upgrade All: Upgrade all existing programs to their latest versions, ensuring users have the most up-to-date and feature-rich software. - Upgrade All: Upgrade all existing programs to their latest versions, ensuring users have the most up-to-date and feature-rich software.
- Uninstall Selection: Effortlessly uninstall selected programs, providing users with a streamlined way to remove unwanted software from their system. - Uninstall Selection: Effortlessly uninstall selected programs, providing users with a streamlined way to remove unwanted software from their system.
- Get Installed: Retrieve a comprehensive list of installed programs on the system, offering users visibility into the software currently installed on their computer. - Get Installed: Retrieve a comprehensive list of installed programs on the system, offering users visibility into the software currently installed on their computer.
- Import / Export: Enable users to import or export the selection list of programs, allowing them to save their preferred program configurations or share them with others. This feature promotes convenience and flexibility in managing program selections across different systems. - Import / Export: Enable users to import or export the selection list of programs, allowing them to save their preferred program configurations or share them with others. This feature promotes convenience and flexibility in managing program selections across different systems.
- Tweaks - Tweaks
- Recommended Selection: Provides pre-defined templates tailored for desktop, laptop, and minimal configurations, allowing users to select recommended settings and optimizations specific to their system type. - Recommended Selection: Provides pre-defined templates tailored for desktop, laptop, and minimal configurations, allowing users to select recommended settings and optimizations specific to their system type.
@ -113,7 +110,7 @@ If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.
- Updates: - Updates:
- Default (Out of Box) Settings: Provides the default settings that come with Windows for updates. - Default (Out of Box) Settings: Provides the default settings that come with Windows for updates.
- Security (Recommended) Settings: Offers recommended settings, including a slight delay of feature updates by 2 years and installation of security updates 4 days after release. - Security (Recommended) Settings: Offers recommended settings, including a slight delay of feature updates by 2 years and installation of security updates 4 days after release.
- Disable All Updates (Not Recommended!): Allows users to disable all Windows updates, but it's not recommended due to potential security risks. - Disable All Updates (Not Recommended!): Allows users to disable all Windows updates, but it's not recommended due to potential security risks.
@ -127,7 +124,7 @@ If you encounter any challenges or problems with the script, I kindly request th
## Contribute Code ## Contribute Code
Pull Requests are now handled directly on the MAIN branch. This was done since we can now select specific releases to launch via releases in GitHub. Pull Requests are now handled directly on the MAIN branch. This was done since we can now select specific releases to launch via releases in GitHub.
If doing a code change and you can submit a PR to main branch, but I am very selective about these. Do not use a code formatter, massive amounts of line changes, and make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN Pull Request! If doing a code change and you can submit a PR to main branch, but I am very selective about these. Do not use a code formatter, massive amounts of line changes, and make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN Pull Request!

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
"MainBackgroundColor": "#FFFFFF", "MainBackgroundColor": "#FFFFFF",
"LabelBackgroundColor": "#FAFAFA", "LabelBackgroundColor": "#FAFAFA",
"LinkForegroundColor": "#000000", "LinkForegroundColor": "#000000",
"LinkHoverForegroundColor": "#000000", "LinkHoverForegroundColor": "#000000",
"GroupBorderBackgroundColor": "#000000", "GroupBorderBackgroundColor": "#000000",
"ComboBoxForegroundColor": "#000000", "ComboBoxForegroundColor": "#000000",
"ButtonInstallBackgroundColor": "#FFFFFF", "ButtonInstallBackgroundColor": "#FFFFFF",
@ -31,7 +31,7 @@
"BorderColor": "#000000", "BorderColor": "#000000",
"BorderOpacity": "0.2", "BorderOpacity": "0.2",
"ShadowPulse": "Forever" "ShadowPulse": "Forever"
}, },
"Matrix": { "Matrix": {
"ComboBoxBackgroundColor": "#000000", "ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58", "LabelboxForegroundColor": "#FFEE58",

View File

@ -84,7 +84,7 @@
" "
Write-Host \"Turn on Hibernation\" Write-Host \"Turn on Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait
# Set hibernation as the default action # Set hibernation as the default action
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait
@ -96,14 +96,14 @@
" "
Write-Host \"Turn off Hibernation\" Write-Host \"Turn off Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait
# Set standby to detault values # Set standby to detault values
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait
" "
] ]
}, },
"WPFTweaksHome": { "WPFTweaksHome": {
"Content": "Disable Homegroup", "Content": "Disable Homegroup",
@ -2245,7 +2245,7 @@
Write-Host \"Please run this script as an administrator.\" Write-Host \"Please run this script as an administrator.\"
return return
} }
# Check if System Restore is enabled for the main drive # Check if System Restore is enabled for the main drive
try { try {
# Try getting restore points to check if System Restore is enabled # Try getting restore points to check if System Restore is enabled
@ -2253,14 +2253,14 @@
} catch { } catch {
Write-Host \"An error occurred while enabling System Restore: $_\" Write-Host \"An error occurred while enabling System Restore: $_\"
} }
# Check if the SystemRestorePointCreationFrequency value exists # Check if the SystemRestorePointCreationFrequency value exists
$exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue $exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue
if($null -eq $exists){ if($null -eq $exists){
write-host 'Changing system to allow multiple restore points per day' write-host 'Changing system to allow multiple restore points per day'
Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null
} }
# Attempt to load the required module for Get-ComputerRestorePoint # Attempt to load the required module for Get-ComputerRestorePoint
try { try {
Import-Module Microsoft.PowerShell.Management -ErrorAction Stop Import-Module Microsoft.PowerShell.Management -ErrorAction Stop
@ -2268,7 +2268,7 @@
Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\" Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\"
return return
} }
# Get all the restore points for the current day # Get all the restore points for the current day
try { try {
$existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date } $existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date }
@ -2276,11 +2276,11 @@
Write-Host \"Failed to retrieve restore points: $_\" Write-Host \"Failed to retrieve restore points: $_\"
return return
} }
# Check if there is already a restore point created today # Check if there is already a restore point created today
if ($existingRestorePoints.Count -eq 0) { if ($existingRestorePoints.Count -eq 0) {
$description = \"System Restore Point created by WinUtil\" $description = \"System Restore Point created by WinUtil\"
Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\" Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\"
Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\" Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\"
} }
@ -2358,7 +2358,7 @@
"Order": "a025_", "Order": "a025_",
"registry": [ "registry": [
{ {
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot", "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot",
"Name": "TurnOffWindowsCopilot", "Name": "TurnOffWindowsCopilot",
"Type": "DWord", "Type": "DWord",
@ -2383,7 +2383,7 @@
"InvokeScript": [ "InvokeScript": [
" "
Write-Host \"Remove Copilot\" Write-Host \"Remove Copilot\"
dism /online /remove-package /package-name:Microsoft.Windows.Copilot dism /online /remove-package /package-name:Microsoft.Windows.Copilot
" "
], ],
"UndoScript": [ "UndoScript": [
@ -2402,11 +2402,11 @@
"InvokeScript": [ "InvokeScript": [
" "
Write-Host \"Kill LMS\" Write-Host \"Kill LMS\"
$serviceName = \"LMS\" $serviceName = \"LMS\"
Write-Host \"Stopping and disabling service: $serviceName\" Write-Host \"Stopping and disabling service: $serviceName\"
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue; Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue;
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue; Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue;
Write-Host \"Removing service: $serviceName\"; Write-Host \"Removing service: $serviceName\";
sc.exe delete $serviceName; sc.exe delete $serviceName;
@ -2421,7 +2421,7 @@
} else { } else {
Write-Host \"All found LMS driver packages have been removed.\"; Write-Host \"All found LMS driver packages have been removed.\";
} }
Write-Host \"Searching and deleting LMS executable files\"; Write-Host \"Searching and deleting LMS executable files\";
$programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\"); $programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\");
$lmsFiles = @(); $lmsFiles = @();
@ -2439,7 +2439,7 @@
Write-Host \"No LMS.exe files found in Program Files directories.\"; Write-Host \"No LMS.exe files found in Program Files directories.\";
} else { } else {
Write-Host \"All found LMS.exe files have been deleted.\"; Write-Host \"All found LMS.exe files have been deleted.\";
} }
Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.'; Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.';
" "
], ],
@ -2449,82 +2449,95 @@
" "
] ]
}, },
"WPFTweaksRemoveOnedrive": { "WPFTweaksRemoveOnedrive": {
"Content": "Remove OneDrive", "Content": "Remove OneDrive",
"Description": "Copies OneDrive files to Default Home Folders and Uninstalls it.", "Description": "Moves OneDrive files to Default Home Folders and Uninstalls it.",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",
"panel": "1", "panel": "1",
"Order": "a030_", "Order": "a030_",
"InvokeScript": [ "InvokeScript": [
" "
$OneDrivePath = $($env:OneDrive)
Write-Host \"Removing OneDrive\"
$regPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OneDriveSetup.exe\"
if (Test-Path $regPath){
$OneDriveUninstallString = Get-ItemPropertyValue \"$regPath\" -Name \"UninstallString\"
$OneDriveExe, $OneDriveArgs = $OneDriveUninstallString.Split(\" \")
Start-Process -FilePath $OneDriveExe -ArgumentList \"$OneDriveArgs /silent\" -NoNewWindow -Wait
}
else{
Write-Host \"Onedrive dosn't seem to be installed anymore\" -ForegroundColor Red
return
}
# Check if OneDrive got Uninstalled
if (-not (Test-Path $regPath)){
Write-Host \"Copy downloaded Files from the OneDrive Folder to Root UserProfile\"
Start-Process -FilePath powershell -ArgumentList \"robocopy '$($OneDrivePath)' '$($env:USERPROFILE.TrimEnd())\\' /mov /e /xj\" -NoNewWindow -Wait
Write-Host \"Kill OneDrive process\" Write-Host \"Removing OneDrive leftovers\"
taskkill.exe /F /IM \"OneDrive.exe\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
taskkill.exe /F /IM \"explorer.exe\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\OneDrive\" -f
# check if directory is empty before removing:
If ((Get-ChildItem \"$OneDrivePath\" -Recurse | Measure-Object).Count -eq 0) {
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$OneDrivePath\"
}
Write-Host \"Copy all OneDrive to Root UserProfile\" Write-Host \"Remove Onedrive from explorer sidebar\"
Start-Process -FilePath powershell -ArgumentList \"robocopy '$($env:USERPROFILE.TrimEnd())\\OneDrive' '$($env:USERPROFILE.TrimEnd())\\' /e /xj\" -NoNewWindow -Wait Set-ItemProperty -Path \"HKCR:\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
Set-ItemProperty -Path \"HKCR:\\Wow6432Node\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
Write-Host \"Remove OneDrive\" Write-Host \"Removing run hook for new users\"
Start-Process -FilePath winget -ArgumentList \"uninstall -e --purge --force --silent Microsoft.OneDrive \" -NoNewWindow -Wait reg load \"hku\\Default\" \"C:\\Users\\Default\\NTUSER.DAT\"
reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f
reg unload \"hku\\Default\"
Write-Host \"Removing OneDrive leftovers\" Write-Host \"Removing startmenu entry\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\" Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
# check if directory is empty before removing:
If ((Get-ChildItem \"$env:userprofile\\OneDrive\" -Recurse | Measure-Object).Count -eq 0) {
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:userprofile\\OneDrive\"
}
Write-Host \"Remove Onedrive from explorer sidebar\" Write-Host \"Removing scheduled task\"
Set-ItemProperty -Path \"HKCR:\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0 Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
Set-ItemProperty -Path \"HKCR:\\Wow6432Node\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
Write-Host \"Removing run hook for new users\" # Add Shell folders restoring default locations
reg load \"hku\\Default\" \"C:\\Users\\Default\\NTUSER.DAT\" Write-Host \"Shell Fixing\"
reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"AppData\" -Value \"$env:userprofile\\AppData\\Roaming\" -Type ExpandString
reg unload \"hku\\Default\" Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cache\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCache\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cookies\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCookies\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Favorites\" -Value \"$env:userprofile\\Favorites\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"History\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\History\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Local AppData\" -Value \"$env:userprofile\\AppData\\Local\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Music\" -Value \"$env:userprofile\\Music\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Video\" -Value \"$env:userprofile\\Videos\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"NetHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"PrintHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Printer Shortcuts\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Programs\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Recent\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Recent\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"SendTo\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\SendTo\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Start Menu\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Startup\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Templates\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Templates\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{374DE290-123F-4565-9164-39C4925E467B}\" -Value \"$env:userprofile\\Downloads\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Desktop\" -Value \"$env:userprofile\\Desktop\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Pictures\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Personal\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{F42EE2D3-909F-4907-8871-4C22FC0BF756}\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{0DDD015D-B06C-45D5-8C4C-F59713854639}\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
Write-Host \"Restarting explorer\"
taskkill.exe /F /IM \"explorer.exe\"
Start-Process \"explorer.exe\"
Write-Host \"Removing startmenu entry\" Write-Host \"Waiting for explorer to complete loading\"
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\" Write-Host \"Please Note - The OneDrive folder at $OneDrivePath may still have items in it. You must manually delete it, but all the files should already be copied to the base user folder.\"
Write-Host \"If there are Files missing afterwards, please Login to Onedrive.com and Download them manually\" -ForegroundColor Yellow
Write-Host \"Removing scheduled task\" Start-Sleep 5
Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false }
else{
# Add Shell folders restoring default locations Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red
Write-Host \"Shell Fixing\" }
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"AppData\" -Value \"$env:userprofile\\AppData\\Roaming\" -Type ExpandString "
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cache\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCache\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cookies\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCookies\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Favorites\" -Value \"$env:userprofile\\Favorites\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"History\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\History\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Local AppData\" -Value \"$env:userprofile\\AppData\\Local\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Music\" -Value \"$env:userprofile\\Music\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Video\" -Value \"$env:userprofile\\Videos\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"NetHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"PrintHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Printer Shortcuts\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Programs\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Recent\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Recent\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"SendTo\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\SendTo\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Start Menu\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Startup\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Templates\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Templates\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{374DE290-123F-4565-9164-39C4925E467B}\" -Value \"$env:userprofile\\Downloads\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Desktop\" -Value \"$env:userprofile\\Desktop\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Pictures\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Personal\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{F42EE2D3-909F-4907-8871-4C22FC0BF756}\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{0DDD015D-B06C-45D5-8C4C-F59713854639}\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
Write-Host \"Restarting explorer\"
Start-Process \"explorer.exe\"
Write-Host \"Waiting for explorer to complete loading\"
Write-Host \"Please Note - OneDrive folder may still have items in it. You must manually delete it, but all the files should already be copied to the base user folder.\"
Start-Sleep 5
"
], ],
"UndoScript": [ "UndoScript": [
" "
@ -2561,25 +2574,25 @@
"Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates", "Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",
"panel": "1", "panel": "1",
"Order": "a021_", "Order": "a021_",
"InvokeScript": [ "InvokeScript": [
" "
function CCStopper { function CCStopper {
$path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\" $path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
# Test if the path exists before proceeding # Test if the path exists before proceeding
if (Test-Path $path) { if (Test-Path $path) {
Takeown /f $path Takeown /f $path
$acl = Get-Acl $path $acl = Get-Acl $path
$acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\") $acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\")
$acl | Set-Acl $path $acl | Set-Acl $path
Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force
} else { } else {
Write-Host \"Adobe Desktop Service is not in the default location.\" Write-Host \"Adobe Desktop Service is not in the default location.\"
} }
} }
function AcrobatUpdates { function AcrobatUpdates {
# Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script. # Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script.
@ -2589,12 +2602,12 @@
# 3 = Automatically download and install updates (default value) # 3 = Automatically download and install updates (default value)
# 4 = Notify the user when an update is available but don't download or install it automatically # 4 = Notify the user when an update is available but don't download or install it automatically
# = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing. # = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing.
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\" $rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
# Get all subkeys under the specified root path # Get all subkeys under the specified root path
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" } $subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
# Loop through each subkey # Loop through each subkey
foreach ($subKey in $subKeys) { foreach ($subKey in $subKeys) {
# Get the full registry path # Get the full registry path
@ -2617,7 +2630,7 @@
function RestoreCCService { function RestoreCCService {
$originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\" $originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\"
$newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\" $newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
if (Test-Path -Path $originalPath) { if (Test-Path -Path $originalPath) {
Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force
Write-Host \"Adobe Desktop Service has been restored.\" Write-Host \"Adobe Desktop Service has been restored.\"
@ -2629,12 +2642,12 @@
function AcrobatUpdates { function AcrobatUpdates {
# Default Value: # Default Value:
# 3 = Automatically download and install updates # 3 = Automatically download and install updates
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\" $rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
# Get all subkeys under the specified root path # Get all subkeys under the specified root path
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" } $subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
# Loop through each subkey # Loop through each subkey
foreach ($subKey in $subKeys) { foreach ($subKey in $subKeys) {
# Get the full registry path # Get the full registry path
@ -2709,14 +2722,14 @@
"Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. Credit: Ruddernation-Designs", "Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. Credit: Ruddernation-Designs",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",
"panel": "1", "panel": "1",
"Order": "a021_", "Order": "a021_",
"InvokeScript": [ "InvokeScript": [
" "
# Define the URL of the remote HOSTS file and the local paths # Define the URL of the remote HOSTS file and the local paths
$remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\" $remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\"
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\" $localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
$tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\" $tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\"
# Download the remote HOSTS file to a temporary location # Download the remote HOSTS file to a temporary location
try { try {
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
@ -2725,11 +2738,11 @@
catch { catch {
Write-Error \"Failed to download the HOSTS file. Error: $_\" Write-Error \"Failed to download the HOSTS file. Error: $_\"
} }
# Check if the AdobeNetBlock has already been started # Check if the AdobeNetBlock has already been started
try { try {
$localHostsContent = Get-Content $localHostsPath -ErrorAction Stop $localHostsContent = Get-Content $localHostsPath -ErrorAction Stop
# Check if AdobeNetBlock markers exist # Check if AdobeNetBlock markers exist
$blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\" $blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\"
if ($blockStartExists) { if ($blockStartExists) {
@ -2740,10 +2753,10 @@
$newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments $newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments
$newBlockHeader = \"#AdobeNetBlock-start\" $newBlockHeader = \"#AdobeNetBlock-start\"
$newBlockFooter = \"#AdobeNetBlock-end\" $newBlockFooter = \"#AdobeNetBlock-end\"
# Combine the contents, ensuring new block is properly formatted # Combine the contents, ensuring new block is properly formatted
$combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String $combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String
# Write the combined content back to the original HOSTS file # Write the combined content back to the original HOSTS file
$combinedContent | Set-Content $localHostsPath -Encoding ASCII $combinedContent | Set-Content $localHostsPath -Encoding ASCII
Write-Output \"Successfully added the AdobeNetBlock.\" Write-Output \"Successfully added the AdobeNetBlock.\"
@ -2752,10 +2765,10 @@
catch { catch {
Write-Error \"Error during processing: $_\" Write-Error \"Error during processing: $_\"
} }
# Clean up temporary file # Clean up temporary file
Remove-Item $tempHostsPath -ErrorAction Ignore Remove-Item $tempHostsPath -ErrorAction Ignore
# Flush the DNS resolver cache # Flush the DNS resolver cache
try { try {
Invoke-Expression \"ipconfig /flushdns\" Invoke-Expression \"ipconfig /flushdns\"
@ -2770,7 +2783,7 @@
" "
# Define the local path of the HOSTS file # Define the local path of the HOSTS file
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\" $localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
# Load the content of the HOSTS file # Load the content of the HOSTS file
try { try {
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop $hostsContent = Get-Content $localHostsPath -ErrorAction Stop
@ -2779,11 +2792,11 @@
Write-Error \"Failed to load the HOSTS file. Error: $_\" Write-Error \"Failed to load the HOSTS file. Error: $_\"
return return
} }
# Initialize flags and buffer for new content # Initialize flags and buffer for new content
$recording = $true $recording = $true
$newContent = @() $newContent = @()
# Iterate over each line of the HOSTS file # Iterate over each line of the HOSTS file
foreach ($line in $hostsContent) { foreach ($line in $hostsContent) {
if ($line -match \"#AdobeNetBlock-start\") { if ($line -match \"#AdobeNetBlock-start\") {
@ -2796,7 +2809,7 @@
$recording = $true $recording = $true
} }
} }
# Write the filtered content back to the HOSTS file # Write the filtered content back to the HOSTS file
try { try {
$newContent | Set-Content $localHostsPath -Encoding ASCII $newContent | Set-Content $localHostsPath -Encoding ASCII
@ -2805,7 +2818,7 @@
catch { catch {
Write-Error \"Failed to write back to the HOSTS file. Error: $_\" Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
} }
# Flush the DNS resolver cache # Flush the DNS resolver cache
try { try {
Invoke-Expression \"ipconfig /flushdns\" Invoke-Expression \"ipconfig /flushdns\"

View File

@ -37,7 +37,7 @@ function global:prepare_edge {
ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -recurse -force -ea 0 ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -recurse -force -ea 0
ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -recurse -force -ea 0 ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -recurse -force -ea 0
ni "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -force -ea 0 >'' ni "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -force -ea 0 >''
sp "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0 sp "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0
ni "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -force -ea 0 >'' ni "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -force -ea 0 >''
sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0 sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0
foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') { foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') {
@ -54,7 +54,7 @@ function global:prepare_edge {
} }
## helper for webview reinstall - restore webexperience (widgets) if available ## helper for webview reinstall - restore webexperience (widgets) if available
function global:prepare_webview { function global:prepare_webview {
$cfg = @{Register=$true; ForceApplicationShutdown=$true; ForceUpdateFromAnyVersion=$true; DisableDevelopmentMode=$true} $cfg = @{Register=$true; ForceApplicationShutdown=$true; ForceUpdateFromAnyVersion=$true; DisableDevelopmentMode=$true}
dir "$env:ProgramFiles\WindowsApps\MicrosoftWindows.Client.WebExperience*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg dir "$env:ProgramFiles\WindowsApps\MicrosoftWindows.Client.WebExperience*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg
dir "$env:SystemRoot\SystemApps\Microsoft.Win32WebViewHost*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg dir "$env:SystemRoot\SystemApps\Microsoft.Win32WebViewHost*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg
kill -name explorer -ea 0; if ((get-process -name 'explorer' -ea 0) -eq $null) {start explorer} kill -name explorer -ea 0; if ((get-process -name 'explorer' -ea 0) -eq $null) {start explorer}
@ -66,7 +66,7 @@ $D1=[uri].module.gettype('System.Diagnostics.Process')."GetM`ethods"(42) |where
## 3 shut edge & webview clone stuff down and gather install paths ## 3 shut edge & webview clone stuff down and gather install paths
$shut = 'explorer','Widgets','widgetservice','msedgewebview2','MicrosoftEdge*','chredge','msedge','edge' $shut = 'explorer','Widgets','widgetservice','msedgewebview2','MicrosoftEdge*','chredge','msedge','edge'
$shut+= 'msteams','msfamily','WebViewHost','Clipchamp' $shut+= 'msteams','msfamily','WebViewHost','Clipchamp'
cd $env:systemdrive; taskkill /im explorer.exe /f 2>&1 >''; foreach ($p in $shut) {kill -name $p -force -ea 0} cd $env:systemdrive; taskkill /im explorer.exe /f 2>&1 >''; foreach ($p in $shut) {kill -name $p -force -ea 0}
prepare_edge prepare_edge
## clear win32 uninstall block ## clear win32 uninstall block
@ -93,15 +93,15 @@ $users = @('S-1-5-18'); if (test-path $store) {$users += $((dir $store -ea 0 |wh
foreach ($choice in $remove_appx) { if ('' -eq $choice.Trim()) {continue} foreach ($choice in $remove_appx) { if ('' -eq $choice.Trim()) {continue}
foreach ($appx in $($provisioned |where {$_.PackageName -like "*$choice*"})) { foreach ($appx in $($provisioned |where {$_.PackageName -like "*$choice*"})) {
$next = !1; foreach ($no in $skip) {if ($appx.PackageName -like "*$no*") {$next = !0}} ; if ($next) {continue} $next = !1; foreach ($no in $skip) {if ($appx.PackageName -like "*$no*") {$next = !0}} ; if ($next) {continue}
$PackageName = $appx.PackageName; $PackageFamilyName = ($appxpackage |where {$_.Name -eq $appx.DisplayName}).PackageFamilyName $PackageName = $appx.PackageName; $PackageFamilyName = ($appxpackage |where {$_.Name -eq $appx.DisplayName}).PackageFamilyName
ni "$store\Deprovisioned\$PackageFamilyName" -force >''; $PackageFamilyName ni "$store\Deprovisioned\$PackageFamilyName" -force >''; $PackageFamilyName
foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageName" -force >''} ; $eol += $PackageName foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageName" -force >''} ; $eol += $PackageName
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >'' dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >''
remove-appxprovisionedpackage -packagename $PackageName -online -allusers >'' remove-appxprovisionedpackage -packagename $PackageName -online -allusers >''
} }
foreach ($appx in $($appxpackage |where {$_.PackageFullName -like "*$choice*"})) { foreach ($appx in $($appxpackage |where {$_.PackageFullName -like "*$choice*"})) {
$next = !1; foreach ($no in $skip) {if ($appx.PackageFullName -like "*$no*") {$next = !0}} ; if ($next) {continue} $next = !1; foreach ($no in $skip) {if ($appx.PackageFullName -like "*$no*") {$next = !0}} ; if ($next) {continue}
$PackageFullName = $appx.PackageFullName; $PackageFullName = $appx.PackageFullName;
ni "$store\Deprovisioned\$appx.PackageFamilyName" -force >''; $PackageFullName ni "$store\Deprovisioned\$appx.PackageFamilyName" -force >''; $PackageFullName
foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageFullName" -force >''} ; $eol += $PackageFullName foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageFullName" -force >''} ; $eol += $PackageFullName
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >'' dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >''
@ -125,16 +125,16 @@ foreach ($PF in $env:ProgramFiles,${env:ProgramFiles(x86)}) { if (test-path "$PF
if ($also_remove_webview -eq 1) { foreach ($hk in 'HKCU:','HKLM:') { foreach ($wow in '','\Wow6432Node') { if ($also_remove_webview -eq 1) { foreach ($hk in 'HKCU:','HKLM:') { foreach ($wow in '','\Wow6432Node') {
ri "$hk\SOFTWARE${wow}\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -rec -force -ea 0 }} ri "$hk\SOFTWARE${wow}\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -rec -force -ea 0 }}
ri "$PF\Microsoft\EdgeUpdate" -rec -force -ea 0; Unregister-ScheduledTask -TaskName MicrosoftEdgeUpdate* -Confirm:$false -ea 0 ri "$PF\Microsoft\EdgeUpdate" -rec -force -ea 0; Unregister-ScheduledTask -TaskName MicrosoftEdgeUpdate* -Confirm:$false -ea 0
} }
}} }}
$appdata = $([Environment]::GetFolderPath('ApplicationData')) $appdata = $([Environment]::GetFolderPath('ApplicationData'))
ri "$appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -force ri "$appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -force
ri "$appdata\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -force ri "$appdata\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -force
## undo eol unblock trick to prevent latest cumulative update (LCU) failing ## undo eol unblock trick to prevent latest cumulative update (LCU) failing
foreach ($sid in $users) { foreach ($PackageName in $eol) {ri "$store\EndOfLife\$sid\$PackageName" -force >''} } foreach ($sid in $users) { foreach ($PackageName in $eol) {ri "$store\EndOfLife\$sid\$PackageName" -force >''} }
## set (almost) useless policies to prevent unsolicited reinstalls ## set (almost) useless policies to prevent unsolicited reinstalls
foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') { foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') {
ni "$p\Microsoft\EdgeUpdate" -force >'' ni "$p\Microsoft\EdgeUpdate" -force >''
sp "$p\Microsoft\EdgeUpdate" 'InstallDefault' 0 -type Dword -force sp "$p\Microsoft\EdgeUpdate" 'InstallDefault' 0 -type Dword -force

View File

@ -1,27 +1,27 @@
function ConvertTo-Icon { function ConvertTo-Icon {
<# <#
.DESCRIPTION .DESCRIPTION
This function will convert PNG to ICO file This function will convert PNG to ICO file
.EXAMPLE .EXAMPLE
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
#> #>
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
$bitmapPath, $bitmapPath,
$iconPath = "$env:temp\newicon.ico" $iconPath = "$env:temp\newicon.ico"
) )
Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Drawing
if (Test-Path $bitmapPath) { if (Test-Path $bitmapPath) {
$b = [System.Drawing.Bitmap]::FromFile($bitmapPath) $b = [System.Drawing.Bitmap]::FromFile($bitmapPath)
$icon = [System.Drawing.Icon]::FromHandle($b.GetHicon()) $icon = [System.Drawing.Icon]::FromHandle($b.GetHicon())
$file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate') $file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate')
$icon.Save($file) $icon.Save($file)
$file.Close() $file.Close()
$icon.Dispose() $icon.Dispose()
#explorer "/SELECT,$iconpath" #explorer "/SELECT,$iconpath"
} }
else { Write-Warning "$BitmapPath does not exist" } else { Write-Warning "$BitmapPath does not exist" }
} }

View File

@ -1,22 +1,22 @@
function Copy-Files { function Copy-Files {
<# <#
.DESCRIPTION .DESCRIPTION
This function will make all modifications to the registry This function will make all modifications to the registry
.EXAMPLE .EXAMPLE
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0" Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
#> #>
param ( param (
[string] $Path, [string] $Path,
[string] $Destination, [string] $Destination,
[switch] $Recurse = $false, [switch] $Recurse = $false,
[switch] $Force = $false [switch] $Force = $false
) )
try { try {
$files = Get-ChildItem -Path $path -Recurse:$recurse $files = Get-ChildItem -Path $path -Recurse:$recurse
Write-Host "Copy $($files.Count)(s) from $path to $destination" Write-Host "Copy $($files.Count)(s) from $path to $destination"
@ -35,9 +35,9 @@ function Copy-Files {
else else
{ {
Write-Debug "Copy from $($file.FullName) to $($destination+$restpath)" Write-Debug "Copy from $($file.FullName) to $($destination+$restpath)"
Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force
Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false
} }
} }
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
} }

View File

@ -1,17 +1,17 @@
function Get-LocalizedYesNo { function Get-LocalizedYesNo {
<# <#
.SYNOPSIS .SYNOPSIS
This function runs choice.exe and captures its output to extract yes no in a localized Windows This function runs choice.exe and captures its output to extract yes no in a localized Windows
.DESCRIPTION .DESCRIPTION
The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No
in the localized format, such as "Yes=<first character>, No=<second character>". in the localized format, such as "Yes=<first character>, No=<second character>".
.EXAMPLE .EXAMPLE
$yesNoArray = Get-LocalizedYesNo $yesNoArray = Get-LocalizedYesNo
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])" Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
#> #>
# Run choice and capture its options as output # Run choice and capture its options as output
# The output shows the options for Yes and No as "[Y,N]?" in the (partitially) localized format. # The output shows the options for Yes and No as "[Y,N]?" in the (partitially) localized format.
# eg. English: [Y,N]? # eg. English: [Y,N]?
@ -21,7 +21,7 @@ function Get-LocalizedYesNo {
# Spanish: [S,N]? # Spanish: [S,N]?
# Italian: [S,N]? # Italian: [S,N]?
# Russian: [Y,N]? # Russian: [Y,N]?
$line = cmd /c "choice <nul 2>nul" $line = cmd /c "choice <nul 2>nul"
$charactersArray = @() $charactersArray = @()
$regexPattern = '([a-zA-Z])' $regexPattern = '([a-zA-Z])'
@ -30,4 +30,5 @@ function Get-LocalizedYesNo {
Write-Debug "According to takeown.exe local Yes is $charactersArray[0]" Write-Debug "According to takeown.exe local Yes is $charactersArray[0]"
# Return the array of characters # Return the array of characters
return $charactersArray return $charactersArray
} }

View File

@ -1,13 +1,13 @@
function Get-Oscdimg { function Get-Oscdimg {
<# <#
.DESCRIPTION .DESCRIPTION
This function will download oscdimg file from github Release folders and put it into env:temp folder This function will download oscdimg file from github Release folders and put it into env:temp folder
.EXAMPLE .EXAMPLE
Get-Oscdimg Get-Oscdimg
#> #>
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
[string]$oscdimgPath [string]$oscdimgPath
) )
$oscdimgPath = "$env:TEMP\oscdimg.exe" $oscdimgPath = "$env:TEMP\oscdimg.exe"
@ -24,4 +24,4 @@ function Get-Oscdimg {
} else { } else {
Write-Host "Hashes do not match. File may be corrupted or tampered with." Write-Host "Hashes do not match. File may be corrupted or tampered with."
} }
} }

View File

@ -13,8 +13,8 @@ function Get-TabXaml {
.EXAMPLE .EXAMPLE
Get-TabXaml "applications" 3 Get-TabXaml "applications" 3
#> #>
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
$tabname, $tabname,
$columncount = 0 $columncount = 0
@ -61,71 +61,71 @@ function Get-TabXaml {
$paneltotal = $columncount $paneltotal = $columncount
} }
# add ColumnDefinitions to evenly draw colums # add ColumnDefinitions to evenly draw colums
$blockXml="<Grid.ColumnDefinitions>`n"+("<ColumnDefinition Width=""*""/>`n"*($paneltotal))+"</Grid.ColumnDefinitions>`n" $blockXml="<Grid.ColumnDefinitions>`r`n"+("<ColumnDefinition Width=""*""/>`r`n"*($paneltotal))+"</Grid.ColumnDefinitions>`r`n"
# Iterate through organizedData by panel, category, and application # Iterate through organizedData by panel, category, and application
$count = 0 $count = 0
foreach ($panel in ($organizedData.Keys | Sort-Object)) { foreach ($panel in ($organizedData.Keys | Sort-Object)) {
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n" $blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`r`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`r`n"
$panelcount++ $panelcount++
foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) { foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) {
$count++ $count++
if ($columncount -gt 0) { if ($columncount -gt 0) {
$panelcount2 = [Int](($count)/$maxcount-0.5) $panelcount2 = [Int](($count)/$maxcount-0.5)
if ($panelcount -eq $panelcount2 ) { if ($panelcount -eq $panelcount2 ) {
$blockXml +="`n</StackPanel>`n</Border>`n" $blockXml +="`r`n</StackPanel>`r`n</Border>`r`n"
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n" $blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`r`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`r`n"
$panelcount++ $panelcount++
} }
} }
# Dot-source the Get-WPFObjectName function # Dot-source the Get-WPFObjectName function
. .\functions\private\Get-WPFObjectName . .\functions\private\Get-WPFObjectName
$categorycontent = $($category -replace '^.__', '') $categorycontent = $($category -replace '^.__', '')
$categoryname = Get-WPFObjectName -type "Label" -name $categorycontent $categoryname = Get-WPFObjectName -type "Label" -name $categorycontent
$blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`n" $blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`r`n"
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object $sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
foreach ($appName in $sortedApps) { foreach ($appName in $sortedApps) {
$count++ $count++
if ($columncount -gt 0) { if ($columncount -gt 0) {
$panelcount2 = [Int](($count)/$maxcount-0.5) $panelcount2 = [Int](($count)/$maxcount-0.5)
if ($panelcount -eq $panelcount2 ) { if ($panelcount -eq $panelcount2 ) {
$blockXml +="`n</StackPanel>`n</Border>`n" $blockXml +="`r`n</StackPanel>`r`n</Border>`r`n"
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n" $blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`r`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`r`n"
$panelcount++ $panelcount++
} }
} }
$appInfo = $organizedData[$panel][$category][$appName] $appInfo = $organizedData[$panel][$category][$appName]
if ("Toggle" -eq $appInfo.Type) { if ("Toggle" -eq $appInfo.Type) {
$blockXml += "<DockPanel LastChildFill=`"True`">`n<Label Content=`"$($appInfo.Content)`" ToolTip=`"$($appInfo.Description)`" HorizontalAlignment=`"Left`"/>`n" $blockXml += "<DockPanel LastChildFill=`"True`">`r`n<Label Content=`"$($appInfo.Content)`" ToolTip=`"$($appInfo.Description)`" HorizontalAlignment=`"Left`"/>`r`n"
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`" HorizontalAlignment=`"Right`"/>`n</DockPanel>`n" $blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`" HorizontalAlignment=`"Right`"/>`r`n</DockPanel>`r`n"
} elseif ("Combobox" -eq $appInfo.Type) { } elseif ("Combobox" -eq $appInfo.Type) {
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`n" $blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`r`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`r`n"
$blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`n" $blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`r`n"
$addfirst="IsSelected=`"True`"" $addfirst="IsSelected=`"True`""
foreach ($comboitem in ($appInfo.ComboItems -split " ")) { foreach ($comboitem in ($appInfo.ComboItems -split " ")) {
$blockXml += "<ComboBoxItem $addfirst Content=`"$comboitem`"/>`n" $blockXml += "<ComboBoxItem $addfirst Content=`"$comboitem`"/>`r`n"
$addfirst="" $addfirst=""
} }
$blockXml += "</ComboBox>`n</StackPanel>" $blockXml += "</ComboBox>`r`n</StackPanel>"
# If it is a digit, type is button and button length is digits # If it is a digit, type is button and button length is digits
} elseif ($appInfo.Type -match "^[\d\.]+$") { } elseif ($appInfo.Type -match "^[\d\.]+$") {
$blockXml += "<Button Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" HorizontalAlignment = `"Left`" Width=`"$($appInfo.Type)`" Margin=`"5`" Padding=`"20,5`" />`n" $blockXml += "<Button Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" HorizontalAlignment = `"Left`" Width=`"$($appInfo.Type)`" Margin=`"5`" Padding=`"20,5`" />`r`n"
# else it is a checkbox # else it is a checkbox
} else { } else {
$checkedStatus = If ($null -eq $appInfo.Checked) {""} Else {"IsChecked=`"$($appInfo.Checked)`" "} $checkedStatus = If ($null -eq $appInfo.Checked) {""} Else {"IsChecked=`"$($appInfo.Checked)`" "}
if ($null -eq $appInfo.Link) if ($null -eq $appInfo.Link)
{ {
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" $($checkedStatus)Margin=`"5,0`" ToolTip=`"$($appInfo.Description)`"/>`n" $blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" $($checkedStatus)Margin=`"5,0`" ToolTip=`"$($appInfo.Description)`"/>`r`n"
} }
else else
{ {
$blockXml += "<StackPanel Orientation=""Horizontal"">`n<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)"" $($checkedStatus)ToolTip=""$($appInfo.Description)"" Margin=""0,0,2,0""/><TextBlock Name=""$($appInfo.Name)Link"" Style=""{StaticResource HoverTextBlockStyle}"" Text=""(?)"" ToolTip=""$($appInfo.Link)"" />`n</StackPanel>`n" $blockXml += "<StackPanel Orientation=""Horizontal"">`r`n<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)"" $($checkedStatus)ToolTip=""$($appInfo.Description)"" Margin=""0,0,2,0""/><TextBlock Name=""$($appInfo.Name)Link"" Style=""{StaticResource HoverTextBlockStyle}"" Text=""(?)"" ToolTip=""$($appInfo.Link)"" />`r`n</StackPanel>`r`n"
} }
} }
} }
} }
$blockXml +="`n</StackPanel>`n</Border>`n" $blockXml +="`r`n</StackPanel>`r`n</Border>`r`n"
} }
return ($blockXml) return ($blockXml)
} }

View File

@ -10,17 +10,17 @@ function Get-WPFObjectName {
.OUTPUTS .OUTPUTS
A string that can be used as a object/variable name in powershell. A string that can be used as a object/variable name in powershell.
For example: WPFLabelMicrosoftTools For example: WPFLabelMicrosoftTools
.EXAMPLE .EXAMPLE
Get-WPFObjectName -type Label -name "Microsoft Tools" Get-WPFObjectName -type Label -name "Microsoft Tools"
#> #>
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
$type, $type,
$name $name
) )
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', '' $Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', ''
return $Output return $Output

View File

@ -49,7 +49,7 @@ Function Get-WinUtilToggleStatus {
else{ else{
return $false return $false
} }
} }
if($ToggleSwitch -eq "WPFToggleShowExt"){ if($ToggleSwitch -eq "WPFToggleShowExt"){
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt $hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
if($hideextvalue -eq 0){ if($hideextvalue -eq 0){
@ -58,7 +58,7 @@ Function Get-WinUtilToggleStatus {
else{ else{
return $false return $false
} }
} }
if($ToggleSwitch -eq "WPFToggleSnapWindow"){ if($ToggleSwitch -eq "WPFToggleSnapWindow"){
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive $hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
if($hidesnap -eq 0){ if($hidesnap -eq 0){
@ -76,7 +76,7 @@ Function Get-WinUtilToggleStatus {
else{ else{
return $true return $true
} }
} }
if($ToggleSwitch -eq "WPFToggleSnapSuggestion"){ if($ToggleSwitch -eq "WPFToggleSnapSuggestion"){
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist $hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
if($hidesnap -eq 0){ if($hidesnap -eq 0){
@ -85,7 +85,7 @@ Function Get-WinUtilToggleStatus {
else{ else{
return $true return $true
} }
} }
if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){ if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed $MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1 $MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1

View File

@ -11,9 +11,7 @@ function Get-WinUtilVariables {
[Parameter()] [Parameter()]
[string[]]$Type [string[]]$Type
) )
$keys = ($sync.keys).where{ $_ -like "WPF*" }
$keys = $sync.keys | Where-Object { $_ -like "WPF*" }
if ($Type) { if ($Type) {
$output = $keys | ForEach-Object { $output = $keys | ForEach-Object {
Try { Try {

View File

@ -5,8 +5,8 @@ function Get-WinUtilWingetLatest {
.DESCRIPTION .DESCRIPTION
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation. This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
#> #>
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function # Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
$PreviousProgressPreference = $ProgressPreference $PreviousProgressPreference = $ProgressPreference
$ProgressPreference = "silentlyContinue" $ProgressPreference = "silentlyContinue"
Try{ Try{
# Grabs the latest release of Winget from the Github API for the install process. # Grabs the latest release of Winget from the Github API for the install process.

View File

@ -2,17 +2,17 @@ function Install-WinUtilProgramChoco {
<# <#
.SYNOPSIS .SYNOPSIS
Manages the provided programs using Chocolatey Manages the provided programs using Chocolatey
.PARAMETER ProgramsToInstall .PARAMETER ProgramsToInstall
A list of programs to manage A list of programs to manage
.PARAMETER manage .PARAMETER manage
The action to perform on the programs, can be either 'Installing' or 'Uninstalling' The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
.NOTES .NOTES
The triple quotes are required any time you need a " in a normal script block. The triple quotes are required any time you need a " in a normal script block.
#> #>
param( param(
[Parameter(Mandatory, Position=0)] [Parameter(Mandatory, Position=0)]
[PsCustomObject]$ProgramsToInstall, [PsCustomObject]$ProgramsToInstall,
@ -20,7 +20,7 @@ function Install-WinUtilProgramChoco {
[Parameter(Position=1)] [Parameter(Position=1)]
[String]$manage = "Installing" [String]$manage = "Installing"
) )
$x = 0 $x = 0
$count = $ProgramsToInstall.Count $count = $ProgramsToInstall.Count

View File

@ -1,30 +1,30 @@
Function Install-WinUtilProgramWinget { Function Install-WinUtilProgramWinget {
<# <#
.SYNOPSIS .SYNOPSIS
Manages the provided programs using Winget Manages the provided programs using Winget
.PARAMETER ProgramsToInstall .PARAMETER ProgramsToInstall
A list of programs to manage A list of programs to manage
.PARAMETER manage .PARAMETER manage
The action to perform on the programs, can be either 'Installing' or 'Uninstalling' The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
.NOTES .NOTES
The triple quotes are required any time you need a " in a normal script block. The triple quotes are required any time you need a " in a normal script block.
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
#> #>
param( param(
[Parameter(Mandatory, Position=0)] [Parameter(Mandatory, Position=0)]
[PsCustomObject]$ProgramsToInstall, [PsCustomObject]$ProgramsToInstall,
[Parameter(Position=1)] [Parameter(Position=1)]
[String]$manage = "Installing" [String]$manage = "Installing"
) )
$x = 0 $x = 0
$count = $ProgramsToInstall.Count $count = $ProgramsToInstall.Count
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0 Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
Write-Host "===========================================" Write-Host "==========================================="
Write-Host "-- Configuring winget packages ---" Write-Host "-- Configuring winget packages ---"
@ -33,7 +33,7 @@ Function Install-WinUtilProgramWinget {
$failedPackages = @() $failedPackages = @()
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100) Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
if($manage -eq "Installing"){ if($manage -eq "Installing"){
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt. # 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. # 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. # 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. # This is up to the individual package maintainers to enable these options. Aka. not as clean as Linux Package Managers.

View File

@ -41,7 +41,7 @@ function Install-WinUtilWinget {
Write-Host "Installing Winget w/ Prerequsites`r" Write-Host "Installing Winget w/ Prerequsites`r"
Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml
Write-Host "Manually adding Winget Sources, from Winget CDN." Write-Host "Manually adding Winget Sources, from Winget CDN."
Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time. Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time.
Write-Host "Winget Installed" -ForegroundColor Green Write-Host "Winget Installed" -ForegroundColor Green
Write-Host "Enabling NuGet and Module..." Write-Host "Enabling NuGet and Module..."
Install-PackageProvider -Name NuGet -Force Install-PackageProvider -Name NuGet -Force

View File

@ -105,8 +105,8 @@ function Remove-Packages
$_ -NotLike "*DesktopAppInstaller*" -AND $_ -NotLike "*DesktopAppInstaller*" -AND
$_ -NotLike "*WebMediaExtensions*" -AND $_ -NotLike "*WebMediaExtensions*" -AND
$_ -NotLike "*WMIC*" -AND $_ -NotLike "*WMIC*" -AND
$_ -NotLike "*UI.XaML*" $_ -NotLike "*UI.XaML*"
} }
foreach ($pkg in $pkglist) foreach ($pkg in $pkglist)
{ {
@ -148,9 +148,9 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
$_.PackageName -NotLike "*Notepad*" -and $_.PackageName -NotLike "*Notepad*" -and
$_.PackageName -NotLike "*Printing*" -and $_.PackageName -NotLike "*Printing*" -and
$_.PackageName -NotLike "*Wifi*" -and $_.PackageName -NotLike "*Wifi*" -and
$_.PackageName -NotLike "*Foundation*" $_.PackageName -NotLike "*Foundation*"
} }
if ($?) if ($?)
{ {
if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }} if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }}
@ -165,7 +165,7 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
catch { catch {
Write-Host "Application $($appx.PackageName) could not be removed" Write-Host "Application $($appx.PackageName) could not be removed"
continue continue
} }
} }
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
} }
@ -217,13 +217,13 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
# Remove-Item -Path $directoryPath -Recurse -Force # Remove-Item -Path $directoryPath -Recurse -Force
# # Grant full control to BUILTIN\Administrators using icacls # # Grant full control to BUILTIN\Administrators using icacls
# $directoryPath = "$($scratchDir)\Windows\System32\WebThreatDefSvc" # $directoryPath = "$($scratchDir)\Windows\System32\WebThreatDefSvc"
# takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null # takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
# icacls "$($directoryPath)" /q /c /t /reset > $null # icacls "$($directoryPath)" /q /c /t /reset > $null
# icacls $directoryPath /setowner "*S-1-5-32-544" # icacls $directoryPath /setowner "*S-1-5-32-544"
# icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q # icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
# Remove-Item -Path $directoryPath -Recurse -Force # Remove-Item -Path $directoryPath -Recurse -Force
$itemsToDelete = [System.Collections.ArrayList]::new() $itemsToDelete = [System.Collections.ArrayList]::new()
if ($mask -eq "") if ($mask -eq "")
@ -231,9 +231,9 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
Write-Debug "Adding $($pathToDelete) to array." Write-Debug "Adding $($pathToDelete) to array."
[void]$itemsToDelete.Add($pathToDelete) [void]$itemsToDelete.Add($pathToDelete)
} }
else else
{ {
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)" Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory } if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory }
else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse } else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
} }
@ -243,7 +243,7 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
$status = "Deleting $($itemToDelete)" $status = "Deleting $($itemToDelete)"
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100) Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
if (Test-Path -Path "$($itemToDelete)" -PathType Container) if (Test-Path -Path "$($itemToDelete)" -PathType Container)
{ {
$status = "Deleting directory: $($itemToDelete)" $status = "Deleting directory: $($itemToDelete)"
@ -463,16 +463,16 @@ function New-FirstRun {
param ( param (
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$RegistryPath, [string]$RegistryPath,
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$ValueName [string]$ValueName
) )
# Check if the registry path exists # Check if the registry path exists
if (Test-Path -Path $RegistryPath) if (Test-Path -Path $RegistryPath)
{ {
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue $registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
# Check if the registry value exists # Check if the registry value exists
if ($registryValue) if ($registryValue)
{ {
@ -490,7 +490,7 @@ function New-FirstRun {
Write-Host "Registry path '$RegistryPath' not found." Write-Host "Registry path '$RegistryPath' not found."
} }
} }
function Stop-UnnecessaryServices function Stop-UnnecessaryServices
{ {
$servicesToExclude = @( $servicesToExclude = @(
@ -556,8 +556,8 @@ function New-FirstRun {
"vm3dservice", "vm3dservice",
"webthreatdefusersvc_dc2a4", "webthreatdefusersvc_dc2a4",
"wscsvc" "wscsvc"
) )
$runningServices = Get-Service | Where-Object { $servicesToExclude -notcontains $_.Name } $runningServices = Get-Service | Where-Object { $servicesToExclude -notcontains $_.Name }
foreach($service in $runningServices) foreach($service in $runningServices)
{ {
@ -566,28 +566,28 @@ function New-FirstRun {
"Stopping service $($service.Name)" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber "Stopping service $($service.Name)" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
} }
} }
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber "FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value 1 Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value 1
Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value 1 Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value 1
# figure this out later how to set updates to security only # figure this out later how to set updates to security only
#Import-Module -Name PSWindowsUpdate; #Import-Module -Name PSWindowsUpdate;
#Stop-Service -Name wuauserv #Stop-Service -Name wuauserv
#Set-WUSettings -MicrosoftUpdateEnabled -AutoUpdateOption 'Never' #Set-WUSettings -MicrosoftUpdateEnabled -AutoUpdateOption 'Never'
#Start-Service -Name wuauserv #Start-Service -Name wuauserv
Stop-UnnecessaryServices Stop-UnnecessaryServices
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" $taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
# Delete all files on the Taskbar # Delete all files on the Taskbar
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges" Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges" Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites" Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
# Stop-Process -Name explorer -Force # Stop-Process -Name explorer -Force
$process = Get-Process -Name "explorer" $process = Get-Process -Name "explorer"
@ -599,9 +599,9 @@ function New-FirstRun {
# Delete Edge Icon from the desktop # Delete Edge Icon from the desktop
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk" $edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
# Check if Edge shortcuts exist on the desktop # Check if Edge shortcuts exist on the desktop
if ($edgeShortcutFiles) if ($edgeShortcutFiles)
{ {
foreach ($shortcutFile in $edgeShortcutFiles) foreach ($shortcutFile in $edgeShortcutFiles)
{ {
# Remove each Edge shortcut # Remove each Edge shortcut
Remove-Item -Path $shortcutFile.FullName -Force Remove-Item -Path $shortcutFile.FullName -Force
@ -621,7 +621,7 @@ function New-FirstRun {
$shortcutPath = Join-Path $desktopPath 'winutil.lnk' $shortcutPath = Join-Path $desktopPath 'winutil.lnk'
# Create a shell object # Create a shell object
$shell = New-Object -ComObject WScript.Shell $shell = New-Object -ComObject WScript.Shell
# Create a shortcut object # Create a shortcut object
$shortcut = $shell.CreateShortcut($shortcutPath) $shortcut = $shell.CreateShortcut($shortcutPath)
@ -629,26 +629,26 @@ function New-FirstRun {
{ {
$shortcut.IconLocation = "c:\Windows\cttlogo.png" $shortcut.IconLocation = "c:\Windows\cttlogo.png"
} }
# Set properties of the shortcut # Set properties of the shortcut
$shortcut.TargetPath = "powershell.exe" $shortcut.TargetPath = "powershell.exe"
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`"" $shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
# Save the shortcut # Save the shortcut
$shortcut.Save() $shortcut.Save()
# Make the shortcut have 'Run as administrator' property on # Make the shortcut have 'Run as administrator' property on
$bytes = [System.IO.File]::ReadAllBytes($shortcutPath) $bytes = [System.IO.File]::ReadAllBytes($shortcutPath)
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex # Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
$bytes[0x15] = $bytes[0x15] -bor 0x20 $bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes) [System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
Write-Host "Shortcut created at: $shortcutPath" Write-Host "Shortcut created at: $shortcutPath"
# #
# Done create WinUtil shortcut on the desktop # Done create WinUtil shortcut on the desktop
# ************************************************ # ************************************************
Start-Process explorer Start-Process explorer
'@ '@
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force $firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
} }

View File

@ -15,13 +15,13 @@ Function Invoke-WinUtilMouseAcceleration {
$MouseSpeed = 1 $MouseSpeed = 1
$MouseThreshold1 = 6 $MouseThreshold1 = 6
$MouseThreshold2 = 10 $MouseThreshold2 = 10
} }
else { else {
Write-Host "Disabling Mouse Acceleration" Write-Host "Disabling Mouse Acceleration"
$MouseSpeed = 0 $MouseSpeed = 0
$MouseThreshold1 = 0 $MouseThreshold1 = 0
$MouseThreshold2 = 0 $MouseThreshold2 = 0
} }
$Path = "HKCU:\Control Panel\Mouse" $Path = "HKCU:\Control Panel\Mouse"

View File

@ -6,7 +6,7 @@ Function Invoke-WinUtilStickyKeys {
Indicates whether to enable or disable Sticky Keys on startup Indicates whether to enable or disable Sticky Keys on startup
#> #>
Param($Enabled) Param($Enabled)
Try { Try {
if ($Enabled -eq $false){ if ($Enabled -eq $false){
Write-Host "Enabling Sticky Keys On startup" Write-Host "Enabling Sticky Keys On startup"
$value = 510 $value = 510

View File

@ -50,7 +50,7 @@ function Invoke-WinUtilTweaks {
Write-Debug "KeepServiceStartup is $KeepServiceStartup" Write-Debug "KeepServiceStartup is $KeepServiceStartup"
$sync.configs.tweaks.$CheckBox.service | ForEach-Object { $sync.configs.tweaks.$CheckBox.service | ForEach-Object {
$changeservice = $true $changeservice = $true
# The check for !($undo) is required, without it the script will throw an error for accessing unavailable memeber, which's the 'OriginalService' Property # The check for !($undo) is required, without it the script will throw an error for accessing unavailable memeber, which's the 'OriginalService' Property
if($KeepServiceStartup -AND !($undo)) { if($KeepServiceStartup -AND !($undo)) {
try { try {

View File

@ -2,10 +2,10 @@ function Show-CustomDialog {
<# <#
.SYNOPSIS .SYNOPSIS
Displays a custom dialog box with an image, heading, message, and an OK button. Displays a custom dialog box with an image, heading, message, and an OK button.
.DESCRIPTION .DESCRIPTION
This function creates a custom dialog box with the specified message and additional elements such as an image, heading, and an OK button. The dialog box is designed with a green border, rounded corners, and a black background. This function creates a custom dialog box with the specified message and additional elements such as an image, heading, and an OK button. The dialog box is designed with a green border, rounded corners, and a black background.
.PARAMETER Message .PARAMETER Message
The message to be displayed in the dialog box. The message to be displayed in the dialog box.
@ -14,10 +14,10 @@ function Show-CustomDialog {
.PARAMETER Height .PARAMETER Height
The height of the custom dialog window. The height of the custom dialog window.
.EXAMPLE .EXAMPLE
Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200 Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
#> #>
param( param(
[string]$Message, [string]$Message,
@ -99,7 +99,7 @@ function Show-CustomDialog {
$grid.RowDefinitions.Add($row0) $grid.RowDefinitions.Add($row0)
$grid.RowDefinitions.Add($row1) $grid.RowDefinitions.Add($row1)
$grid.RowDefinitions.Add($row2) $grid.RowDefinitions.Add($row2)
# Add StackPanel for horizontal layout with margins # Add StackPanel for horizontal layout with margins
$stackPanel = New-Object Windows.Controls.StackPanel $stackPanel = New-Object Windows.Controls.StackPanel
$stackPanel.Margin = New-Object Windows.Thickness(10) # Add margins around the stack panel $stackPanel.Margin = New-Object Windows.Thickness(10) # Add margins around the stack panel
@ -113,7 +113,7 @@ function Show-CustomDialog {
$viewbox = New-Object Windows.Controls.Viewbox $viewbox = New-Object Windows.Controls.Viewbox
$viewbox.Width = 25 $viewbox.Width = 25
$viewbox.Height = 25 $viewbox.Height = 25
# Combine the paths into a single string # Combine the paths into a single string
# $cttLogoPath = @" # $cttLogoPath = @"
# M174 1094 c-4 -14 -4 -55 -2 -92 3 -57 9 -75 41 -122 41 -60 45 -75 22 -84 -25 -9 -17 -21 30 -44 l45 -22 0 -103 c0 -91 3 -109 26 -155 30 -60 65 -87 204 -157 l95 -48 110 58 c184 96 205 127 205 293 l0 108 45 22 c47 23 55 36 30 46 -22 8 -18 30 9 63 13 16 34 48 46 71 20 37 21 52 15 116 l-6 73 -69 -23 c-38 -12 -137 -59 -220 -103 -82 -45 -160 -81 -171 -81 -12 0 -47 15 -78 34 -85 51 -239 127 -309 151 l-62 22 -6 -23z m500 -689 c20 -8 36 -19 36 -24 0 -18 -53 -51 -80 -51 -28 0 -80 33 -80 51 0 10 55 38 76 39 6 0 28 -7 48 -15z # M174 1094 c-4 -14 -4 -55 -2 -92 3 -57 9 -75 41 -122 41 -60 45 -75 22 -84 -25 -9 -17 -21 30 -44 l45 -22 0 -103 c0 -91 3 -109 26 -155 30 -60 65 -87 204 -157 l95 -48 110 58 c184 96 205 127 205 293 l0 108 45 22 c47 23 55 36 30 46 -22 8 -18 30 9 63 13 16 34 48 46 71 20 37 21 52 15 116 l-6 73 -69 -23 c-38 -12 -137 -59 -220 -103 -82 -45 -160 -81 -171 -81 -12 0 -47 15 -78 34 -85 51 -239 127 -309 151 l-62 22 -6 -23z m500 -689 c20 -8 36 -19 36 -24 0 -18 -53 -51 -80 -51 -28 0 -80 33 -80 51 0 10 55 38 76 39 6 0 28 -7 48 -15z
@ -159,7 +159,7 @@ $cttLogoPath = @"
46.21,102.83 36.63,98.57 31.04,93.68 46.21,102.83 36.63,98.57 31.04,93.68
16.88,81.28 19.00,62.88 19.00,46.00 Z 16.88,81.28 19.00,62.88 19.00,46.00 Z
"@ "@
# Add SVG path # Add SVG path
$svgPath = New-Object Windows.Shapes.Path $svgPath = New-Object Windows.Shapes.Path
$svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath) $svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath)
@ -167,7 +167,7 @@ $cttLogoPath = @"
# Add SVG path to Viewbox # Add SVG path to Viewbox
$viewbox.Child = $svgPath $viewbox.Child = $svgPath
# Add SVG path to the stack panel # Add SVG path to the stack panel
$stackPanel.Children.Add($viewbox) $stackPanel.Children.Add($viewbox)
@ -215,7 +215,7 @@ $cttLogoPath = @"
param($sender, $args) param($sender, $args)
$sender.Foreground = $foregroundColor $sender.Foreground = $foregroundColor
}) })
$messageTextBlock.Inlines.Add($hyperlink) $messageTextBlock.Inlines.Add($hyperlink)
# Update the last position # Update the last position

View File

@ -70,7 +70,7 @@ function Test-WinUtilPackageManager {
Write-Host " - Winget is Out of Date" -ForegroundColor Red Write-Host " - Winget is Out of Date" -ForegroundColor Red
$status = "outdated" $status = "outdated"
} }
} else { } else {
Write-Host "===========================================" -ForegroundColor Red Write-Host "===========================================" -ForegroundColor Red
Write-Host "--- Winget is not installed ---" -ForegroundColor Red Write-Host "--- Winget is not installed ---" -ForegroundColor Red
Write-Host "===========================================" -ForegroundColor Red Write-Host "===========================================" -ForegroundColor Red

View File

@ -8,13 +8,13 @@ function Invoke-ScratchDialog {
.PARAMETER Button .PARAMETER Button
#> #>
$sync.WPFMicrowinISOScratchDir.IsChecked $sync.WPFMicrowinISOScratchDir.IsChecked
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog $Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text $Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
$Dialog.ShowDialog() $Dialog.ShowDialog()
$filePath = $Dialog.SelectedPath $filePath = $Dialog.SelectedPath
Write-Host "No ISO is chosen+ $filePath" Write-Host "No ISO is chosen+ $filePath"
@ -23,7 +23,7 @@ function Invoke-ScratchDialog {
Write-Host "No Folder had chosen" Write-Host "No Folder had chosen"
return return
} }
$sync.MicrowinScratchDirBox.Text = Join-Path $filePath "\" $sync.MicrowinScratchDirBox.Text = Join-Path $filePath "\"
} }

View File

@ -3,7 +3,7 @@ function Invoke-WPFFixesWinget {
<# <#
.SYNOPSIS .SYNOPSIS
Fixes Winget by running choco install winget Fixes Winget by running choco install winget
.DESCRIPTION .DESCRIPTION
BravoNorris for the fantastic idea of a button to reinstall winget BravoNorris for the fantastic idea of a button to reinstall winget
#> #>

View File

@ -22,18 +22,18 @@ function Invoke-WPFGetIso {
Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | " Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | "
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| " Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe' $oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf) $oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
Write-Host "oscdimg.exe on system: $oscdImgFound" Write-Host "oscdimg.exe on system: $oscdImgFound"
if (!$oscdImgFound) if (!$oscdImgFound)
{ {
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked $downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
$sync.BusyMessage.Visibility="Hidden" $sync.BusyMessage.Visibility="Hidden"
if (!$downloadFromGitHub) if (!$downloadFromGitHub)
{ {
# only show the message to people who did check the box to download from github, if you check the box # only show the message to people who did check the box to download from github, if you check the box
# you consent to downloading it, no need to show extra dialogs # you consent to downloading it, no need to show extra dialogs
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.") [System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
# the step below needs choco to download oscdimg # the step below needs choco to download oscdimg
@ -41,7 +41,7 @@ function Invoke-WPFGetIso {
Install-WinUtilChoco Install-WinUtilChoco
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco) $chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
Write-Host "choco on system: $chocoFound" Write-Host "choco on system: $chocoFound"
if (!$chocoFound) if (!$chocoFound)
{ {
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe") [System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
return return
@ -106,7 +106,7 @@ function Invoke-WPFGetIso {
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." 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."
return return
} }
else else
{ {
Write-Host "You have enough space for this operation." Write-Host "You have enough space for this operation."
} }
@ -144,7 +144,7 @@ function Invoke-WPFGetIso {
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\' $sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
} }
# Detect if the folders already exist and remove them # Detect if the folders already exist and remove them
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text)) if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
{ {
@ -164,7 +164,7 @@ function Invoke-WPFGetIso {
$randomMicrowin = "Microwin_${timestamp}_${randomNumber}" $randomMicrowin = "Microwin_${timestamp}_${randomNumber}"
$randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}" $randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}"
$sync.BusyText.Text=" - Mounting" $sync.BusyText.Text=" - Mounting"
Write-Host "Mounting Iso. Please wait." Write-Host "Mounting Iso. Please wait."
if ($sync.MicrowinScratchDirBox.Text -eq "") { if ($sync.MicrowinScratchDirBox.Text -eq "") {
$mountDir = Join-Path $env:TEMP $randomMicrowin $mountDir = Join-Path $env:TEMP $randomMicrowin
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch $scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
@ -180,12 +180,12 @@ function Invoke-WPFGetIso {
Write-Host "Image dir is $mountDir" Write-Host "Image dir is $mountDir"
try { try {
#$data = @($driveLetter, $filePath) #$data = @($driveLetter, $filePath)
New-Item -ItemType Directory -Force -Path "$($mountDir)" | Out-Null New-Item -ItemType Directory -Force -Path "$($mountDir)" | Out-Null
New-Item -ItemType Directory -Force -Path "$($scratchDir)" | Out-Null New-Item -ItemType Directory -Force -Path "$($scratchDir)" | Out-Null
Write-Host "Copying Windows image. This will take awhile, please don't use UI or cancel this step!" Write-Host "Copying Windows image. This will take awhile, please don't use UI or cancel this step!"
# xcopy we can verify files and also not copy files that already exist, but hard to measure # xcopy we can verify files and also not copy files that already exist, but hard to measure
# xcopy.exe /E /I /H /R /Y /J $DriveLetter":" $mountDir >$null # xcopy.exe /E /I /H /R /Y /J $DriveLetter":" $mountDir >$null
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" $mountDir -Recurse -Force } $totalTime = Measure-Command { Copy-Files "$($driveLetter):" $mountDir -Recurse -Force }

View File

@ -33,12 +33,12 @@ function Invoke-WPFImpex {
if($FileBrowser.FileName -eq ""){ if($FileBrowser.FileName -eq ""){
return return
} }
else{ else{
$Config = $FileBrowser.FileName $Config = $FileBrowser.FileName
} }
} }
if ($type -eq "export"){ if ($type -eq "export"){
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false $jsonFile = Get-WinUtilCheckBoxes -unCheck $false
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force $jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force

View File

@ -92,7 +92,7 @@ public class PowerManagement {
$mountDirExists = Test-Path $mountDir $mountDirExists = Test-Path $mountDir
$scratchDirExists = Test-Path $scratchDir $scratchDirExists = Test-Path $scratchDir
if (-not $mountDirExists -or -not $scratchDirExists) if (-not $mountDirExists -or -not $scratchDirExists)
{ {
Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist." Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist."
return return
@ -149,7 +149,7 @@ public class PowerManagement {
if (Test-Path "$env:TEMP\DRV_EXPORT") if (Test-Path "$env:TEMP\DRV_EXPORT")
{ {
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
} }
} }
} }
@ -161,7 +161,7 @@ public class PowerManagement {
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) " Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
} }
else else
{ {
Write-Host "Path to drivers is invalid continuing without driver injection" Write-Host "Path to drivers is invalid continuing without driver injection"
} }
@ -182,12 +182,12 @@ public class PowerManagement {
} }
# special code, for some reason when you try to delete some inbox apps # special code, for some reason when you try to delete some inbox apps
# we have to get and delete log files directory. # we have to get and delete log files directory.
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory
# Defender is hidden in 2 places we removed a feature above now need to remove it from the disk # Defender is hidden in 2 places we removed a feature above now need to remove it from the disk
if (!$keepDefender) if (!$keepDefender)
{ {
Write-Host "Removing Defender" Write-Host "Removing Defender"
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory
@ -204,7 +204,7 @@ public class PowerManagement {
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\SecurityHealthSystray.exe" Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\SecurityHealthSystray.exe"
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe" Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
@ -285,7 +285,7 @@ public class PowerManagement {
Write-Host "Disabling Teams" Write-Host "Disabling Teams"
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d 0 /f >$null 2>&1 reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d 0 /f >$null 2>&1
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 2 /f >$null 2>&1 reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 2 /f >$null 2>&1
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f >$null 2>&1 reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f >$null 2>&1
reg query "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" >$null 2>&1 reg query "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" >$null 2>&1
# Write-Host Error code $LASTEXITCODE # Write-Host Error code $LASTEXITCODE
Write-Host "Done disabling Teams" Write-Host "Done disabling Teams"
@ -327,7 +327,7 @@ public class PowerManagement {
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f
reg add "HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d '{\"pinnedList\": [{}]}' /f reg add "HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d '{\"pinnedList\": [{}]}' /f
Write-Host "Done removing Sponsored Apps" Write-Host "Done removing Sponsored Apps"
Write-Host "Disabling Reserved Storage" Write-Host "Disabling Reserved Storage"
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d 0 /f reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d 0 /f
@ -351,8 +351,8 @@ public class PowerManagement {
Write-Host "Unmounting image..." Write-Host "Unmounting image..."
Dismount-WindowsImage -Path $scratchDir -Save Dismount-WindowsImage -Path $scratchDir -Save
} }
try { try {
Write-Host "Exporting image into $mountDir\sources\install2.wim" Write-Host "Exporting image into $mountDir\sources\install2.wim"
@ -368,7 +368,7 @@ public class PowerManagement {
} }
Write-Host "Windows image completed. Continuing with boot.wim." Write-Host "Windows image completed. Continuing with boot.wim."
# Next step boot image # Next step boot image
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir" Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir" Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
@ -380,12 +380,12 @@ public class PowerManagement {
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) " Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
} }
else else
{ {
Write-Host "Path to drivers is invalid continuing without driver injection" Write-Host "Path to drivers is invalid continuing without driver injection"
} }
} }
Write-Host "Loading registry..." Write-Host "Loading registry..."
reg load HKLM\zCOMPONENTS "$($scratchDir)\Windows\System32\config\COMPONENTS" >$null reg load HKLM\zCOMPONENTS "$($scratchDir)\Windows\System32\config\COMPONENTS" >$null
reg load HKLM\zDEFAULT "$($scratchDir)\Windows\System32\config\default" >$null reg load HKLM\zDEFAULT "$($scratchDir)\Windows\System32\config\default" >$null
@ -449,7 +449,7 @@ public class PowerManagement {
Copy-ToUSB("$($SaveDialog.FileName)") Copy-ToUSB("$($SaveDialog.FileName)")
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." } if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
} }
Write-Host " _____ " Write-Host " _____ "
Write-Host "(____ \ " Write-Host "(____ \ "
Write-Host " _ \ \ ___ ____ ____ " Write-Host " _ \ \ ___ ____ ____ "
@ -469,9 +469,9 @@ public class PowerManagement {
} else { } else {
Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed." Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed."
} }
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed' $sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso" #$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)" $sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"
# Allow the machine to sleep again (optional) # Allow the machine to sleep again (optional)

View File

@ -9,12 +9,12 @@ function Invoke-WPFOOSU {
$ProgressPreference = "SilentlyContinue" # Disables the Progress Bar to drasticly speed up Invoke-WebRequest $ProgressPreference = "SilentlyContinue" # Disables the Progress Bar to drasticly speed up Invoke-WebRequest
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
Write-Host "Starting OO Shutup 10 ..." Write-Host "Starting OO Shutup 10 ..."
Start-Process $OOSU_filepath Start-Process $OOSU_filepath
} }
catch { catch {
Write-Host "Error Downloading and Running OO Shutup 10" -ForegroundColor Red Write-Host "Error Downloading and Running OO Shutup 10" -ForegroundColor Red
} }
finally { finally {
$ProgressPreference = $Initial_ProgressPreference $ProgressPreference = $Initial_ProgressPreference
} }
} }

View File

@ -35,7 +35,7 @@ function Invoke-WPFPresets {
Write-Debug $_ Write-Debug $_
} }
} }
foreach ($CheckBox in $CheckBoxes) { foreach ($CheckBox in $CheckBoxes) {
$checkboxName = $CheckBox.Key $checkboxName = $CheckBox.Key

View File

@ -12,7 +12,7 @@ function Invoke-WPFTweakPS7{
) )
switch ($action) { switch ($action) {
"PS7"{ "PS7"{
if (Test-Path -Path "$env:ProgramFiles\PowerShell\7") { if (Test-Path -Path "$env:ProgramFiles\PowerShell\7") {
Write-Host "Powershell 7 is already installed." Write-Host "Powershell 7 is already installed."
} else { } else {
@ -41,6 +41,6 @@ function Invoke-WPFTweakPS7{
} }
} else { } else {
Write-Host "Settings file not found at $settingsPath" Write-Host "Settings file not found at $settingsPath"
} }
} }

View File

@ -13,7 +13,7 @@ function Invoke-WPFtweaksbutton {
} }
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"] $Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default"){ if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default"){

View File

@ -10,7 +10,7 @@ $InitialSessionState = [System.Management.Automation.Runspaces.InitialSessionSta
$InitialSessionState.Variables.Add($hashVars) $InitialSessionState.Variables.Add($hashVars)
# Get every private function and add them to the session state # Get every private function and add them to the session state
$functions = Get-ChildItem function:\ | Where-Object {$_.name -like "*winutil*" -or $_.name -like "*WPF*"} $functions = (Get-ChildItem function:\).where{$_.name -like "*winutil*" -or $_.name -like "*WPF*"}
foreach ($function in $functions){ foreach ($function in $functions){
$functionDefinition = Get-Content function:\$($function.name) $functionDefinition = Get-Content function:\$($function.name)
$functionEntry = New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList $($function.name), $functionDefinition $functionEntry = New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList $($function.name), $functionDefinition
@ -143,7 +143,7 @@ Invoke-WPFRunspace -ScriptBlock {
finally{ finally{
$ProgressPreference = "Continue" $ProgressPreference = "Continue"
} }
} | Out-Null } | Out-Null
#=========================================================================== #===========================================================================
@ -276,14 +276,14 @@ Add-Type @"
"@ "@
} }
foreach ($proc in (Get-Process | Where-Object { $_.MainWindowTitle -and $_.MainWindowTitle -like "*titus*" })) { foreach ($proc in (Get-Process).where{ $_.MainWindowTitle -and $_.MainWindowTitle -like "*titus*" }) {
# Check if the process's MainWindowHandle is valid # Check if the process's MainWindowHandle is valid
if ($proc.MainWindowHandle -ne [System.IntPtr]::Zero) { if ($proc.MainWindowHandle -ne [System.IntPtr]::Zero) {
Write-Debug "MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle) $($proc.MainWindowHandle)" Write-Debug "MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle) $($proc.MainWindowHandle)"
$windowHandle = $proc.MainWindowHandle $windowHandle = $proc.MainWindowHandle
} else { } else {
Write-Warning "Process found, but no MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle)" Write-Warning "Process found, but no MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle)"
} }
} }
@ -392,13 +392,13 @@ Add-Type @"
# Load Checkboxes and Labels outside of the Filter fuction only once on startup for performance reasons # Load Checkboxes and Labels outside of the Filter fuction only once on startup for performance reasons
$filter = Get-WinUtilVariables -Type CheckBox $filter = Get-WinUtilVariables -Type CheckBox
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $psitem.Key -in $filter } $CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
$filter = Get-WinUtilVariables -Type Label $filter = Get-WinUtilVariables -Type Label
$labels = @{} $labels = @{}
$sync.GetEnumerator() | Where-Object {$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value} ($sync.GetEnumerator()).where{$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value}
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category $allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
$sync["CheckboxFilter"].Add_TextChanged({ $sync["CheckboxFilter"].Add_TextChanged({
@ -499,6 +499,5 @@ Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sy
"@ "@
Show-CustomDialog -Message $authorInfo -Width 400 Show-CustomDialog -Message $authorInfo -Width 400
}) })
$sync["Form"].ShowDialog() | out-null $sync["Form"].ShowDialog() | out-null
Stop-Transcript Stop-Transcript

40
windev.ps1 Normal file
View File

@ -0,0 +1,40 @@
<#
.SYNOPSIS
This Script is used as a target for the https://christitus.com/windev alias.
It queries the latest winget release (no matter if Pre-Release, Draft or Full Release) and invokes It
.DESCRIPTION
This Script provides a simple way to always start the bleeding edge release even if it's not yet a full release.
This function should be run with administrative privileges.
Because this way of recursively invoking scripts via Invoke-Expression it might very well happen that AV Programs flag this because it's a common way of mulitstage exploits to run
.EXAMPLE
irm https://christitus.com/windev | iex
OR
Run in Admin Powershell > ./windev.ps1
#>
# Function to fetch the latest release tag from the GitHub API
function Get-LatestRelease {
try {
$releases = Invoke-RestMethod -Uri 'https://api.github.com/repos/ChrisTitusTech/winutil/releases'
$latestRelease = $releases | Select-Object -First 1
return $latestRelease.tag_name
} catch {
Write-Host "Error fetching release data: $_" -ForegroundColor Red
return $null
}
}
# Function to redirect to the latest pre-release version
function RedirectToLatestPreRelease {
$latestRelease = Get-LatestRelease
if ($latestRelease) {
$url = "https://raw.githubusercontent.com/ChrisTitusTech/winutil/$latestRelease/winutil.ps1"
Invoke-RestMethod $url | Invoke-Expression
} else {
Write-Host 'Unable to determine latest pre-release version.' -ForegroundColor Red
}
}
# Call the redirect function
RedirectToLatestPreRelease

File diff suppressed because it is too large Load Diff

View File

@ -186,7 +186,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ToggleButton"> <ControlTemplate TargetType="ToggleButton">
<Grid> <Grid>
<Border x:Name="ButtonGlow" <Border x:Name="ButtonGlow"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{ButtonForegroundColor}" BorderBrush="{ButtonForegroundColor}"
BorderThickness="{ButtonBorderThickness}" BorderThickness="{ButtonBorderThickness}"
@ -197,7 +197,7 @@
BorderBrush="{ButtonBackgroundColor}" BorderBrush="{ButtonBackgroundColor}"
BorderThickness="{ButtonBorderThickness}" BorderThickness="{ButtonBorderThickness}"
CornerRadius="{ButtonCornerRadius}"> CornerRadius="{ButtonCornerRadius}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="10,2,10,2"/> Margin="10,2,10,2"/>
</Border> </Border>
</Grid> </Grid>
@ -403,13 +403,13 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="ColorfulToggleSwitchStyle" TargetType="{x:Type CheckBox}"> <Style x:Key="ColorfulToggleSwitchStyle" TargetType="{x:Type CheckBox}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}"> <ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid x:Name="toggleSwitch"> <Grid x:Name="toggleSwitch">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@ -451,7 +451,7 @@
<Setter TargetName="Ellipse" Property="Fill" Value="{MainForegroundColor}" /> <Setter TargetName="Ellipse" Property="Fill" Value="{MainForegroundColor}" />
</Trigger> </Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True"> <Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="Border" Property="Background" Value="{MainBackgroundColor}" /> <Setter TargetName="Border" Property="Background" Value="{MainBackgroundColor}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{MainForegroundColor}" /> <Setter TargetName="Border" Property="BorderBrush" Value="{MainForegroundColor}" />
@ -465,11 +465,11 @@
To="{ToggleButtonOnColor}" Duration="0:0:0.1" /> To="{ToggleButtonOnColor}" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="Border" <ColorAnimation Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
To="{ToggleButtonOnColor}" Duration="0:0:0.1" /> To="{ToggleButtonOnColor}" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="Ellipse" <ColorAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)" Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)"
To="White" Duration="0:0:0.1" /> To="White" Duration="0:0:0.1" />
<ThicknessAnimation Storyboard.TargetName="Ellipse" <ThicknessAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="Margin" Storyboard.TargetProperty="Margin"
To="18,2,2,2" Duration="0:0:0.1" /> To="18,2,2,2" Duration="0:0:0.1" />
@ -554,9 +554,9 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TextBox"> <ControlTemplate TargetType="TextBox">
<Border Background="{TemplateBinding Background}" <Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"> CornerRadius="5">
<Grid> <Grid>
<ScrollViewer x:Name="PART_ContentHost" /> <ScrollViewer x:Name="PART_ContentHost" />
@ -593,7 +593,7 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DockPanel HorizontalAlignment="Stretch" Background="{MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Row="0" Width="Auto"> <DockPanel HorizontalAlignment="Stretch" Background="{MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Row="0" Width="Auto">
<Image Height="{ToggleButtonHeight}" Width="{ToggleButtonHeight}" Name="WPFIcon" <Image Height="{ToggleButtonHeight}" Width="{ToggleButtonHeight}" Name="WPFIcon"
SnapsToDevicePixels="True" Source="https://christitus.com/images/logo-full.png" Margin="10"/> SnapsToDevicePixels="True" Source="https://christitus.com/images/logo-full.png" Margin="10"/>
<ToggleButton HorizontalAlignment="Left" Height="{ToggleButtonHeight}" Width="100" <ToggleButton HorizontalAlignment="Left" Height="{ToggleButtonHeight}" Width="100"
Background="{ButtonInstallBackgroundColor}" Foreground="white" FontWeight="Bold" Name="WPFTab1BT"> Background="{ButtonInstallBackgroundColor}" Foreground="white" FontWeight="Bold" Name="WPFTab1BT">
@ -641,42 +641,42 @@
<ColumnDefinition Width="50px"/> <ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/> <ColumnDefinition Width="50px"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox <TextBox
Grid.Column="0" Grid.Column="0"
Width="200" Width="200"
FontSize="14" FontSize="14"
VerticalAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Left"
Height="25" Margin="10,0,0,0" BorderThickness="1" Padding="22,2,2,2" Height="25" Margin="10,0,0,0" BorderThickness="1" Padding="22,2,2,2"
Name="CheckboxFilter" Name="CheckboxFilter"
Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}" Foreground="{MainForegroundColor}" Background="{MainBackgroundColor}"
ToolTip="Press Ctrl-F and type app name to filter application list below. Press Esc to reset the filter"> ToolTip="Press Ctrl-F and type app name to filter application list below. Press Esc to reset the filter">
</TextBox> </TextBox>
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Left"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
FontSize="14" Margin="16,0,0,0">&#xE721;</TextBlock> FontSize="14" Margin="16,0,0,0">&#xE721;</TextBlock>
<Button Grid.Column="0" <Button Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Left"
Name="CheckboxFilterClear" Name="CheckboxFilterClear"
Style="{StaticResource ClearButtonStyle}" Style="{StaticResource ClearButtonStyle}"
Margin="193,0,0,0" Visibility="Collapsed"/> Margin="193,0,0,0" Visibility="Collapsed"/>
<Button Name="SettingsButton" <Button Name="SettingsButton"
Style="{StaticResource HoverButtonStyle}" Style="{StaticResource HoverButtonStyle}"
Grid.Column="1" BorderBrush="Transparent" Grid.Column="1" BorderBrush="Transparent"
Background="{MainBackgroundColor}" Background="{MainBackgroundColor}"
Foreground="{MainForegroundColor}" Foreground="{MainForegroundColor}"
FontSize="18" FontSize="18"
Width="35" Height="35" Width="35" Height="35"
HorizontalAlignment="Right" VerticalAlignment="Top" HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,5,5,0" Margin="0,5,5,0"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
Content="&#xE713;"/> Content="&#xE713;"/>
<Popup Grid.Column="1" Name="SettingsPopup" <Popup Grid.Column="1" Name="SettingsPopup"
IsOpen="False" IsOpen="False"
PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom" PlacementTarget="{Binding ElementName=SettingsButton}" Placement="Bottom"
HorizontalAlignment="Right" VerticalAlignment="Top"> HorizontalAlignment="Right" VerticalAlignment="Top">
<Border Background="{MainBackgroundColor}" BorderBrush="{MainForegroundColor}" BorderThickness="1" CornerRadius="0" Margin="0"> <Border Background="{MainBackgroundColor}" BorderBrush="{MainForegroundColor}" BorderThickness="1" CornerRadius="0" Margin="0">
<StackPanel Background="{MainBackgroundColor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <StackPanel Background="{MainBackgroundColor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
@ -687,25 +687,25 @@
</StackPanel> </StackPanel>
</Border> </Border>
</Popup> </Popup>
<Button <Button
Grid.Column="2" Grid.Column="2"
Content="&#xD7;" BorderThickness="0" Content="&#xD7;" BorderThickness="0"
BorderBrush="Transparent" BorderBrush="Transparent"
Background="{MainBackgroundColor}" Background="{MainBackgroundColor}"
Width="35" Height="35" Width="35" Height="35"
HorizontalAlignment="Right" VerticalAlignment="Top" HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,5,5,0" Margin="0,5,5,0"
FontFamily="Arial" FontFamily="Arial"
Foreground="{MainForegroundColor}" FontSize="18" Name="WPFCloseButton" /> Foreground="{MainForegroundColor}" FontSize="18" Name="WPFCloseButton" />
</Grid> </Grid>
</DockPanel> </DockPanel>
<TabControl Name="WPFTabNav" Background="Transparent" Width="Auto" Height="Auto" BorderBrush="Transparent" BorderThickness="0" Grid.Row="1" Grid.Column="0" Padding="-1"> <TabControl Name="WPFTabNav" Background="Transparent" Width="Auto" Height="Auto" BorderBrush="Transparent" BorderThickness="0" Grid.Row="1" Grid.Column="0" Padding="-1">
<TabItem Header="Install" Visibility="Collapsed" Name="WPFTab1"> <TabItem Header="Install" Visibility="Collapsed" Name="WPFTab1">
<Grid Background="Transparent" > <Grid Background="Transparent" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="45px"/> <RowDefinition Height="45px"/>
<RowDefinition Height="0.95*"/> <RowDefinition Height="0.95*"/>
@ -718,7 +718,7 @@
<Button Name="WPFclearWinget" Content=" Clear Selection" Margin="2"/> <Button Name="WPFclearWinget" Content=" Clear Selection" Margin="2"/>
</StackPanel> </StackPanel>
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Padding="-1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" <ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Padding="-1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
{{InstallPanel_applications}} {{InstallPanel_applications}}
@ -826,13 +826,13 @@
Margin="2" Margin="2"
IsReadOnly="False" IsReadOnly="False"
ToolTip="Alt Path For Scratch Directory" ToolTip="Alt Path For Scratch Directory"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Foreground="{LabelboxForegroundColor}"> Foreground="{LabelboxForegroundColor}">
</TextBox> </TextBox>
<Button Name="MicrowinScratchDirBT" <Button Name="MicrowinScratchDirBT"
Grid.Column="1" Grid.Column="1"
Margin="2" Margin="2"
Padding="1" VerticalAlignment="Center"> Padding="1" VerticalAlignment="Center">
<Button.Content> <Button.Content>
... ...
@ -895,10 +895,10 @@
<Grid Name = "BusyMessage" Visibility="Collapsed"> <Grid Name = "BusyMessage" Visibility="Collapsed">
<TextBlock Name = "BusyText" Text="NBusy" Padding="22,2,1,1" /> <TextBlock Name = "BusyText" Text="NBusy" Padding="22,2,1,1" />
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" FontFamily="Segoe MDL2 Assets" <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" FontFamily="Segoe MDL2 Assets"
FontSize="14" Margin="16,0,0,0">&#xE701;</TextBlock> FontSize="14" Margin="16,0,0,0">&#xE701;</TextBlock>
</Grid> </Grid>
<TextBlock x:Name = "asciiTextBlock" <TextBlock x:Name = "asciiTextBlock"
xml:space ="preserve" xml:space ="preserve"
HorizontalAlignment = "Center" HorizontalAlignment = "Center"
@ -909,16 +909,16 @@
FontSize = "10" FontSize = "10"
FontFamily = "Courier New" FontFamily = "Courier New"
> >
/\/\ (_) ___ _ __ ___ / / /\ \ \(_) _ __ /\/\ (_) ___ _ __ ___ / / /\ \ \(_) _ __
/ \ | | / __|| '__| / _ \ \ \/ \/ /| || '_ \ / \ | | / __|| '__| / _ \ \ \/ \/ /| || '_ \
/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | / /\/\ \| || (__ | | | (_) | \ /\ / | || | | |
\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| \/ \/|_| \___||_| \___/ \/ \/ |_||_| |_|
</TextBlock> </TextBlock>
<TextBlock Margin="15,15,15,0" <TextBlock Margin="15,15,15,0"
Padding="8,8,8,0" Padding="8,8,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
TextWrapping="WrapWithOverflow" TextWrapping="WrapWithOverflow"
Height = "Auto" Height = "Auto"
Width = "Auto" Width = "Auto"
Foreground="{ComboBoxForegroundColor}"> Foreground="{ComboBoxForegroundColor}">
@ -950,9 +950,9 @@
<LineBreak/> <LineBreak/>
If you are injecting drivers ensure you put all your inf, sys, and dll files for each driver into a separate directory If you are injecting drivers ensure you put all your inf, sys, and dll files for each driver into a separate directory
</TextBlock> </TextBlock>
<TextBlock Margin="15,0,15,15" <TextBlock Margin="15,0,15,15"
Padding = "1" Padding = "1"
TextWrapping="WrapWithOverflow" TextWrapping="WrapWithOverflow"
Height = "Auto" Height = "Auto"
Width = "Auto" Width = "Auto"
VerticalAlignment = "Top" VerticalAlignment = "Top"