Compare commits

..

No commits in common. "d4dc9aec9b171b561e15f5dcbf488483504546e3" and "b9cd563915470aa9529f293a85d613ba8718910e" have entirely different histories.

41 changed files with 1173 additions and 1437 deletions

11
.gitattributes vendored
View File

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

View File

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

View File

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

View File

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

View File

@ -10,22 +10,6 @@ $sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot
$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 = @"
################################################################################################################
### ###
@ -34,64 +18,48 @@ $header = @"
################################################################################################################
"@
# Create the script in memory.
Update-Progress "Pre-req: Allocating Memory" 0
$script_content = [System.Collections.Generic.List[string]]::new()
Update-Progress "Adding: Header" 5
Write-Progress -Activity "Compiling" -Status "Adding: Header" -PercentComplete 5
$script_content.Add($header)
Update-Progress "Adding: Version" 10
Write-Progress -Activity "Compiling" -Status "Adding: Version" -PercentComplete 10
$script_content.Add($(Get-Content .\scripts\start.ps1).replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)"))
Update-Progress "Adding: Functions" 20
Write-Progress -Activity "Compiling" -Status "Adding: Functions" -PercentComplete 20
Get-ChildItem .\functions -Recurse -File | ForEach-Object {
$script_content.Add($(Get-Content $psitem.FullName))
}
Update-Progress "Adding: Config *.json" 40
Write-Progress -Activity "Compiling" -Status "Adding: Config *.json" -PercentComplete 40
Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
$json = (Get-Content $psitem.FullName).replace("'","''")
# 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)
# 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
$firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object {
$_.Replace('=}','').Replace('@{','').Replace(' ','')
}
# Note:
# Avoid using HTML Entity Codes, for example '”' (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) {
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
$firstLevelName = $firstLevelJsonList[$i]
# Note: Avoid using HTML Entity Codes (for example '”' (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) {
$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('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;')
$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) {
$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('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;')
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop
}
}
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
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")
# 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
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
@ -102,13 +70,13 @@ $xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")
# Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1
Update-Progress "Building: Xaml " 75
Write-Progress -Activity "Compiling" -Status "Building: Xaml " -PercentComplete 75
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"
Update-Progress "Adding: Xaml " 90
Write-Progress -Activity "Compiling" -Status "Adding: Xaml " -PercentComplete 90
# Replace the placeholder in $inputXML with the content of inputApp.xaml
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
@ -119,13 +87,13 @@ $script_content.Add($(Write-output "`$inputXML = '$xaml'"))
$script_content.Add($(Get-Content .\scripts\main.ps1))
if ($Debug){
Update-Progress "Writing debug files" 95
Write-Progress -Activity "Compiling" -Status "Writing debug files" -PercentComplete 95
$appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii
$tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
$featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
}
else {
Update-Progress "Removing temporary files" 99
Write-Progress -Activity "Compiling" -Status "Removing temporary files" -PercentComplete 99
Remove-Item ".\xaml\inputApp.xaml" -ErrorAction SilentlyContinue
Remove-Item ".\xaml\inputTweaks.xaml" -ErrorAction SilentlyContinue
Remove-Item ".\xaml\inputFeatures.xaml" -ErrorAction SilentlyContinue
@ -141,5 +109,5 @@ if ($run){
catch {
Start-Process -FilePath "powershell" -ArgumentList ".\$scriptname"
}
}
}

View File

