Remove trailing whitespace characters (#2149)

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

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

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

* Remove All Trailing Whitespace Characters in Different Files

* Remove Even More Trailing Whitespace Characters
This commit is contained in:
Mr.k 2024-06-29 01:15:39 +03:00 committed by GitHub
parent 6c49a8f2c9
commit 1891ea7966
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 282 additions and 281 deletions

View File

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

View File

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

View File

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

View File

@ -141,5 +141,5 @@ if ($run){
catch { catch {
Start-Process -FilePath "powershell" -ArgumentList ".\$scriptname" Start-Process -FilePath "powershell" -ArgumentList ".\$scriptname"
} }
} }

View File

@ -2,7 +2,7 @@
[![Version](https://img.shields.io/github/v/release/ChrisTitusTech/winutil?color=7a39fb)](https://github.com/ChrisTitusTech/winutil/releases/latest) [![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) ![screen-install](screen-install.png)
@ -29,7 +29,7 @@ irm https://christitus.com/win | iex
``` ```
Courtesy of the issue raised at: [#144](/../../issues/144) Courtesy of the issue raised at: [#144](/../../issues/144)
or by executing: or by executing:
``` ```
iwr -useb https://christitus.com/win | iex iwr -useb https://christitus.com/win | iex
``` ```
@ -85,15 +85,15 @@ If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.
- Install - Install
- Install Selection: Organize programs by category and facilitate installation by enabling users to select programs and initiate the installation process with a single click. - Install Selection: Organize programs by category and facilitate installation by enabling users to select programs and initiate the installation process with a single click.
- Upgrade All: Upgrade all existing programs to their latest versions, ensuring users have the most up-to-date and feature-rich software. - Upgrade All: Upgrade all existing programs to their latest versions, ensuring users have the most up-to-date and feature-rich software.
- Uninstall Selection: Effortlessly uninstall selected programs, providing users with a streamlined way to remove unwanted software from their system. - Uninstall Selection: Effortlessly uninstall selected programs, providing users with a streamlined way to remove unwanted software from their system.
- Get Installed: Retrieve a comprehensive list of installed programs on the system, offering users visibility into the software currently installed on their computer. - Get Installed: Retrieve a comprehensive list of installed programs on the system, offering users visibility into the software currently installed on their computer.
- Import / Export: Enable users to import or export the selection list of programs, allowing them to save their preferred program configurations or share them with others. This feature promotes convenience and flexibility in managing program selections across different systems. - Import / Export: Enable users to import or export the selection list of programs, allowing them to save their preferred program configurations or share them with others. This feature promotes convenience and flexibility in managing program selections across different systems.
- Tweaks - Tweaks
- Recommended Selection: Provides pre-defined templates tailored for desktop, laptop, and minimal configurations, allowing users to select recommended settings and optimizations specific to their system type. - Recommended Selection: Provides pre-defined templates tailored for desktop, laptop, and minimal configurations, allowing users to select recommended settings and optimizations specific to their system type.
@ -115,7 +115,7 @@ If you are still having issues try changing your DNS provider to 1.1.1.1 || 1.0.
- Updates: - Updates:
- Default (Out of Box) Settings: Provides the default settings that come with Windows for updates. - Default (Out of Box) Settings: Provides the default settings that come with Windows for updates.
- Security (Recommended) Settings: Offers recommended settings, including a slight delay of feature updates by 2 years and installation of security updates 4 days after release. - Security (Recommended) Settings: Offers recommended settings, including a slight delay of feature updates by 2 years and installation of security updates 4 days after release.
- Disable All Updates (Not Recommended!): Allows users to disable all Windows updates, but it's not recommended due to potential security risks. - Disable All Updates (Not Recommended!): Allows users to disable all Windows updates, but it's not recommended due to potential security risks.
@ -129,7 +129,7 @@ If you encounter any challenges or problems with the script, I kindly request th
## Contribute Code ## Contribute Code
Pull Requests are now handled directly on the MAIN branch. This was done since we can now select specific releases to launch via releases in GitHub. Pull Requests are now handled directly on the MAIN branch. This was done since we can now select specific releases to launch via releases in GitHub.
If doing a code change and you can submit a PR to main branch, but I am very selective about these. Do not use a code formatter, massive amounts of line changes, and make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN Pull Request! If doing a code change and you can submit a PR to main branch, but I am very selective about these. Do not use a code formatter, massive amounts of line changes, and make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN Pull Request!

View File

@ -134,7 +134,7 @@
"description": "Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.", "description": "Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.",
"link": "https://docs.microsoft.com/sql/azure-data-studio/what-is-azure-data-studio", "link": "https://docs.microsoft.com/sql/azure-data-studio/what-is-azure-data-studio",
"winget": "Microsoft.AzureDataStudio" "winget": "Microsoft.AzureDataStudio"
}, },
"barrier": { "barrier": {
"category": "Utilities", "category": "Utilities",
"choco": "barrier", "choco": "barrier",

View File

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

View File

@ -84,7 +84,7 @@
" "
Write-Host \"Turn on Hibernation\" Write-Host \"Turn on Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait
# Set hibernation as the default action # Set hibernation as the default action
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait
@ -96,14 +96,14 @@
" "
Write-Host \"Turn off Hibernation\" Write-Host \"Turn off Hibernation\"
Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait
# Set standby to detault values # Set standby to detault values
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait
Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait
" "
] ]
}, },
"WPFTweaksHome": { "WPFTweaksHome": {
"Content": "Disable Homegroup", "Content": "Disable Homegroup",
@ -2245,7 +2245,7 @@
Write-Host \"Please run this script as an administrator.\" Write-Host \"Please run this script as an administrator.\"
return return
} }
# Check if System Restore is enabled for the main drive # Check if System Restore is enabled for the main drive
try { try {
# Try getting restore points to check if System Restore is enabled # Try getting restore points to check if System Restore is enabled
@ -2253,14 +2253,14 @@
} catch { } catch {
Write-Host \"An error occurred while enabling System Restore: $_\" Write-Host \"An error occurred while enabling System Restore: $_\"
} }
# Check if the SystemRestorePointCreationFrequency value exists # Check if the SystemRestorePointCreationFrequency value exists
$exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue $exists = Get-ItemProperty -path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -ErrorAction SilentlyContinue
if($null -eq $exists){ if($null -eq $exists){
write-host 'Changing system to allow multiple restore points per day' write-host 'Changing system to allow multiple restore points per day'
Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null
} }
# Attempt to load the required module for Get-ComputerRestorePoint # Attempt to load the required module for Get-ComputerRestorePoint
try { try {
Import-Module Microsoft.PowerShell.Management -ErrorAction Stop Import-Module Microsoft.PowerShell.Management -ErrorAction Stop
@ -2268,7 +2268,7 @@
Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\" Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\"
return return
} }
# Get all the restore points for the current day # Get all the restore points for the current day
try { try {
$existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date } $existingRestorePoints = Get-ComputerRestorePoint | Where-Object { $_.CreationTime.Date -eq (Get-Date).Date }
@ -2276,11 +2276,11 @@
Write-Host \"Failed to retrieve restore points: $_\" Write-Host \"Failed to retrieve restore points: $_\"
return return
} }
# Check if there is already a restore point created today # Check if there is already a restore point created today
if ($existingRestorePoints.Count -eq 0) { if ($existingRestorePoints.Count -eq 0) {
$description = \"System Restore Point created by WinUtil\" $description = \"System Restore Point created by WinUtil\"
Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\" Checkpoint-Computer -Description $description -RestorePointType \"MODIFY_SETTINGS\"
Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\" Write-Host -ForegroundColor Green \"System Restore Point Created Successfully\"
} }
@ -2358,7 +2358,7 @@
"Order": "a025_", "Order": "a025_",
"registry": [ "registry": [
{ {
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot", "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot",
"Name": "TurnOffWindowsCopilot", "Name": "TurnOffWindowsCopilot",
"Type": "DWord", "Type": "DWord",
@ -2383,7 +2383,7 @@
"InvokeScript": [ "InvokeScript": [
" "
Write-Host \"Remove Copilot\" Write-Host \"Remove Copilot\"
dism /online /remove-package /package-name:Microsoft.Windows.Copilot dism /online /remove-package /package-name:Microsoft.Windows.Copilot
" "
], ],
"UndoScript": [ "UndoScript": [
@ -2402,11 +2402,11 @@
"InvokeScript": [ "InvokeScript": [
" "
Write-Host \"Kill LMS\" Write-Host \"Kill LMS\"
$serviceName = \"LMS\" $serviceName = \"LMS\"
Write-Host \"Stopping and disabling service: $serviceName\" Write-Host \"Stopping and disabling service: $serviceName\"
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue; Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue;
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue; Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue;
Write-Host \"Removing service: $serviceName\"; Write-Host \"Removing service: $serviceName\";
sc.exe delete $serviceName; sc.exe delete $serviceName;
@ -2421,7 +2421,7 @@
} else { } else {
Write-Host \"All found LMS driver packages have been removed.\"; Write-Host \"All found LMS driver packages have been removed.\";
} }
Write-Host \"Searching and deleting LMS executable files\"; Write-Host \"Searching and deleting LMS executable files\";
$programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\"); $programFilesDirs = @(\"C:\\Program Files\", \"C:\\Program Files (x86)\");
$lmsFiles = @(); $lmsFiles = @();
@ -2439,7 +2439,7 @@
Write-Host \"No LMS.exe files found in Program Files directories.\"; Write-Host \"No LMS.exe files found in Program Files directories.\";
} else { } else {
Write-Host \"All found LMS.exe files have been deleted.\"; Write-Host \"All found LMS.exe files have been deleted.\";
} }
Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.'; Write-Host 'Intel LMS vPro service has been disabled, removed, and blocked.';
" "
], ],
@ -2449,7 +2449,7 @@
" "
] ]
}, },
"WPFTweaksRemoveOnedrive": { "WPFTweaksRemoveOnedrive": {
"Content": "Remove OneDrive", "Content": "Remove OneDrive",
"Description": "Moves OneDrive files to Default Home Folders and Uninstalls it.", "Description": "Moves OneDrive files to Default Home Folders and Uninstalls it.",
@ -2457,7 +2457,7 @@
"panel": "1", "panel": "1",
"Order": "a030_", "Order": "a030_",
"InvokeScript": [ "InvokeScript": [
" "
$OneDrivePath = $($env:OneDrive) $OneDrivePath = $($env:OneDrive)
Write-Host \"Removing OneDrive\" Write-Host \"Removing OneDrive\"
$regPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OneDriveSetup.exe\" $regPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OneDriveSetup.exe\"
@ -2473,7 +2473,7 @@
# Check if OneDrive got Uninstalled # Check if OneDrive got Uninstalled
if (-not (Test-Path $regPath)){ if (-not (Test-Path $regPath)){
Write-Host \"Copy downloaded Files from the OneDrive Folder to Root UserProfile\" 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 Start-Process -FilePath powershell -ArgumentList \"robocopy '$($OneDrivePath)' '$($env:USERPROFILE.TrimEnd())\\' /mov /e /xj\" -NoNewWindow -Wait
Write-Host \"Removing OneDrive leftovers\" Write-Host \"Removing OneDrive leftovers\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
@ -2574,25 +2574,25 @@
"Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates", "Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",
"panel": "1", "panel": "1",
"Order": "a021_", "Order": "a021_",
"InvokeScript": [ "InvokeScript": [
" "
function CCStopper { function CCStopper {
$path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\" $path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
# Test if the path exists before proceeding # Test if the path exists before proceeding
if (Test-Path $path) { if (Test-Path $path) {
Takeown /f $path Takeown /f $path
$acl = Get-Acl $path $acl = Get-Acl $path
$acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\") $acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\")
$acl | Set-Acl $path $acl | Set-Acl $path
Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force
} else { } else {
Write-Host \"Adobe Desktop Service is not in the default location.\" Write-Host \"Adobe Desktop Service is not in the default location.\"
} }
} }
function AcrobatUpdates { function AcrobatUpdates {
# Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script. # Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script.
@ -2602,12 +2602,12 @@
# 3 = Automatically download and install updates (default value) # 3 = Automatically download and install updates (default value)
# 4 = Notify the user when an update is available but don't download or install it automatically # 4 = Notify the user when an update is available but don't download or install it automatically
# = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing. # = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing.
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\" $rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
# Get all subkeys under the specified root path # Get all subkeys under the specified root path
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" } $subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
# Loop through each subkey # Loop through each subkey
foreach ($subKey in $subKeys) { foreach ($subKey in $subKeys) {
# Get the full registry path # Get the full registry path
@ -2630,7 +2630,7 @@
function RestoreCCService { function RestoreCCService {
$originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\" $originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\"
$newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\" $newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\"
if (Test-Path -Path $originalPath) { if (Test-Path -Path $originalPath) {
Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force
Write-Host \"Adobe Desktop Service has been restored.\" Write-Host \"Adobe Desktop Service has been restored.\"
@ -2642,12 +2642,12 @@
function AcrobatUpdates { function AcrobatUpdates {
# Default Value: # Default Value:
# 3 = Automatically download and install updates # 3 = Automatically download and install updates
$rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\" $rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\"
# Get all subkeys under the specified root path # Get all subkeys under the specified root path
$subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" } $subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" }
# Loop through each subkey # Loop through each subkey
foreach ($subKey in $subKeys) { foreach ($subKey in $subKeys) {
# Get the full registry path # Get the full registry path
@ -2722,14 +2722,14 @@
"Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. Credit: Ruddernation-Designs", "Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. Credit: Ruddernation-Designs",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",
"panel": "1", "panel": "1",
"Order": "a021_", "Order": "a021_",
"InvokeScript": [ "InvokeScript": [
" "
# Define the URL of the remote HOSTS file and the local paths # Define the URL of the remote HOSTS file and the local paths
$remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\" $remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\"
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\" $localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
$tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\" $tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\"
# Download the remote HOSTS file to a temporary location # Download the remote HOSTS file to a temporary location
try { try {
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
@ -2738,11 +2738,11 @@
catch { catch {
Write-Error \"Failed to download the HOSTS file. Error: $_\" Write-Error \"Failed to download the HOSTS file. Error: $_\"
} }
# Check if the AdobeNetBlock has already been started # Check if the AdobeNetBlock has already been started
try { try {
$localHostsContent = Get-Content $localHostsPath -ErrorAction Stop $localHostsContent = Get-Content $localHostsPath -ErrorAction Stop
# Check if AdobeNetBlock markers exist # Check if AdobeNetBlock markers exist
$blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\" $blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\"
if ($blockStartExists) { if ($blockStartExists) {
@ -2753,10 +2753,10 @@
$newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments $newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments
$newBlockHeader = \"#AdobeNetBlock-start\" $newBlockHeader = \"#AdobeNetBlock-start\"
$newBlockFooter = \"#AdobeNetBlock-end\" $newBlockFooter = \"#AdobeNetBlock-end\"
# Combine the contents, ensuring new block is properly formatted # Combine the contents, ensuring new block is properly formatted
$combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String $combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String
# Write the combined content back to the original HOSTS file # Write the combined content back to the original HOSTS file
$combinedContent | Set-Content $localHostsPath -Encoding ASCII $combinedContent | Set-Content $localHostsPath -Encoding ASCII
Write-Output \"Successfully added the AdobeNetBlock.\" Write-Output \"Successfully added the AdobeNetBlock.\"
@ -2765,10 +2765,10 @@
catch { catch {
Write-Error \"Error during processing: $_\" Write-Error \"Error during processing: $_\"
} }
# Clean up temporary file # Clean up temporary file
Remove-Item $tempHostsPath -ErrorAction Ignore Remove-Item $tempHostsPath -ErrorAction Ignore
# Flush the DNS resolver cache # Flush the DNS resolver cache
try { try {
Invoke-Expression \"ipconfig /flushdns\" Invoke-Expression \"ipconfig /flushdns\"
@ -2783,7 +2783,7 @@
" "
# Define the local path of the HOSTS file # Define the local path of the HOSTS file
$localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\" $localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\"
# Load the content of the HOSTS file # Load the content of the HOSTS file
try { try {
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop $hostsContent = Get-Content $localHostsPath -ErrorAction Stop
@ -2792,11 +2792,11 @@
Write-Error \"Failed to load the HOSTS file. Error: $_\" Write-Error \"Failed to load the HOSTS file. Error: $_\"
return return
} }
# Initialize flags and buffer for new content # Initialize flags and buffer for new content
$recording = $true $recording = $true
$newContent = @() $newContent = @()
# Iterate over each line of the HOSTS file # Iterate over each line of the HOSTS file
foreach ($line in $hostsContent) { foreach ($line in $hostsContent) {
if ($line -match \"#AdobeNetBlock-start\") { if ($line -match \"#AdobeNetBlock-start\") {
@ -2809,7 +2809,7 @@
$recording = $true $recording = $true
} }
} }
# Write the filtered content back to the HOSTS file # Write the filtered content back to the HOSTS file
try { try {
$newContent | Set-Content $localHostsPath -Encoding ASCII $newContent | Set-Content $localHostsPath -Encoding ASCII
@ -2818,7 +2818,7 @@
catch { catch {
Write-Error \"Failed to write back to the HOSTS file. Error: $_\" Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
} }
# Flush the DNS resolver cache # Flush the DNS resolver cache
try { try {
Invoke-Expression \"ipconfig /flushdns\" Invoke-Expression \"ipconfig /flushdns\"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,8 +13,8 @@ function Get-TabXaml {
.EXAMPLE .EXAMPLE
Get-TabXaml "applications" 3 Get-TabXaml "applications" 3
#> #>
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
$tabname, $tabname,
$columncount = 0 $columncount = 0
@ -80,7 +80,7 @@ function Get-TabXaml {
# Dot-source the Get-WPFObjectName function # Dot-source the Get-WPFObjectName function
. .\functions\private\Get-WPFObjectName . .\functions\private\Get-WPFObjectName
$categorycontent = $($category -replace '^.__', '') $categorycontent = $($category -replace '^.__', '')
$categoryname = Get-WPFObjectName -type "Label" -name $categorycontent $categoryname = Get-WPFObjectName -type "Label" -name $categorycontent
$blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`r`n" $blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`r`n"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -143,7 +143,7 @@ Invoke-WPFRunspace -ScriptBlock {
finally{ finally{
$ProgressPreference = "Continue" $ProgressPreference = "Continue"
} }
} | Out-Null } | Out-Null
#=========================================================================== #===========================================================================
@ -283,7 +283,7 @@ Add-Type @"
$windowHandle = $proc.MainWindowHandle $windowHandle = $proc.MainWindowHandle
} else { } else {
Write-Warning "Process found, but no MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle)" Write-Warning "Process found, but no MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle)"
} }
} }
@ -398,7 +398,7 @@ $filter = Get-WinUtilVariables -Type Label
$labels = @{} $labels = @{}
($sync.GetEnumerator()).where{$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value} ($sync.GetEnumerator()).where{$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value}
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category $allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
$sync["CheckboxFilter"].Add_TextChanged({ $sync["CheckboxFilter"].Add_TextChanged({

View File

@ -7,7 +7,7 @@
This function should be run with administrative privileges. 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 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 .EXAMPLE
irm https://christitus.com/windev | iex irm https://christitus.com/windev | iex
OR OR
Run in Admin Powershell > ./windev.ps1 Run in Admin Powershell > ./windev.ps1
#> #>

View File

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