@ -1,8 +1,6 @@
# Chris Titus Tech's Windows Utility
[![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.
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)
@ -24,19 +22,24 @@ Winutil must be run in Admin mode because it performs system-wide tweaks. To ach
#### Simple way
```ps1
irm "https://christitus.com/win" | iex
```
Courtesy of the issue: [#144](/../../issues/144)
irm https://christitus.com/win | iex
```
Courtesy of the issue raised at: [#144](/../../issues/144)
If this site is not reachable from your country, please try running it directly from GitHub.
```ps1
or by executing:
```
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
```
#### Automation
Some features are available through automation. This allows you to save your config file pass it to Winutil walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
Some features are 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
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)
@ -80,15 +83,15 @@ If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.
- 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.
- 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.
- 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.
- 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.
@ -110,7 +113,7 @@ If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.
- 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.
- Disable All Updates (Not Recommended!): Allows users to disable all Windows updates, but it's not recommended due to potential security risks.
@ -124,7 +127,7 @@ If you encounter any challenges or problems with the script, I kindly request th
## 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!

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -84,7 +84,7 @@
"
Write-Host \"Turn on Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait
# 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-dc 60\" -NoNewWindow -Wait
@ -96,14 +96,14 @@
"
Write-Host \"Turn off Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait
# 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-dc 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
"
]
]
},
"WPFTweaksHome": {
"Content": "Disable Homegroup",
@ -2245,7 +2245,7 @@
Write-Host \"Please run this script as an administrator.\"
return
}
# Check if System Restore is enabled for the main drive
try {
# Try getting restore points to check if System Restore is enabled
@ -2253,14 +2253,14 @@
} catch {
Write-Host \"An error occurred while enabling System Restore: $_\"
}
# Check if the SystemRestorePointCreationFrequency value exists
$exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue
if($null -eq $exists){
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
}
# Attempt to load the required module for Get-ComputerRestorePoint
try {
Import-Module Microsoft.PowerShell.Management -ErrorAction Stop
@ -2268,7 +2268,7 @@
Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\"
return
}
# Get all the restore points for the current day
try {
$existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date }
@ -2276,11 +2276,11 @@
Write-Host \"Failed to retrieve restore points: $_\"
return
}
# Check if there is already a restore point created today
if ($existingRestorePoints.Count -eq 0) {
$description = \"System Restore Point created by WinUtil\"
Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\"
Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\"
}
@ -2358,7 +2358,7 @@
"Order": "a025_",
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot",
"Name": "TurnOffWindowsCopilot",
"Type": "DWord",
@ -2383,7 +2383,7 @@
"InvokeScript": [
"
Write-Host \"Remove Copilot\"
dism /online /remove-package /package-name:Microsoft.Windows.Copilot
dism /online /remove-package /package-name:Microsoft.Windows.Copilot
"
],
"UndoScript": [
@ -2402,11 +2402,11 @@
"InvokeScript": [
"
Write-Host \"Kill LMS\"
$serviceName = \"LMS\"
$serviceName = \"LMS\"
Write-Host \"Stopping and disabling service: $serviceName\"
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue;
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue;
Write-Host \"Removing service: $serviceName\";
sc.exe delete $serviceName;
@ -2421,7 +2421,7 @@
} else {
Write-Host \"All found LMS driver packages have been removed.\";
}
Write-Host \"Searching and deleting LMS executable files\";
$programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\");
$lmsFiles = @();
@ -2439,7 +2439,7 @@
Write-Host \"No LMS.exe files found in Program Files directories.\";
} else {
Write-Host \"All found LMS.exe files have been deleted.\";
}
}
Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.';
"
],
@ -2449,95 +2449,82 @@
"
]
},
},
"WPFTweaksRemoveOnedrive": {
"Content": "Remove OneDrive",
"Description": "Moves OneDrive files to Default Home Folders and Uninstalls it.",
"Description": "Copies OneDrive files to Default Home Folders and Uninstalls it.",
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"Order": "a030_",
"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 \"Removing OneDrive leftovers\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
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 \"Kill OneDrive process\"
taskkill.exe /F /IM \"OneDrive.exe\"
taskkill.exe /F /IM \"explorer.exe\"
Write-Host \"Remove Onedrive from explorer sidebar\"
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 \"Copy all OneDrive to Root UserProfile\"
Start-Process -FilePath powershell -ArgumentList \"robocopy '$($env:USERPROFILE.TrimEnd())\\OneDrive' '$($env:USERPROFILE.TrimEnd())\\' /e /xj\" -NoNewWindow -Wait
Write-Host \"Removing run hook for new users\"
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 \"Remove OneDrive\"
Start-Process -FilePath winget -ArgumentList \"uninstall -e --purge --force --silent Microsoft.OneDrive \" -NoNewWindow -Wait
Write-Host \"Removing startmenu entry\"
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
Write-Host \"Removing OneDrive leftovers\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
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 \"Removing scheduled task\"
Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
Write-Host \"Remove Onedrive from explorer sidebar\"
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
# Add Shell folders restoring default locations
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\"
taskkill.exe /F /IM \"explorer.exe\"
Start-Process \"explorer.exe\"
Write-Host \"Removing run hook for new users\"
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 \"Waiting for explorer to complete loading\"
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
Start-Sleep 5
}
else{
Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red
}
"
Write-Host \"Removing startmenu entry\"
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
Write-Host \"Removing scheduled task\"
Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
# Add Shell folders restoring default locations
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": [
"
@ -2574,25 +2561,25 @@
"Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates",
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"Order": "a021_",
"Order": "a021_",
"InvokeScript": [
"
function CCStopper {
$path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
# Test if the path exists before proceeding
if (Test-Path $path) {
Takeown /f $path
$acl = Get-Acl $path
$acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\")
$acl | Set-Acl $path
Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force
} else {
Write-Host \"Adobe Desktop Service is not in the default location.\"
}
}
function AcrobatUpdates {
# Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script.
@ -2602,12 +2589,12 @@
# 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
# = 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\"
# Get all subkeys under the specified root path
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
# Loop through each subkey
foreach ($subKey in $subKeys) {
# Get the full registry path
@ -2630,7 +2617,7 @@
function RestoreCCService {
$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\"
if (Test-Path -Path $originalPath) {
Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force
Write-Host \"Adobe Desktop Service has been restored.\"
@ -2642,12 +2629,12 @@
function AcrobatUpdates {
# Default Value:
# 3 = Automatically download and install updates
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
# Get all subkeys under the specified root path
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
# Loop through each subkey
foreach ($subKey in $subKeys) {
# Get the full registry path
@ -2722,14 +2709,14 @@
"Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. Credit: Ruddernation-Designs",
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"Order": "a021_",
"Order": "a021_",
"InvokeScript": [
"
# 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\"
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
$tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\"
# Download the remote HOSTS file to a temporary location
try {
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
@ -2738,11 +2725,11 @@
catch {
Write-Error \"Failed to download the HOSTS file. Error: $_\"
}
# Check if the AdobeNetBlock has already been started
try {
$localHostsContent = Get-Content $localHostsPath -ErrorAction Stop
# Check if AdobeNetBlock markers exist
$blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\"
if ($blockStartExists) {
@ -2753,10 +2740,10 @@
$newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments
$newBlockHeader = \"#AdobeNetBlock-start\"
$newBlockFooter = \"#AdobeNetBlock-end\"
# Combine the contents, ensuring new block is properly formatted
$combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String
# Write the combined content back to the original HOSTS file
$combinedContent | Set-Content $localHostsPath -Encoding ASCII
Write-Output \"Successfully added the AdobeNetBlock.\"
@ -2765,10 +2752,10 @@
catch {
Write-Error \"Error during processing: $_\"
}
# Clean up temporary file
Remove-Item $tempHostsPath -ErrorAction Ignore
# Flush the DNS resolver cache
try {
Invoke-Expression \"ipconfig /flushdns\"
@ -2783,7 +2770,7 @@
"
# Define the local path of the HOSTS file
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
# Load the content of the HOSTS file
try {
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop
@ -2792,11 +2779,11 @@
Write-Error \"Failed to load the HOSTS file. Error: $_\"
return
}
# Initialize flags and buffer for new content
$recording = $true
$newContent = @()
# Iterate over each line of the HOSTS file
foreach ($line in $hostsContent) {
if ($line -match \"#AdobeNetBlock-start\") {
@ -2809,7 +2796,7 @@
$recording = $true
}
}
# Write the filtered content back to the HOSTS file
try {
$newContent | Set-Content $localHostsPath -Encoding ASCII
@ -2818,7 +2805,7 @@
catch {
Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
}
# Flush the DNS resolver cache
try {
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\MSEdgeHTM' -recurse -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 >''
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') {
@ -54,7 +54,7 @@ function global:prepare_edge {
}
## helper for webview reinstall - restore webexperience (widgets) if available
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: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}
@ -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
$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}
prepare_edge
## 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 ($appx in $($provisioned |where {$_.PackageName -like "*$choice*"})) {
$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
ni "$store\Deprovisioned\$PackageFamilyName" -force >''; $PackageFamilyName
$PackageName = $appx.PackageName; $PackageFamilyName = ($appxpackage |where {$_.Name -eq $appx.DisplayName}).PackageFamilyName
ni "$store\Deprovisioned\$PackageFamilyName" -force >''; $PackageFamilyName
foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageName" -force >''} ; $eol += $PackageName
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >''
remove-appxprovisionedpackage -packagename $PackageName -online -allusers >''
}
foreach ($appx in $($appxpackage |where {$_.PackageFullName -like "*$choice*"})) {
$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
foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageFullName" -force >''} ; $eol += $PackageFullName
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') {
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
}
}
}}
$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\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 >''} }
## 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') {
ni "$p\Microsoft\EdgeUpdate" -force >''
sp "$p\Microsoft\EdgeUpdate" 'InstallDefault' 0 -type Dword -force

View File

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

View File

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

View File

@ -1,17 +1,17 @@
function Get-LocalizedYesNo {
<#
.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
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>".
.EXAMPLE
$yesNoArray = Get-LocalizedYesNo
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
#>
# 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.
# eg. English: [Y,N]?
@ -21,7 +21,7 @@ function Get-LocalizedYesNo {
# Spanish: [S,N]?
# Italian: [S,N]?
# Russian: [Y,N]?
$line = cmd /c "choice <nul 2>nul"
$charactersArray = @()
$regexPattern = '([a-zA-Z])'
@ -30,5 +30,4 @@ function Get-LocalizedYesNo {
Write-Debug "According to takeown.exe local Yes is $charactersArray[0]"
# Return the array of characters
return $charactersArray
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,8 +5,8 @@ function Get-WinUtilWingetLatest {
.DESCRIPTION
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
$PreviousProgressPreference = $ProgressPreference
# 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
$ProgressPreference = "silentlyContinue"
Try{
# Grabs the latest release of Winget from the Github API for the install process.

View File

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

View File

@ -1,30 +1,30 @@
Function Install-WinUtilProgramWinget {
<#
.SYNOPSIS
Manages the provided programs using Winget
.PARAMETER ProgramsToInstall
A list of programs to manage
.PARAMETER manage
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
.NOTES
The triple quotes are required any time you need a " in a normal script block.
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
#>
param(
[Parameter(Mandatory, Position=0)]
[PsCustomObject]$ProgramsToInstall,
[Parameter(Position=1)]
[String]$manage = "Installing"
)
$x = 0
$count = $ProgramsToInstall.Count
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
Write-Host "==========================================="
Write-Host "-- Configuring winget packages ---"
@ -33,7 +33,7 @@ Function Install-WinUtilProgramWinget {
$failedPackages = @()
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
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.
# 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.

View File

@ -41,7 +41,7 @@ function Install-WinUtilWinget {
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
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 "Enabling NuGet and Module..."
Install-PackageProvider -Name NuGet -Force

View File

@ -105,8 +105,8 @@ function Remove-Packages
$_ -NotLike "*DesktopAppInstaller*" -AND
$_ -NotLike "*WebMediaExtensions*" -AND
$_ -NotLike "*WMIC*" -AND
$_ -NotLike "*UI.XaML*"
}
$_ -NotLike "*UI.XaML*"
}
foreach ($pkg in $pkglist)
{
@ -148,9 +148,9 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
$_.PackageName -NotLike "*Notepad*" -and
$_.PackageName -NotLike "*Printing*" -and
$_.PackageName -NotLike "*Wifi*" -and
$_.PackageName -NotLike "*Foundation*"
}
$_.PackageName -NotLike "*Foundation*"
}
if ($?)
{
if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }}
@ -165,7 +165,7 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
catch {
Write-Host "Application $($appx.PackageName) could not be removed"
continue
}
}
}
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
# # 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
# icacls "$($directoryPath)" /q /c /t /reset > $null
# icacls $directoryPath /setowner "*S-1-5-32-544"
# icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
# Remove-Item -Path $directoryPath -Recurse -Force
$itemsToDelete = [System.Collections.ArrayList]::new()
if ($mask -eq "")
@ -231,9 +231,9 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
Write-Debug "Adding $($pathToDelete) to array."
[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 }
else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
}
@ -243,7 +243,7 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
$status = "Deleting $($itemToDelete)"
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)"
@ -463,16 +463,16 @@ function New-FirstRun {
param (
[Parameter(Mandatory = $true)]
[string]$RegistryPath,
[Parameter(Mandatory = $true)]
[string]$ValueName
)
# Check if the registry path exists
if (Test-Path -Path $RegistryPath)
{
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
# Check if the registry value exists
if ($registryValue)
{
@ -490,7 +490,7 @@ function New-FirstRun {
Write-Host "Registry path '$RegistryPath' not found."
}
}
function Stop-UnnecessaryServices
{
$servicesToExclude = @(
@ -556,8 +556,8 @@ function New-FirstRun {
"vm3dservice",
"webthreatdefusersvc_dc2a4",
"wscsvc"
)
)
$runningServices = Get-Service | Where-Object { $servicesToExclude -notcontains $_.Name }
foreach($service in $runningServices)
{
@ -566,28 +566,28 @@ function New-FirstRun {
"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
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value 1
Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value 1
# figure this out later how to set updates to security only
#Import-Module -Name PSWindowsUpdate;
#Import-Module -Name PSWindowsUpdate;
#Stop-Service -Name wuauserv
#Set-WUSettings -MicrosoftUpdateEnabled -AutoUpdateOption 'Never'
#Start-Service -Name wuauserv
Stop-UnnecessaryServices
$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
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 "Favorites"
# Stop-Process -Name explorer -Force
$process = Get-Process -Name "explorer"
@ -599,9 +599,9 @@ function New-FirstRun {
# Delete Edge Icon from the desktop
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
# 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-Item -Path $shortcutFile.FullName -Force
@ -621,7 +621,7 @@ function New-FirstRun {
$shortcutPath = Join-Path $desktopPath 'winutil.lnk'
# Create a shell object
$shell = New-Object -ComObject WScript.Shell
# Create a shortcut object
$shortcut = $shell.CreateShortcut($shortcutPath)
@ -629,26 +629,26 @@ function New-FirstRun {
{
$shortcut.IconLocation = "c:\Windows\cttlogo.png"
}
# Set properties of the shortcut
$shortcut.TargetPath = "powershell.exe"
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
# Save the shortcut
$shortcut.Save()
# Make the shortcut have 'Run as administrator' property on
$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
$bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
Write-Host "Shortcut created at: $shortcutPath"
#
#
# Done create WinUtil shortcut on the desktop
# ************************************************
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
$MouseThreshold1 = 6
$MouseThreshold2 = 10
}
}
else {
Write-Host "Disabling Mouse Acceleration"
$MouseSpeed = 0
$MouseThreshold1 = 0
$MouseThreshold2 = 0
$MouseThreshold2 = 0
}
$Path = "HKCU:\Control Panel\Mouse"

View File

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

View File

@ -50,7 +50,7 @@ function Invoke-WinUtilTweaks {
Write-Debug "KeepServiceStartup is $KeepServiceStartup"
$sync.configs.tweaks.$CheckBox.service | ForEach-Object {
$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
if($KeepServiceStartup -AND !($undo)) {
try {

View File

@ -2,10 +2,10 @@ function Show-CustomDialog {
<#
.SYNOPSIS
Displays a custom dialog box with an image, heading, message, and an OK button.
.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.
.PARAMETER Message
The message to be displayed in the dialog box.
@ -14,10 +14,10 @@ function Show-CustomDialog {
.PARAMETER Height
The height of the custom dialog window.
.EXAMPLE
Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
#>
param(
[string]$Message,
@ -99,7 +99,7 @@ function Show-CustomDialog {
$grid.RowDefinitions.Add($row0)
$grid.RowDefinitions.Add($row1)
$grid.RowDefinitions.Add($row2)
# Add StackPanel for horizontal layout with margins
$stackPanel = New-Object Windows.Controls.StackPanel
$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.Width = 25
$viewbox.Height = 25
# Combine the paths into a single string
# $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
@ -159,7 +159,7 @@ $cttLogoPath = @"
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
"@
# Add SVG path
$svgPath = New-Object Windows.Shapes.Path
$svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath)
@ -167,7 +167,7 @@ $cttLogoPath = @"
# Add SVG path to Viewbox
$viewbox.Child = $svgPath
# Add SVG path to the stack panel
$stackPanel.Children.Add($viewbox)
@ -215,7 +215,7 @@ $cttLogoPath = @"
param($sender, $args)
$sender.Foreground = $foregroundColor
})
$messageTextBlock.Inlines.Add($hyperlink)
# Update the last position

View File

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

View File

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

View File

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

View File

@ -22,18 +22,18 @@ function Invoke-WPFGetIso {
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)
Write-Host "oscdimg.exe on system: $oscdImgFound"
if (!$oscdImgFound)
if (!$oscdImgFound)
{
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
$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
[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
@ -41,7 +41,7 @@ function Invoke-WPFGetIso {
Install-WinUtilChoco
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
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")
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."
return
}
else
else
{
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() '\'
}
# Detect if the folders already exist and remove them
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
{
@ -164,7 +164,7 @@ function Invoke-WPFGetIso {
$randomMicrowin = "Microwin_${timestamp}_${randomNumber}"
$randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}"
$sync.BusyText.Text=" - Mounting"
Write-Host "Mounting Iso. Please wait."
Write-Host "Mounting Iso. Please wait."
if ($sync.MicrowinScratchDirBox.Text -eq "") {
$mountDir = Join-Path $env:TEMP $randomMicrowin
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
@ -180,12 +180,12 @@ function Invoke-WPFGetIso {
Write-Host "Image dir is $mountDir"
try {
#$data = @($driveLetter, $filePath)
New-Item -ItemType Directory -Force -Path "$($mountDir)" | 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!"
# 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
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" $mountDir -Recurse -Force }

View File

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

View File

@ -92,7 +92,7 @@ public class PowerManagement {
$mountDirExists = Test-Path $mountDir
$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."
return
@ -149,7 +149,7 @@ public class PowerManagement {
if (Test-Path "$env:TEMP\DRV_EXPORT")
{
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
}
}
}
}
@ -161,7 +161,7 @@ public class PowerManagement {
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
}
else
else
{
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
# 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\WebThreatDefSvc" -Directory
# 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"
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\InboxApps" -Directory
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\Windows Photo Viewer" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
@ -285,7 +285,7 @@ public class PowerManagement {
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\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
# Write-Host Error code $LASTEXITCODE
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\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d '{\"pinnedList\": [{}]}' /f
Write-Host "Done removing Sponsored Apps"
Write-Host "Disabling Reserved Storage"
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..."
Dismount-WindowsImage -Path $scratchDir -Save
}
}
try {
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."
# Next step boot image
# Next step boot image
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $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) "
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 "Loading registry..."
reg load HKLM\zCOMPONENTS "$($scratchDir)\Windows\System32\config\COMPONENTS" >$null
reg load HKLM\zDEFAULT "$($scratchDir)\Windows\System32\config\default" >$null
@ -449,7 +449,7 @@ public class PowerManagement {
Copy-ToUSB("$($SaveDialog.FileName)")
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
}
Write-Host " _____ "
Write-Host "(____ \ "
Write-Host " _ \ \ ___ ____ ____ "
@ -469,9 +469,9 @@ public class PowerManagement {
} else {
Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed."
}
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"
# 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
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
Write-Host "Starting OO Shutup 10 ..."
Start-Process $OOSU_filepath
Start-Process $OOSU_filepath
}
catch {
Write-Host "Error Downloading and Running OO Shutup 10" -ForegroundColor Red
}
finally {
$ProgressPreference = $Initial_ProgressPreference
}
}
}

View File

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

View File

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

View File

@ -13,7 +13,7 @@ function Invoke-WPFtweaksbutton {
}
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
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)
# Get every private function and add them to the session state
$functions = (Get-ChildItem function:\).where{$_.name -like "*winutil*" -or $_.name -like "*WPF*"}
$functions = Get-ChildItem function:\ | Where-Object {$_.name -like "*winutil*" -or $_.name -like "*WPF*"}
foreach ($function in $functions){
$functionDefinition = Get-Content function:\$($function.name)
$functionEntry = New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList $($function.name), $functionDefinition
@ -143,7 +143,7 @@ Invoke-WPFRunspace -ScriptBlock {
finally{
$ProgressPreference = "Continue"
}
} | Out-Null
#===========================================================================
@ -276,14 +276,14 @@ Add-Type @"
"@
}
foreach ($proc in (Get-Process).where{ $_.MainWindowTitle -and $_.MainWindowTitle -like "*titus*" }) {
foreach ($proc in (Get-Process | Where-Object { $_.MainWindowTitle -and $_.MainWindowTitle -like "*titus*" })) {
# Check if the process's MainWindowHandle is valid
if ($proc.MainWindowHandle -ne [System.IntPtr]::Zero) {
Write-Debug "MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle) $($proc.MainWindowHandle)"
$windowHandle = $proc.MainWindowHandle
} else {
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
$filter = Get-WinUtilVariables -Type CheckBox
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $psitem.Key -in $filter }
$filter = Get-WinUtilVariables -Type Label
$labels = @{}
($sync.GetEnumerator()).where{$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value}
$sync.GetEnumerator() | Where-Object {$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({
@ -499,5 +499,6 @@ Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sy
"@
Show-CustomDialog -Message $authorInfo -Width 400
})
$sync["Form"].ShowDialog() | out-null
Stop-Transcript

View File

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