From b5ab6db8b70e2485003b27c50821bfc4df1d7daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pl=C3=ADnio=20Larrubia?= Date: Thu, 12 Oct 2023 01:08:05 -0300 Subject: [PATCH] Core changes, additions and refactor (#127) * fix: console background color changing - Add new background colors which works greatly with Powershell and Windows Terminal * docs: update ISSUE_TEMPLATEs - Log folder location - change label to only Feature Request * Fix: Tab 1 Panel 2 app order * refactor: change script tmp folder to actually be on User Temp - Get the Script Temp folder using a new function * Delete remaining from old tmp\ folder * arch: rename all powershell scripts to match PS naming - Even if it isn't approved * chore: remove unused code - Install-HEVCSupport function which doesn't work anymore * arch: rename remaining scripts - Also fix an name warning from PSScriptAnalyzer - Remove Main() functions * style: change debloat script order - Remove useless code from Remove-CapabilitiesList * feat: remove old quick assist if the new one is already installed * feat: Install Quick Assist by GUI - Remove some console output which wasn't important * BREAKING CHANGE: Attempt to correctly rename the remaining files (part 1) * fix: Attempt to correctly rename the remaining files (part 2) * Change CONTRIBUTING to a less strict policy * Fix path not being found while downloading (#95) - This is not a complete fix * Fix adwcleaner not working (#95) - Organize imports (yes, again) * Fix adwcleaner not working (yikes!) (#95) * Don't set NVIDIA services to Manual anymore (#98) - Solves issues with GeForce Experience and Control Panel * Remove more Apps: (#102) - WhatsApp - Amazon Prime Video - TikTok - Facebook - Instagram Spotify will not be removed, as i don't want to :v * Remove useless files and code - The lib Grant-RegistryPermission isn't working at all - Removing all references from this handmade lib * Prefer using "legacy" Windows 10 context menu on Windows 11 - If you dislike it you can click twice on "Enable Legacy Context Menu" to restore the default - Less laggy * Stop triggering github actions everyday * Rename powershell-linter CI * Refactor Issue templates - Need less info - Fixed punctuation. * Logs should be divided monthly * Modify Windows Explorer Navigation Pane behaviors - Hide Duplicated Removable Devices - Disable Expand to folder on navigation pane (Seems to solve: Explorer opening as the primary window without any reason) * Making disable expand to folder on navigation pane irreversible - The default is already disabled * Load PSScheduledJob Module before using it's calls (#119) * Add DELL bloatware to remove - Add Alienware apps, but keep them commented . . . I've been thinking about this for a long time... * Use less colors on terminal > This is not Cyberpunk 2077 - Change credits location * Enable Run Dialog History back (#102) - Press Win + R, then type something, you should see more stuff now. * Add Hyper-V to Optional Features (#102) * Add Windows Sandbox to Optional Features (#102) * Add new MS Edge Apps to Remove * Organize Bloatware list in each category - Add Dev Home to MSApps * Don't remove Dev Home yet, it can't be reinstalled * Winget and Chocolatey won't install while initializing the script (#110) - Every Winget/Chocolatey operation was moved to Software Install Tab. - To be able to install apps again, you need to install individually Winget and Chocolatey. - Also, you can Add or Remove Daily Upgrade for Winget and Chocolatey. - Chocolatey can now be Uninstalled! *(Be aware to uninstall everything before)* infra: Manage-Software and every code related to package managers were moved to /src/lib/package-managers/ * Update the message when a package manager was already found before enabling daily upgrade * Switch Xbox app order on list - Replace comments No code changes. * Update CONTRIBUTING - I thought i made this change before, sorry for the inconvenience. * Purge Cortana from reinstallable system apps. (#124) * When removing Microsoft Edge, keep EdgeWebView (#125) * Keep EdgeCore folder - Testing to Remove Edge but keep EdgeWebView working * Fix Remove-ItemVerified hardcode * Revert EdgeCore commit (#125) - Refactor what folders are removed (The Exclude param was broken) * Move the last package manager related file to /src/lib/package-managers/ * Allow WinDebloatTools to run asking for admin perms + + Run Windows Terminal or PowerShell depending on winget. - If script is in the wrong folder, it'll be able to detect and correct it. * Install Winget, Chocolatey and WSL on DEMAND (#110 #112) - If the user wants to install something, instead of going directly to an error, install the missing package manager. - The 1st time installing will prompt a bigger message (I don't know how this happened) * Fix PSScriptAnalyzer note. - The cmdlet 'Install-Software' returns an object of type 'System.Management.Automation.ScriptBlock' but this type is not declared in the OutputType attribute. * Add option to switch Mouse Acceleration (#102) * Add option to turn on/off Family Safety Features from Task Schedules (#104) * Improve Windows Search info (#112) - Use lib to disable/enable service for WSearch service - Isolate WSearch tweak on Services category * Fix Mouse Acceleration persistance after reboot (#102) - Changed Type to String. * Add Messenger app and Spotify (#102) - Spotify line was uncommented * Fix missing .URL file association :D (#113) - Took a long time to find out, I'm not doing this again - All .reg files should wait until finished - Add "None" type to Set-ItemPropertyVerified - Used to a specific case where REG_NONE was needed - Check if system is Windows 10, then only apply on it - Added other comment to Windows Photos App, because it's the same as Video Editor (2 apps in 1) - Create new reg file to bypass perms, solving the .url file disassociation - In Enable-LegacyContextMenu suppress the New-Item command output * Use -Encoding UTF8 parameter (#118?) * Load PSScheduledJob Module in Manage-DailyUpgradeJob (#119) - For some reason the import was missing again. * Disable Edge Tasks and Services after uninstalling (#123/#125) - Add a disclaimer to the message before Removing Edge - Fixed wildcard usage '*' in Set-ScheduledTaskState function --- .github/ISSUE_TEMPLATE/bug_report.yaml | 30 +-- .github/ISSUE_TEMPLATE/feature_request.yaml | 11 +- ...{powershell-linter.yml => powershell.yaml} | 14 +- CONTRIBUTING.md | 2 +- README.md | 19 +- WinDebloatTools.ps1 | 199 +++++++++++++---- src/lib/Grant-RegistryPermission.psm1 | 29 --- src/lib/Open-File.psm1 | 2 +- src/lib/Title-Templates.psm1 | 23 +- .../debloat-helper/Remove-ItemVerified.psm1 | 40 +++- src/lib/debloat-helper/Remove-UWPApp.psm1 | 6 +- .../Set-ItemPropertyVerified.psm1 | 2 +- .../Set-ScheduledTaskState.psm1 | 2 +- .../Install-PackageManager.psm1 | 35 +++ .../package-managers/Manage-Chocolatey.psm1 | 201 ++++++++++++++++++ .../Manage-DailyUpgradeJob.psm1 | 67 ++++++ .../Manage-Software.psm1 | 36 +++- src/lib/package-managers/Manage-Winget.psm1 | 149 +++++++++++++ .../package-managers/Update-AllPackage.psm1} | 10 +- src/scripts/Install-PackageManager.ps1 | 177 --------------- src/scripts/Register-PersonalTweaksList.ps1 | 65 +++++- src/scripts/Remove-BloatwareAppsList.ps1 | 190 ++++++++++------- src/scripts/Remove-MSEdge.ps1 | 19 +- src/scripts/Remove-Xbox.ps1 | 4 +- .../other-scripts/Git-GnupgSshKeysSetup.ps1 | 4 +- src/scripts/other-scripts/Install-WSL.ps1 | 2 +- src/utils/Individual-Tweaks.psm1 | 89 +++++++- src/utils/Install-Individual-System-Apps.psm1 | 7 +- src/utils/fix-url-association.reg | 3 + 29 files changed, 999 insertions(+), 438 deletions(-) rename .github/workflows/{powershell-linter.yml => powershell.yaml} (92%) delete mode 100644 src/lib/Grant-RegistryPermission.psm1 create mode 100644 src/lib/package-managers/Install-PackageManager.psm1 create mode 100644 src/lib/package-managers/Manage-Chocolatey.psm1 create mode 100644 src/lib/package-managers/Manage-DailyUpgradeJob.psm1 rename src/lib/{ => package-managers}/Manage-Software.psm1 (82%) create mode 100644 src/lib/package-managers/Manage-Winget.psm1 rename src/{scripts/other-scripts/Update-AllPackage.ps1 => lib/package-managers/Update-AllPackage.psm1} (71%) delete mode 100644 src/scripts/Install-PackageManager.ps1 create mode 100644 src/utils/fix-url-association.reg diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index b53695ca..9b185fa8 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -11,19 +11,19 @@ body: value: | ## Important: Read First - - If some section doesn't apply, use "N/A" + - If some section doesn't apply, use "N/A". - type: textarea id: description attributes: label: Describe the Bug - description: A clear and concise description of what the bug is + description: A clear and concise description of what the bug "is". You can also add Screenshots. validations: required: true - type: textarea id: reproduction attributes: label: How can this issue be reproduced? - description: Steps to reproduce the behavior + description: Steps to reproduce the behavior. placeholder: | Example: 1. Go to '...' @@ -36,7 +36,7 @@ body: id: expectedBehavior attributes: label: Expected behavior? - description: A clear and concise description of what you expected to happen + description: A clear and concise description of what you expected to happen. validations: required: false - type: markdown @@ -47,7 +47,7 @@ body: id: os attributes: label: Operating System - description: Versions before Windows 10 are not supported + description: Versions before Windows 10 are not supported. options: - Windows 11 - Windows 10 @@ -57,18 +57,10 @@ body: id: osVer attributes: label: Operating System Version - description: Versions before 1809 are not supported + description: Versions before 1809 are not supported. placeholder: "Example: 21H2" validations: required: true - - type: textarea - id: screenshots - attributes: - label: Screenshots - description: | - If your issue is better illustrated with screenshots, you may do that here - validations: - required: false - type: textarea id: logs attributes: @@ -76,14 +68,6 @@ body: description: | **Only needed if it's error related** Put your log file from: C:\Users\{ Your User }\AppData\Local\Temp\Win-Debloat-Tools\logs\WinDebloatTools.log - TIP: press `Win + R` and type `%Temp%` then hit `ENTER`, now find the log file - validations: - required: false - - type: textarea - id: context - attributes: - label: Additional Info - description: | - Please feel free to add any additional info here + TIP: press `Win + R` and type `%Temp%` then hit `ENTER`, now find the log file. validations: required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 31f8ae73..28d2b578 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -11,12 +11,12 @@ body: value: | ## Important: Read First - - If some section doesn't apply, use "N/A" + - If some section doesn't apply, use "N/A". - type: textarea id: description attributes: label: Description - description: A clear and concise description of what you want to happen + description: A clear and concise description of what you want to happen. validations: required: true - type: textarea @@ -24,7 +24,7 @@ body: attributes: label: Reason description: | - Give a reason why you want this feature + Give a reason why you want this feature: - How will it make things easier for you? - What does it provide that isn't being provided currently? - How does it benefit? @@ -35,8 +35,7 @@ body: attributes: label: Examples description: | - Provide examples of the feature as implemented by other software - - Include screenshots or video if you like to help demonstrate how you'd like this feature to work + Provide examples of the feature as implemented by other software. + Include screenshots or video if you can demonstrate how you'd like this feature to work. validations: required: false diff --git a/.github/workflows/powershell-linter.yml b/.github/workflows/powershell.yaml similarity index 92% rename from .github/workflows/powershell-linter.yml rename to .github/workflows/powershell.yaml index 46e1b6c5..a038a61c 100644 --- a/.github/workflows/powershell-linter.yml +++ b/.github/workflows/powershell.yaml @@ -13,15 +13,13 @@ name: PSScriptAnalyzer on: push: branches: - - main - - develop + - main + - develop pull_request: branches: - - main - - develop - schedule: - - cron: '30 12 * * 0-6' - + - main + - develop + jobs: build: name: PSScriptAnalyzer @@ -34,7 +32,7 @@ jobs: with: # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. path: .\ - recurse: true + recurse: true # Exclude rules that will not be worked on / are invalid # Command: invoke-scriptanalyzer . -recurse -excludeRule: "PSAvoidUsingInvokeExpression", "PSAvoidUsingWriteHost", "PSUseShouldProcessForStateChangingFunctions" excludeRule: '"PSAvoidUsingInvokeExpression", "PSAvoidUsingWriteHost", "PSUseShouldProcessForStateChangingFunctions"' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7be99524..b64d3a63 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ ⚠ **Warning**: this file is subject to changing without notice. I would be happy to extend the collection of scripts. -If you want to send me a **PULL REQUEST**, you can send PRs to `main` branch, i'll check your code, request changes if necessary or approve, and merge directly unless it's a "Draft PR". +If you want to send me a **PULL REQUEST**, send you PRs to the `develop` branch, select your `local branch (from)` and put into `develop`, i'll check your code, request changes if necessary or approve, and merge directly unless it's a "Draft PR". ## 🖌 Coding Style diff --git a/README.md b/README.md index 9c51ea09..f11f9051 100644 --- a/README.md +++ b/README.md @@ -110,10 +110,6 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 | - [Import all necessary _modules_ before executing everything](./src/lib/); - Logs both script runs on `C:\Users\<>\AppData\Local\Temp\Win-DT-Logs`; - [Make a Restore Point and Backup the Hosts file](./src/scripts/Backup-System.ps1); -- [Install _Winget/Chocolatey_ package managers by default](./src/scripts/Install-PackageManager.ps1); - - Creates a new Scheduled Task to daily upgrade all available softwares via _Winget_ at **12:00** and _Chocolatey_ at **13:00**; - - Find the Scheduled Task on `Task Scheduler > Microsoft > Windows > PowerShell > ScheduledJobs > Chocolatey/Winget Daily Upgrade`; - - Register daily upgrade logs on `C:\Users\<>\AppData\Local\Temp\Win-DT-Logs` and remove old log files; - [Download AdwCleaner and Run the latest version for _Virus/Adware_ scan and from OOShutUp10 and import all Recommended settings from a file](./src/scripts/silent-debloat-softwares.ps1); - [Disable _non-essential_ Telemetry from Scheduled Tasks and Optimize it](./src/scripts/Optimize-TaskScheduler.ps1); - [Disable _heavy_ Services, but enable some on SSDs for optimum performance](./src/scripts/Optimize-ServicesRunning.ps1); @@ -143,6 +139,7 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 | - `Enable/Disable Clipboard Sync Across Devices`: Manages the **Clipboard Sync Across Devices** setting, which allows to use the same clipboard for multiple devices (must be using a MS account); - `Enable/Disable Cortana`: Manages the **Cortana** setting; - `Enable/Disable Hibernate`: Manages the **Hibernate** setting; +- `Enable/Disable Legacy Context Menu`: Bring back the Windows 10 **context menu** from right-clicking or default on Windows 11; - `Enable/Disable Old Volume Control`: Manages the **Old Volume Control (Win 7/8.1)** setting; - `Enable/Disable Online Speech Recognition`: Manages the **Online Speech Recognition** setting, by pressing the keys `Windows + H` you can speak through your mic, then use it to type text using your voice; - `Enable/Disable Phone Link`: Manages the **Phone Link** setting, which can link your Android/iPhone devices notifications to Windows; @@ -156,7 +153,7 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 | - `Apply Tweaks`: Run every Common Tweak scripts ([Go To **☑️ Common Script Features** section](#%EF%B8%8F-common-script-features)); - `Undo Tweaks`: Re-apply some tweaks and _Revert_ all possible ones, covering the, `ShutUp10 settings`, `Scheduled Tasks`, `Services`, `Privacy and Performance`, `Personal` and `Optional Features` tweaks, then try to `Reinstall Pre-Installed Apps`; -- [`Remove Microsoft Edge`](./src/scripts/Remove-MSEdge.ps1): uninstalls Microsoft Edge/WebView, then remove the remaining files; +- [`Remove Microsoft Edge`](./src/scripts/Remove-MSEdge.ps1): uninstalls **Microsoft Edge**, then remove the remaining files, **Edge Web View** files will remain untouched; - [`Remove OneDrive`](./src/scripts/Remove-OneDrive.ps1): completely removes OneDrive from the System, re-install is possible via Win Store; - [`Remove Xbox`](./src/scripts/Remove-Xbox.ps1): wipe Xbox Apps, disable Services related to Xbox and GameBar/GameDVR; @@ -164,7 +161,6 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 | _This section contains options to restore the system apps, by downloading them from the **MS Store** (mostly) and doing **Stock configurations** (for some Apps)._ -- `Cortana`; - `Dolby Audio`; - `Microsoft Edge`; - `OneDrive`; @@ -202,6 +198,17 @@ _This section can manually adjust `Optional Features` from the system, working a ### Software Install +- [Install _Winget/Chocolatey_ package managers](./src/lib/package-managers/); + + - Be able to install the listed software in this script! Even from System apps. + +- [**Create** or **Remove** a Daily Upgrade Task for _Winget/Chocolatey_ packages](./src/lib/package-managers/); + + - Creates a new Scheduled Job to daily upgrade all available softwares via _Winget_ at **12:00** and _Chocolatey_ at **13:00**; + - Register daily upgrade logs on `C:\Users\<>\AppData\Local\Temp\Win-DT-Logs` and remove old log files; + +- `Remove All Chocolatey Packages`: List all packages from Chocolatey which are installed and remove everything at once; + - `Upgrade All Softwares`: Upgrades all Softwares installed on your machine installed through _Winget_ and _Chocolatey_. - WSL will only update itself, not the distros installed. - `Install Selected`: Install the selected apps by marking the checkbox(es); diff --git a/WinDebloatTools.ps1 b/WinDebloatTools.ps1 index 91fcb765..1e69f727 100644 --- a/WinDebloatTools.ps1 +++ b/WinDebloatTools.ps1 @@ -23,12 +23,16 @@ function Main() { Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Get-HardwareInfo.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Open-File.psm1" -Force - Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Manage-Software.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Request-FileDownload.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Set-ConsoleStyle.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Set-RevertStatus.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Start-Logging.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\Title-Templates.psm1" -Force + Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\package-managers\Manage-Chocolatey.psm1" -Force + Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\package-managers\Manage-DailyUpgradeJob.psm1" -Force + Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\package-managers\Manage-Software.psm1" -Force + Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\package-managers\Manage-Winget.psm1" -Force + Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\package-managers\Update-AllPackage.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\ui\Get-CurrentResolution.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\ui\Get-DefaultColor.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\ui\New-LayoutPage.psm1" -Force @@ -37,15 +41,19 @@ function Main() { Import-Module -DisableNameChecking "$PSScriptRoot\src\utils\Individual-Tweaks.psm1" -Force Import-Module -DisableNameChecking "$PSScriptRoot\src\utils\Install-Individual-System-Apps.psm1" -Force + If ("$pwd" -notlike "$PSScriptRoot") { + Write-Host "Wrong location detected, changing to script folder!" -BackgroundColor Yellow + Set-Location -Path "$PSScriptRoot" + } + Set-ConsoleStyle $CurrentFileName = (Split-Path -Path $PSCommandPath -Leaf).Split('.')[0] $CurrentFileLastModified = (Get-Item "$(Split-Path -Path $PSCommandPath -Leaf)").LastWriteTimeUtc | Get-Date -Format "yyyy-MM-dd" (Get-Item "$(Split-Path -Path $PSCommandPath -Leaf)").LastWriteTimeUtc | Get-Date -Format "yyyy-MM-dd" - Start-Logging -File $CurrentFileName + Start-Logging -File "$CurrentFileName-$(Get-Date -Format "yyyy-MM")" Write-Caption "$CurrentFileName v$CurrentFileLastModified" Write-Host "Your Current Folder $pwd" Write-Host "Script Root Folder $PSScriptRoot" - Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts "Install-PackageManager.ps1" -NoDialog Write-ScriptLogo If ($args) { @@ -100,7 +108,14 @@ function Open-DebloatScript { function Request-AdminPrivilege() { # Used from https://stackoverflow.com/a/31602095 because it preserves the working directory! - If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } + If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { + Try { + winget --version + Start-Process -Verb RunAs -FilePath "wt.exe" -ArgumentList "--startingDirectory `"$PSScriptRoot`" --profile `"Windows PowerShell`"", "cmd /c powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""; taskkill.exe /f /im $PID; exit + } Catch { + Start-Process -Verb RunAs -FilePath powershell.exe -ArgumentList "-NoProfile", "-ExecutionPolicy Bypass", "-File `"$PSCommandPath`""; exit + } + } } function Show-GUI() { @@ -121,7 +136,7 @@ function Show-GUI() { # <===== UI =====> # Main Window: - $Form = New-Form -Width $LayoutT1.FormWidth -Height $LayoutT1.FormHeight -Text "Win Debloat Tools (LeDragoX) | $(Get-SystemSpec)" -BackColor $BrandColors.Win.Dark -FormBorderStyle 'Sizable' # Loading the specs takes longer time to load the GUI + $Form = New-Form -Width $LayoutT1.FormWidth -Height $LayoutT1.FormHeight -Text "Win Debloat Tools | $(Get-SystemSpec)" -BackColor $BrandColors.Win.Dark -FormBorderStyle 'Sizable' # Loading the specs takes longer time to load the GUI $Form = New-FormIcon -Form $Form -ImageLocation "$PSScriptRoot\src\assets\script-icon-32px.png" @@ -149,14 +164,14 @@ function Show-GUI() { $CbClipboardSyncAcrossDevice = New-CheckBox -Text "Enable Clipboard Sync Across Devices" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbClipboardHistory $CbCortana = New-CheckBox -Text "Enable Cortana" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbClipboardSyncAcrossDevice $CbHibernate = New-CheckBox -Text "Enable Hibernate" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbCortana - $CbOldVolumeControl = New-CheckBox -Text "Enable Old Volume Control" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbHibernate + $CbLegacyContextMenu = New-CheckBox -Text "Enable Legacy Context Menu" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbHibernate + $CbOldVolumeControl = New-CheckBox -Text "Enable Old Volume Control" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbLegacyContextMenu $CbOnlineSpeechRecognition = New-CheckBox -Text "Enable Online Speech Recognition" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbOldVolumeControl $CbPhoneLink = New-CheckBox -Text "Enable Phone Link" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbOnlineSpeechRecognition $CbPhotoViewer = New-CheckBox -Text "Enable Photo Viewer" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbPhoneLink $CbSearchAppForUnknownExt = New-CheckBox -Text "Enable Search App for Unknown Ext." -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbPhotoViewer $CbTelemetry = New-CheckBox -Text "Enable Telemetry" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbSearchAppForUnknownExt - $CbWSearchService = New-CheckBox -Text "Enable WSearch Service" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbTelemetry - $CbXboxGameBarDVRandMode = New-CheckBox -Text "Enable Xbox Game Bar/DVR/Mode" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbWSearchService + $CbXboxGameBarDVRandMode = New-CheckBox -Text "Enable Xbox Game Bar/DVR/Mode" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbWindowsSearch # ==> T1 Panel 2 $ClDebloatTools = New-Label -Text "System Debloat Tools" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX $LayoutT1.PanelElementX -LocationY 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' @@ -168,8 +183,7 @@ function Show-GUI() { $PictureBox1 = New-PictureBox -ImageLocation "$PSScriptRoot\src\assets\script-image.png" -Width $LayoutT1.PanelElementWidth -Height (($LayoutT1.ButtonHeight * 4) + ($LayoutT1.DistanceBetweenElements * 4)) -LocationX $LayoutT1.PanelElementX -ElementBefore $RemoveXbox -MarginTop $LayoutT1.DistanceBetweenElements -SizeMode 'Zoom' $ClInstallSystemApps = New-Label -Text "Install System Apps" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $PictureBox1 - $InstallCortana = New-Button -Text "Cortana" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.ButtonHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClInstallSystemApps - $InstallDolbyAudio = New-Button -Text "Dolby Audio" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.ButtonHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $InstallCortana -MarginTop $LayoutT1.DistanceBetweenElements + $InstallDolbyAudio = New-Button -Text "Dolby Audio" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.ButtonHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClInstallSystemApps -MarginTop $LayoutT1.DistanceBetweenElements $InstallMicrosoftEdge = New-Button -Text "Microsoft Edge" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.ButtonHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $InstallDolbyAudio -MarginTop $LayoutT1.DistanceBetweenElements $InstallOneDrive = New-Button -Text "OneDrive" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.ButtonHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $InstallMicrosoftEdge -MarginTop $LayoutT1.DistanceBetweenElements $InstallPaintPaint3D = New-Button -Text "Paint + Paint 3D" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.ButtonHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $InstallOneDrive -MarginTop $LayoutT1.DistanceBetweenElements @@ -191,24 +205,48 @@ function Show-GUI() { $CbAutomaticWindowsUpdate = New-CheckBox -Text "Enable Automatic Windows Update" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClWindowsUpdate $ClOptionalFeatures = New-Label -Text "Optional Features" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $CbAutomaticWindowsUpdate - $CbInternetExplorer = New-CheckBox -Text "Internet Explorer" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClOptionalFeatures + $CbHyperV = New-CheckBox -Text "Hyper-V" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClOptionalFeatures + $CbInternetExplorer = New-CheckBox -Text "Internet Explorer" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbHyperV $CbPrintToPDFServices = New-CheckBox -Text "Printing-PrintToPDFServices-Features" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbInternetExplorer $CbPrintingXPSServices = New-CheckBox -Text "Printing-XPSServices-Features" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbPrintToPDFServices $CbWindowsMediaPlayer = New-CheckBox -Text "Windows Media Player" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbPrintingXPSServices + $CbWindowsSandbox = New-CheckBox -Text "Windows Sandbox" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbWindowsMediaPlayer - $ClWindowsCapabilities = New-Label -Text "Windows Capabilities" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $CbWindowsMediaPlayer + $ClTaskScheduler = New-Label -Text "Task Scheduler" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $CbWindowsSandbox + $CbFamilySafety = New-CheckBox -Text "Family Safety Features" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClTaskScheduler + + $ClServices = New-Label -Text "Services" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $CbFamilySafety + $CbWindowsSearch = New-CheckBox -Text "Windows Search Indexing" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClServices + + $ClWindowsCapabilities = New-Label -Text "Windows Capabilities" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $CbWindowsSearch $CbPowerShellISE = New-CheckBox -Text "PowerShell ISE" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClWindowsCapabilities $ClMiscFeatures = New-Label -Text "Miscellaneous Features" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[2] -FontStyle 'Bold' -ElementBefore $CbPowerShellISE $CbEncryptedDNS = New-CheckBox -Text "Enable Encrypted DNS" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $ClMiscFeatures $CbGodMode = New-CheckBox -Text "Enable God Mode" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbEncryptedDNS - $CbMouseNaturalScroll = New-CheckBox -Text "Enable Mouse Natural Scroll" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbGodMode + $CbMouseAcceleration = New-CheckBox -Text "Enable Mouse Acceleration" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbGodMode + $CbMouseNaturalScroll = New-CheckBox -Text "Enable Mouse Natural Scroll" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbMouseAcceleration $CbTakeOwnership = New-CheckBox -Text "Enable Take Ownership menu" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbMouseNaturalScroll $CbFastShutdownPCShortcut = New-CheckBox -Text "Enable Fast Shutdown shortcut" -Width $LayoutT1.PanelElementWidth -Height $LayoutT1.CheckBoxHeight -LocationX $LayoutT1.PanelElementX -FontSize $LayoutT1.Heading[3] -ElementBefore $CbTakeOwnership # ==> Tab 2 $TlSoftwareInstall = New-Label -Text "Software Install" -Width $LayoutT2.TotalWidth -Height $LayoutT2.TitleLabelHeight -LocationX 0 -LocationY $TitleLabelY -FontSize $LayoutT2.Heading[0] -FontStyle "Bold" -ForeColor $Colors.Cyan - $ClSoftwareInstall = New-Label -Text "Package Managers: Winget and Chocolatey" -Width $LayoutT2.TotalWidth -Height $LayoutT2.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[1] -ElementBefore $TlSoftwareInstall -MarginTop $LayoutT2.DistanceBetweenElements -ForeColor $Colors.White + + $T2PanelPackageManagersSettings = New-Panel -Width $LayoutT2.TotalWidth -Height ($LayoutT2.ButtonHeight * 7) -ElementBefore $TlSoftwareInstall + + $ClWingetSettings = New-Label -Text "Winget Settings" -Width $LayoutT2.TotalWidth -Height $LayoutT2.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[1] -LocationY 0 -MarginTop $LayoutT2.DistanceBetweenElements -ForeColor $Colors.White + $InstallWinget = New-Button -Text "Install Winget" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 0) + $LayoutT2.PanelElementX) -ElementBefore $ClWingetSettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + $EnableWingetDailyUpgrade = New-Button -Text "Enable Winget Daily Upgrade" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 2) + $LayoutT2.PanelElementX) -ElementBefore $ClWingetSettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + $RemoveWingetDailyUpgrade = New-Button -Text "Remove Winget Daily Upgrade" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 3) + $LayoutT2.PanelElementX) -ElementBefore $ClWingetSettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + + $ClChocolateySettings = New-Label -Text "Chocolatey Settings" -Width $LayoutT2.TotalWidth -Height $LayoutT2.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[1] -ElementBefore $InstallWinget -MarginTop $LayoutT2.DistanceBetweenElements -ForeColor $Colors.White + $InstallChocolatey = New-Button -Text "Install Chocolatey" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 0) + $LayoutT2.PanelElementX) -ElementBefore $ClChocolateySettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + $UninstallChocolatey = New-Button -Text "Uninstall Chocolatey" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 1) + $LayoutT2.PanelElementX) -ElementBefore $ClChocolateySettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + $EnableChocolateyDailyUpgrade = New-Button -Text "Enable Chocolatey Daily Upgrade" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 2) + $LayoutT2.PanelElementX) -ElementBefore $ClChocolateySettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + $RemoveChocolateyDailyUpgrade = New-Button -Text "Remove Chocolatey Daily Upgrade" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 3) + $LayoutT2.PanelElementX) -ElementBefore $ClChocolateySettings -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.Cyan + $RemoveAllChocolateyPackages = New-Button -Text "Remove All Chocolatey Packages" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.ButtonHeight -LocationX (($LayoutT2.PanelWidth * 0) + $LayoutT2.PanelElementX) -ElementBefore $InstallChocolatey -MarginTop $LayoutT2.DistanceBetweenElements -FontSize $LayoutT2.Heading[3] -FontStyle 'Bold' -ForeColor $Colors.WarningYellow + + $ClSoftwareInstall = New-Label -Text "Select and Install/Uninstall" -Width $LayoutT2.TotalWidth -Height $LayoutT2.CaptionLabelHeight -LocationX 0 -FontSize $LayoutT1.Heading[1] -ElementBefore $T2PanelPackageManagersSettings -MarginTop $LayoutT2.DistanceBetweenElements -ForeColor $Colors.LightGreen $CurrentPanelIndex = 0 $T2Panel1 = New-Panel -Width $LayoutT2.PanelWidth -Height $LayoutT2.PanelHeight -LocationX ($LayoutT2.PanelWidth * $CurrentPanelIndex) -ElementBefore $ClSoftwareInstall @@ -388,8 +426,7 @@ function Show-GUI() { $InstallOpenSuse = New-CheckBox -Text "Open SUSE 42" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallKaliLinux $InstallSles = New-CheckBox -Text "SLES v12" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallOpenSuse $InstallUbuntu = New-CheckBox -Text "Ubuntu" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallSles - $InstallUbuntu16Lts = New-CheckBox -Text "Ubuntu 16.04 LTS" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallUbuntu - $InstallUbuntu18Lts = New-CheckBox -Text "Ubuntu 18.04 LTS" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallUbuntu16Lts + $InstallUbuntu18Lts = New-CheckBox -Text "Ubuntu 18.04 LTS" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallUbuntu $InstallUbuntu20Lts = New-CheckBox -Text "Ubuntu 20.04 LTS" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CheckBoxHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[3] -ElementBefore $InstallUbuntu18Lts $ClDevelopment = New-Label -Text "⌨ Development on Windows" -Width $LayoutT2.PanelElementWidth -Height $LayoutT2.CaptionLabelHeight -LocationX $LayoutT2.PanelElementX -FontSize $LayoutT2.Heading[2] -FontStyle 'Bold' -ElementBefore $InstallUbuntu20Lts @@ -418,16 +455,21 @@ function Show-GUI() { # Tabs $FormTabControl.Controls.AddRange(@($TabSystemTweaks, $TabSoftwareInstall)) $TabSystemTweaks.Controls.AddRange(@($TlSystemTweaks, $ClSystemTweaks, $T1Panel1, $T1Panel2, $T1Panel3)) - $TabSoftwareInstall.Controls.AddRange(@($TlSoftwareInstall, $ClSoftwareInstall, $T2Panel1, $T2Panel2, $T2Panel3, $T2Panel4)) + $TabSoftwareInstall.Controls.AddRange(@($TlSoftwareInstall, $ClSoftwareInstall, $T2PanelPackageManagersSettings, $T2Panel1, $T2Panel2, $T2Panel3, $T2Panel4)) # Add Elements to each Tab Panel - $T1Panel1.Controls.AddRange(@($ClCustomizeFeatures, $CbDarkTheme, $CbActivityHistory, $CbBackgroundsApps, $CbClipboardHistory, $CbClipboardSyncAcrossDevice, $CbCortana, $CbHibernate, $CbOldVolumeControl, $CbOnlineSpeechRecognition, $CbPhoneLink, $CbPhotoViewer, $CbSearchAppForUnknownExt, $CbTelemetry, $CbWSearchService, $CbXboxGameBarDVRandMode)) + $T1Panel1.Controls.AddRange(@($ClCustomizeFeatures, $CbDarkTheme, $CbActivityHistory, $CbBackgroundsApps, $CbClipboardHistory, $CbClipboardSyncAcrossDevice, $CbCortana, $CbHibernate, $CbLegacyContextMenu, $CbOldVolumeControl, $CbOnlineSpeechRecognition, $CbPhoneLink, $CbPhotoViewer, $CbSearchAppForUnknownExt, $CbTelemetry, $CbXboxGameBarDVRandMode)) $T1Panel2.Controls.AddRange(@($ClDebloatTools, $ApplyTweaks, $UndoTweaks, $RemoveMSEdge, $RemoveOneDrive, $RemoveXbox, $PictureBox1)) - $T1Panel2.Controls.AddRange(@($ClInstallSystemApps, $InstallCortana, $InstallDolbyAudio, $InstallMicrosoftEdge, $InstallOneDrive, $InstallPaintPaint3D, $InstallPhoneLink, $InstallQuickAssist, $InstallSoundRecorder, $InstallTaskbarWidgets, $InstallUWPWMediaPlayer, $InstallXbox)) + $T1Panel2.Controls.AddRange(@($ClInstallSystemApps, $InstallDolbyAudio, $InstallMicrosoftEdge, $InstallOneDrive, $InstallPaintPaint3D, $InstallPhoneLink, $InstallQuickAssist, $InstallSoundRecorder, $InstallTaskbarWidgets, $InstallUWPWMediaPlayer, $InstallXbox)) $T1Panel2.Controls.AddRange(@($ClOtherTools, $RandomizeSystemColor, $ReinstallBloatApps, $RepairWindows, $ShowDebloatInfo)) $T1Panel3.Controls.AddRange(@($ClWindowsUpdate, $CbAutomaticWindowsUpdate)) - $T1Panel3.Controls.AddRange(@($ClOptionalFeatures, $CbInternetExplorer, $CbPrintToPDFServices, $CbPrintingXPSServices, $CbWindowsMediaPlayer)) + $T1Panel3.Controls.AddRange(@($ClOptionalFeatures, $CbHyperV, $CbInternetExplorer, $CbPrintToPDFServices, $CbPrintingXPSServices, $CbWindowsMediaPlayer, $CbWindowsSandbox)) + $T1Panel3.Controls.AddRange(@($ClTaskScheduler, $CbFamilySafety)) + $T1Panel3.Controls.AddRange(@($ClServices, $CbWindowsSearch)) $T1Panel3.Controls.AddRange(@($ClWindowsCapabilities, $CbPowerShellISE)) - $T1Panel3.Controls.AddRange(@($ClMiscFeatures, $CbEncryptedDNS, $CbGodMode, $CbMouseNaturalScroll, $CbTakeOwnership, $CbFastShutdownPCShortcut)) + $T1Panel3.Controls.AddRange(@($ClMiscFeatures, $CbEncryptedDNS, $CbGodMode, $CbMouseAcceleration, $CbMouseNaturalScroll, $CbTakeOwnership, $CbFastShutdownPCShortcut)) + + $T2PanelPackageManagersSettings.Controls.AddRange(@($ClWingetSettings, $InstallWinget, $EnableWingetDailyUpgrade, $RemoveWingetDailyUpgrade)) + $T2PanelPackageManagersSettings.Controls.AddRange(@($ClChocolateySettings, $InstallChocolatey, $UninstallChocolatey, $EnableChocolateyDailyUpgrade, $RemoveChocolateyDailyUpgrade, $RemoveAllChocolateyPackages)) $T2Panel1.Controls.AddRange(@($UpgradeAll)) $T2Panel1.Controls.AddRange(@($ClCpuGpuDrivers, $InstallAmdRyzenChipsetDriver, $InstallIntelDSA, $InstallNvidiaGeForceExperience, $InstallDDU, $InstallNVCleanstall)) @@ -456,7 +498,7 @@ function Show-GUI() { $T2Panel3.Controls.AddRange(@($ClRecordingAndStreaming, $InstallElgatoStreamDeck, $InstallHandBrake, $InstallObsStudio, $InstallStreamlabs)) $T2Panel3.Controls.AddRange(@($ClEmulation, $InstallBSnesHd, $InstallCemu, $InstallDolphin, $InstallKegaFusion, $InstallMGba, $InstallPPSSPP, $InstallProject64, $InstallRetroArch, $InstallRyujinx, $InstallSnes9x)) $T2Panel4.Controls.AddRange(@($ClTextEditors, $InstallJetBrainsToolbox, $InstallNotepadPlusPlus, $InstallVisualStudioCommunity, $InstallVSCode, $InstallVSCodium)) - $T2Panel4.Controls.AddRange(@($ClWsl, $InstallWSL, $InstallArchWSL, $InstallDebian, $InstallKaliLinux, $InstallOpenSuse, $InstallSles, $InstallUbuntu, $InstallUbuntu16Lts, $InstallUbuntu18Lts, $InstallUbuntu20Lts)) + $T2Panel4.Controls.AddRange(@($ClWsl, $InstallWSL, $InstallArchWSL, $InstallDebian, $InstallKaliLinux, $InstallOpenSuse, $InstallSles, $InstallUbuntu, $InstallUbuntu18Lts, $InstallUbuntu20Lts)) $T2Panel4.Controls.AddRange(@($ClDevelopment, $InstallWindowsTerminal, $InstallNerdFonts, $InstallGitGnupgSshSetup, $InstallAdb, $InstallAndroidStudio, $InstallDockerDesktop, $InstallInsomnia, $InstallJavaJdks, $InstallJavaJre, $InstallMySql, $InstallNodeJs, $InstallNodeJsLts, $InstallPostgreSql, $InstallPython3, $InstallPythonAnaconda3, $InstallRuby, $InstallRubyMsys, $InstallRustGnu, $InstallRustMsvc)) # <===== CLICK EVENTS =====> @@ -508,10 +550,6 @@ function Show-GUI() { Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts @("Backup-System.ps1", "Repair-WindowsSystem.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage }) - $InstallCortana.Add_Click( { - Install-Cortana - }) - $InstallDolbyAudio.Add_Click( { Install-DolbyAudio }) @@ -644,6 +682,16 @@ function Show-GUI() { } }) + $CbLegacyContextMenu.Add_Click( { + If ($CbLegacyContextMenu.CheckState -eq "Checked") { + Enable-LegacyContextMenu + $CbLegacyContextMenu.Text = "[ON] Legacy Context Menu" + } Else { + Disable-LegacyContextMenu + $CbLegacyContextMenu.Text = "[OFF] Legacy Context Menu *" + } + }) + $CbOldVolumeControl.Add_Click( { If ($CbOldVolumeControl.CheckState -eq "Checked") { Enable-OldVolumeControl @@ -704,16 +752,6 @@ function Show-GUI() { } }) - $CbWSearchService.Add_Click( { - If ($CbWSearchService.CheckState -eq "Checked") { - Enable-WSearchService - $CbWSearchService.Text = "[ON] WSearch Service *" - } Else { - Disable-WSearchService - $CbWSearchService.Text = "[OFF] WSearch Service" - } - }) - $CbXboxGameBarDVRandMode.Add_Click( { If ($CbXboxGameBarDVRandMode.CheckState -eq "Checked") { Enable-XboxGameBarDVRandMode @@ -724,6 +762,16 @@ function Show-GUI() { } }) + $CbHyperV.Add_Click( { + If ($CbHyperV.CheckState -eq "Checked") { + Enable-HyperV + $CbHyperV.Text = "[ON] Hyper-V" + } Else { + Disable-HyperV + $CbHyperV.Text = "[OFF] Hyper-V *" + } + }) + $CbInternetExplorer.Add_Click( { If ($CbInternetExplorer.CheckState -eq "Checked") { Enable-InternetExplorer @@ -764,6 +812,36 @@ function Show-GUI() { } }) + $CbWindowsSandbox.Add_Click( { + If ($CbWindowsSandbox.CheckState -eq "Checked") { + Enable-WindowsSandbox + $CbWindowsSandbox.Text = "[ON] Windows Sandbox" + } Else { + Disable-WindowsSandbox + $CbWindowsSandbox.Text = "[OFF] Windows Sandbox *" + } + }) + + $CbFamilySafety.Add_Click( { + If ($CbFamilySafety.CheckState -eq "Checked") { + Enable-FamilySafety + $CbFamilySafety.Text = "[ON] Family Safety Features *" + } Else { + Disable-FamilySafety + $CbFamilySafety.Text = "[OFF] Family Safety Features" + } + }) + + $CbWindowsSearch.Add_Click( { + If ($CbWindowsSearch.CheckState -eq "Checked") { + Enable-WindowsSearch + $CbWindowsSearch.Text = "[ON] Windows Search Indexing *" + } Else { + Disable-WindowsSearch + $CbWindowsSearch.Text = "[OFF] Windows Search Indexing" + } + }) + $CbPowerShellISE.Add_Click( { If ($CbPowerShellISE.CheckState -eq "Checked") { Enable-PowerShellISE @@ -794,6 +872,16 @@ function Show-GUI() { } }) + $CbMouseAcceleration.Add_Click( { + If ($CbMouseAcceleration.CheckState -eq "Checked") { + Enable-MouseAcceleration + $CbMouseAcceleration.Text = "[ON] Mouse Acceleration *" + } Else { + Disable-MouseAcceleration + $CbMouseAcceleration.Text = "[OFF] Mouse Acceleration" + } + }) + $CbMouseNaturalScroll.Add_Click( { If ($CbMouseNaturalScroll.CheckState -eq "Checked") { Enable-MouseNaturalScroll @@ -824,8 +912,40 @@ function Show-GUI() { } }) + $InstallWinget.Add_Click( { + Install-Winget + }) + + $EnableWingetDailyUpgrade.Add_Click( { + Register-WingetDailyUpgrade + }) + + $RemoveWingetDailyUpgrade.Add_Click( { + Unregister-WingetDailyUpgrade + }) + + $InstallChocolatey.Add_Click( { + Install-Chocolatey + }) + + $UninstallChocolatey.Add_Click( { + Uninstall-Chocolatey + }) + + $EnableChocolateyDailyUpgrade.Add_Click( { + Register-ChocolateyDailyUpgrade + }) + + $RemoveChocolateyDailyUpgrade.Add_Click( { + Unregister-ChocolateyDailyUpgrade + }) + + $RemoveAllChocolateyPackages.Add_Click( { + Remove-AllChocolateyPackage + }) + $UpgradeAll.Add_Click( { - Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("Update-AllPackage.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage + Update-AllPackage }) $InstallSelected.Add_Click( { @@ -1408,11 +1528,6 @@ function Show-GUI() { $InstallUbuntu.CheckState = "Unchecked" } - If ($InstallUbuntu16Lts.CheckState -eq "Checked") { - $AppsSelected.WSLDistros.Add("Ubuntu-16.04") - $InstallUbuntu16Lts.CheckState = "Unchecked" - } - If ($InstallUbuntu18Lts.CheckState -eq "Checked") { $AppsSelected.WSLDistros.Add("Ubuntu-18.04") $InstallUbuntu18Lts.CheckState = "Unchecked" diff --git a/src/lib/Grant-RegistryPermission.psm1 b/src/lib/Grant-RegistryPermission.psm1 deleted file mode 100644 index afd6a5c0..00000000 --- a/src/lib/Grant-RegistryPermission.psm1 +++ /dev/null @@ -1,29 +0,0 @@ -Import-Module -DisableNameChecking "$PSScriptRoot\Title-Templates.psm1" - -# Adapted from: https://www.ipswitch.com/blog/how-to-change-registry-permissions-with-powershell - -function Grant-RegistryPermission() { - [CmdletBinding()] - param ( - [Parameter(Position = 0, Mandatory)] - [String] $Key - ) - - Write-Status -Types "@" -Status "Trying to take ownership over the registry key: $Key" - $Acl = Get-Acl 'HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter' - - $IdentityRef = [System.Security.Principal.NTAccount]("$env:COMPUTERNAME\$env:USERNAME") # Identity - $RegistryRights = [System.Security.AccessControl.RegistryRights]::FullControl # Rights wanted - $InheritanceFlags = [System.Security.AccessControl.InheritanceFlags]::None # Inheritance flags type - $PropagationFlags = [System.Security.AccessControl.PropagationFlags]::None # Propagation flags type - $AccessControlType = [System.Security.AccessControl.AccessControlType]::Allow # Access control type - $Rule = New-Object System.Security.AccessControl.RegistryAccessRule ($IdentityRef, $RegistryRights, $InheritanceFlags, $PropagationFlags, $AccessControlType) # Registry access rule - - $Acl.AddAccessRule($Rule) # Add rule - $Acl | Set-Acl # Apply the Acl changes -} - -<# -.EXAMPLE -Grant-RegistryPermission -Key "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" # Sadly returns an error -#> diff --git a/src/lib/Open-File.psm1 b/src/lib/Open-File.psm1 index 51491c00..2e807473 100644 --- a/src/lib/Open-File.psm1 +++ b/src/lib/Open-File.psm1 @@ -49,7 +49,7 @@ function Open-RegFilesCollection { ForEach ($FileName in $Scripts) { $LastAccessUtc = "v$((Get-Item "$FileName").LastWriteTimeUtc | Get-Date -Format "yyyy-MM-dd")" $Private:Counter = Write-TitleCounter "$FileName ($LastAccessUtc)" -Counter $Counter -MaxLength $Scripts.Length - regedit /s "$FileName" + Start-Process -FilePath "regedit" -ArgumentList "/s", "$FileName" -Wait } Pop-Location diff --git a/src/lib/Title-Templates.psm1 b/src/lib/Title-Templates.psm1 index 24ed7a8a..1a4cfce1 100644 --- a/src/lib/Title-Templates.psm1 +++ b/src/lib/Title-Templates.psm1 @@ -41,9 +41,9 @@ function Write-ScriptLogo() { ██║ ╚██████╔╝╚██████╔╝███████╗███████║ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝ "@ - Write-Style $ASCIIText -Style Blink -Color Green - Write-Style "`n<•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••>" -Color White - Write-Style " It's Time to Debloat Windows!" -Style Blink -Color Cyan + Write-Style $ASCIIText -Style Blink -Color Green -BackColor Black + Write-Style "`n <•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••>" -Color White -BackColor Black + Write-Style " It's Time to Debloat Windows! By LeDragoX & Community" -Style Blink -Color Cyan } function Write-Section() { @@ -74,15 +74,15 @@ function Write-Status() { $TypesDone = "" ForEach ($Type in $Types) { - $TypesDone += "$([char]0x1b)[96m[$([char]0x1b)[97m$Type$([char]0x1b)[96m] " + $TypesDone += "$([char]0x1b)[100m$([char]0x1b)[96m[$([char]0x1b)[97m$Type$([char]0x1b)[96m]$([char]0x1b)[m " } - Write-Style "$TypesDone".Trim() -Style Bold -BackColor DarkGray -NoNewline + Write-Style "$TypesDone".Trim() -Style Bold -NoNewline If ($Warning) { - Write-Style " $Status" -Color Yellow -BackColor DarkBlue + Write-Style " $Status" -Color Yellow } Else { - Write-Style " $Status" -Color Green -BackColor Black + Write-Style " $Status" -Color Green } } @@ -100,7 +100,7 @@ function Write-Style() { [String] $ForeColor = 'White', [Parameter(Position = 3)] [ValidateSet('Black', 'Blue', 'DarkBlue', 'DarkCyan', 'DarkGray', 'DarkGreen', 'DarkMagenta', 'DarkRed', 'DarkYellow', 'Cyan', 'Gray', 'Green', 'Red', 'Magenta', 'White', 'Yellow')] - [String] $BackColor = 'Black', + [String] $BackColor = 'None', [Parameter(Position = 4)] [Switch] $NoNewline ) @@ -152,11 +152,14 @@ function Write-Style() { "Underline" = "$([char]0x1b)[4m" } + $FormattedText = "$($Styles.$Style)$($BackColors.$BackColor)$($ForeColors.$ForeColor)$Object" + If ($NoNewline) { - return Write-Host "$($Styles.$Style)$($BackColors.$BackColor)$($ForeColors.$ForeColor)$Object" -NoNewline + return Write-Host "$FormattedText" -NoNewline } - Write-Host "$($Styles.$Style)$($BackColors.$BackColor)$($ForeColors.$ForeColor)$Object" + Write-Host "$FormattedText" + Write-Verbose "Reference ^^^ S: $Style, F: $ForeColor, B: $BackColor" } function Write-Title() { diff --git a/src/lib/debloat-helper/Remove-ItemVerified.psm1 b/src/lib/debloat-helper/Remove-ItemVerified.psm1 index 19b2682c..761db75e 100644 --- a/src/lib/debloat-helper/Remove-ItemVerified.psm1 +++ b/src/lib/debloat-helper/Remove-ItemVerified.psm1 @@ -1,7 +1,6 @@ Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" function Remove-ItemVerified() { - [CmdletBinding(SupportsShouldProcess)] param ( [Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [String[]] $Path, @@ -16,24 +15,47 @@ function Remove-ItemVerified() { ) Begin { + $ScriptBlock = "Remove-Item" $Script:TweakType = "Exp/Reg" } Process { If (Test-Path "$Path") { Write-Status -Types "-", $TweakType -Status "Removing: '$Path'" - If ($Recurse -and $Force) { - Remove-Item -Path "$Path" -Include $Include -Exclude $Exclude -Recurse -Force - Continue + + If ($Path) { + $ScriptBlock += " -Path " + ForEach ($PathParam in $Path) { + $ScriptBlock += "`"$PathParam`", " + } + $ScriptBlock = $ScriptBlock.TrimEnd(", ") + } + + If ($Include) { + $ScriptBlock += " -Include " + ForEach ($IncludeParam in $Include) { + $ScriptBlock += "`"$IncludeParam`", " + } + $ScriptBlock = $ScriptBlock.TrimEnd(", ") + } + + If ($Exclude) { + $ScriptBlock += " -Exclude " + ForEach ($ExcludeParam in $Exclude) { + $ScriptBlock += "`"$ExcludeParam`", " + } + $ScriptBlock = $ScriptBlock.TrimEnd(", ") } If ($Recurse) { - Remove-Item -Path "$Path" -Include $Include -Exclude $Exclude -Recurse - } ElseIf ($Force) { - Remove-Item -Path "$Path" -Include $Include -Exclude $Exclude -Force - } Else { - Remove-Item -Path "$Path" -Include $Include -Exclude $Exclude + $ScriptBlock += " -Recurse" + } + + If ($Force) { + $ScriptBlock += " -Force" } + + Invoke-Expression "$ScriptBlock" } Else { Write-Status -Types "?", $TweakType -Status "The path $Path does not exist" -Warning } diff --git a/src/lib/debloat-helper/Remove-UWPApp.psm1 b/src/lib/debloat-helper/Remove-UWPApp.psm1 index 3b75ff80..d3df4b0d 100644 --- a/src/lib/debloat-helper/Remove-UWPApp.psm1 +++ b/src/lib/debloat-helper/Remove-UWPApp.psm1 @@ -13,14 +13,14 @@ function Remove-UWPApp() { Process { ForEach ($AppxPackage in $AppxPackages) { - If (!((Get-AppxPackage -AllUsers -Name "*$AppxPackage*") -or (Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$AppxPackage*"))) { + If (!((Get-AppxPackage -AllUsers -Name "$AppxPackage") -or (Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "$AppxPackage"))) { Write-Status -Types "?", $TweakType -Status "$AppxPackage was already removed or not found..." -Warning Continue } Write-Status -Types "-", $TweakType -Status "Trying to remove $AppxPackage from ALL users..." - Get-AppxPackage -AllUsers -Name "*$AppxPackage*" | Remove-AppxPackage -AllUsers - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$AppxPackage*" | Remove-AppxProvisionedPackage -Online -AllUsers + Get-AppxPackage -AllUsers -Name "$AppxPackage" | Remove-AppxPackage -AllUsers + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "$AppxPackage" | Remove-AppxProvisionedPackage -Online -AllUsers } } } diff --git a/src/lib/debloat-helper/Set-ItemPropertyVerified.psm1 b/src/lib/debloat-helper/Set-ItemPropertyVerified.psm1 index 4b76b335..5e427737 100644 --- a/src/lib/debloat-helper/Set-ItemPropertyVerified.psm1 +++ b/src/lib/debloat-helper/Set-ItemPropertyVerified.psm1 @@ -8,7 +8,7 @@ function Set-ItemPropertyVerified() { [Parameter(Position = 1, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [String] $Name, [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] - [ValidateSet('Binary', 'DWord', 'ExpandString', 'MultiString', 'Qword', 'String', 'Unknown')] + [ValidateSet('Binary', 'DWord', 'ExpandString', 'MultiString', 'None', 'Qword', 'String', 'Unknown')] [String] $Type, [Parameter(Position = 2, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] $Value <# Will have dynamic typing #> diff --git a/src/lib/debloat-helper/Set-ScheduledTaskState.psm1 b/src/lib/debloat-helper/Set-ScheduledTaskState.psm1 index 824d1f24..8f6a0693 100644 --- a/src/lib/debloat-helper/Set-ScheduledTaskState.psm1 +++ b/src/lib/debloat-helper/Set-ScheduledTaskState.psm1 @@ -18,7 +18,7 @@ function Set-ScheduledTaskState() { Process { ForEach ($ScheduledTask in $ScheduledTasks) { - If (!(Get-ScheduledTaskInfo -TaskName $ScheduledTask -ErrorAction SilentlyContinue)) { + If (!(Get-ScheduledTask -TaskName (Split-Path -Path $ScheduledTask -Leaf) -ErrorAction SilentlyContinue)) { Write-Status -Types "?", $TweakType -Status "The $ScheduledTask task was not found." -Warning Continue } diff --git a/src/lib/package-managers/Install-PackageManager.psm1 b/src/lib/package-managers/Install-PackageManager.psm1 new file mode 100644 index 00000000..dba6e523 --- /dev/null +++ b/src/lib/package-managers/Install-PackageManager.psm1 @@ -0,0 +1,35 @@ +Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" + +# Adapted from: https://github.com/ChrisTitusTech/win10script/blob/master/win10debloat.ps1 +# Adapted from: https://github.com/W4RH4WK/Debloat-Windows-10/blob/master/utils/install-basic-software.ps1 + +function Install-PackageManager() { + [CmdletBinding()] + param ( + [Parameter(Position = 0, Mandatory)] + [String] $PackageManagerFullName, + [Parameter(Position = 1, Mandatory)] + [ScriptBlock] $CheckExistenceBlock, + [Parameter(Position = 2, Mandatory)] + [ScriptBlock] $InstallCommandBlock, + [ScriptBlock] $PostInstallBlock, + [Switch] $Force + ) + + Try { + $Err = (Invoke-Expression "$CheckExistenceBlock") + If (($LASTEXITCODE -or $Force)) { throw $Err } # 0 = False, 1 = True + Write-Status -Types "?", $PackageManagerFullName -Status "$PackageManagerFullName is already installed." -Warning + } Catch { + Write-Status -Types "@", $PackageManagerFullName -Status "FORCE INSTALLING $PackageManagerFullName." -Warning + Write-Status -Types "?", $PackageManagerFullName -Status "$PackageManagerFullName was not found." -Warning + Write-Status -Types "+", $PackageManagerFullName -Status "Downloading and Installing $PackageManagerFullName package manager." + + Invoke-Expression "$InstallCommandBlock" + + If ($PostInstallBlock) { + Write-Status -Types "+", $PackageManagerFullName -Status "Executing post install script: { $("$PostInstallBlock".Trim(' ')) }." + Invoke-Expression "$PostInstallBlock" + } + } +} diff --git a/src/lib/package-managers/Manage-Chocolatey.psm1 b/src/lib/package-managers/Manage-Chocolatey.psm1 new file mode 100644 index 00000000..3a5d46fa --- /dev/null +++ b/src/lib/package-managers/Manage-Chocolatey.psm1 @@ -0,0 +1,201 @@ +Import-Module -DisableNameChecking "$PSScriptRoot\Install-PackageManager.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\Manage-DailyUpgradeJob.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\ui\Show-MessageDialog.psm1" + +$Script:DoneTitle = "Information" +$Script:DoneMessage = "Process Completed!" + +function Install-Chocolatey() { + [CmdletBinding()] + param ( + [Switch] $Force + ) + + Begin { + $ChocolateyParams = @{ + Name = "Chocolatey" + CheckExistenceBlock = { choco --version } + InstallCommandBlock = + { + Set-ExecutionPolicy Bypass -Scope Process -Force + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + } + PostInstallBlock = { choco install --ignore-dependencies --yes "chocolatey-core.extension" "chocolatey-fastanswers.extension" } + } + } + + Process { + If ($Force) { + # Install Chocolatey on Windows + Install-PackageManager -PackageManagerFullName $ChocolateyParams.Name -CheckExistenceBlock $ChocolateyParams.CheckExistenceBlock -InstallCommandBlock $ChocolateyParams.InstallCommandBlock -PostInstallBlock $ChocolateyParams.PostInstallBlock -Force + } Else { + Install-PackageManager -PackageManagerFullName $ChocolateyParams.Name -CheckExistenceBlock $ChocolateyParams.CheckExistenceBlock -InstallCommandBlock $ChocolateyParams.InstallCommandBlock -PostInstallBlock $ChocolateyParams.PostInstallBlock + } + + If (!$Force) { + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } + } +} + +# Adapted From: https://community.chocolatey.org/courses/installation/uninstalling#script +function Uninstall-Chocolatey() { + Process { + $VerbosePreference = 'Continue' + if (-not $env:ChocolateyInstall) { + $message = @( + "The ChocolateyInstall environment variable was not found." + "Chocolatey is not detected as installed. Nothing to do." + ) -join "`n" + + Write-Warning $message + return Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } + + if (-not (Test-Path $env:ChocolateyInstall)) { + $message = @( + "No Chocolatey installation detected at '$env:ChocolateyInstall'." + "Nothing to do." + ) -join "`n" + + Write-Warning $message + return Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } + + <# + Using the .NET registry calls is necessary here in order to preserve environment variables embedded in PATH values; + Powershell's registry provider doesn't provide a method of preserving variable references, and we don't want to + accidentally overwrite them with absolute path values. Where the registry allows us to see "%SystemRoot%" in a PATH + entry, PowerShell's registry provider only sees "C:\Windows", for example. + #> + $userKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Environment', $true) + $userPath = $userKey.GetValue('PATH', [string]::Empty, 'DoNotExpandEnvironmentNames').ToString() + + $machineKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey('SYSTEM\ControlSet001\Control\Session Manager\Environment\', $true) + $machinePath = $machineKey.GetValue('PATH', [string]::Empty, 'DoNotExpandEnvironmentNames').ToString() + + $backupPATHs = @( + "User PATH: $userPath" + "Machine PATH: $machinePath" + ) + $backupFile = "C:\PATH_backups_ChocolateyUninstall.txt" + $backupPATHs | Set-Content -Path $backupFile -Encoding UTF8 -Force + + $warningMessage = @" + This could cause issues after reboot where nothing is found if something goes wrong. + In that case, look at the backup file for the original PATH values in '$backupFile'. +"@ + + if ($userPath -like "*$env:ChocolateyInstall*") { + Write-Verbose "Chocolatey Install location found in User Path. Removing..." + Write-Warning $warningMessage + + $newUserPATH = @( + $userPath -split [System.IO.Path]::PathSeparator | + Where-Object { $_ -and $_ -ne "$env:ChocolateyInstall\bin" } + ) -join [System.IO.Path]::PathSeparator + + # NEVER use [Environment]::SetEnvironmentVariable() for PATH values; see https://github.com/dotnet/corefx/issues/36449 + # This issue exists in ALL released versions of .NET and .NET Core as of 12/19/2019 + $userKey.SetValue('PATH', $newUserPATH, 'ExpandString') + } + + if ($machinePath -like "*$env:ChocolateyInstall*") { + Write-Verbose "Chocolatey Install location found in Machine Path. Removing..." + Write-Warning $warningMessage + + $newMachinePATH = @( + $machinePath -split [System.IO.Path]::PathSeparator | + Where-Object { $_ -and $_ -ne "$env:ChocolateyInstall\bin" } + ) -join [System.IO.Path]::PathSeparator + + # NEVER use [Environment]::SetEnvironmentVariable() for PATH values; see https://github.com/dotnet/corefx/issues/36449 + # This issue exists in ALL released versions of .NET and .NET Core as of 12/19/2019 + $machineKey.SetValue('PATH', $newMachinePATH, 'ExpandString') + } + + # Adapt for any services running in subfolders of ChocolateyInstall + $agentService = Get-Service -Name chocolatey-agent -ErrorAction SilentlyContinue + if ($agentService -and $agentService.Status -eq 'Running') { + $agentService.Stop() + } + # TODO: add other services here + + Remove-Item -Path $env:ChocolateyInstall -Recurse -Force + + 'ChocolateyInstall', 'ChocolateyLastPathUpdate' | ForEach-Object { + foreach ($scope in 'User', 'Machine') { + [Environment]::SetEnvironmentVariable($_, [string]::Empty, $scope) + } + } + + $machineKey.Close() + $userKey.Close() + + if ($env:ChocolateyToolsLocation -and (Test-Path $env:ChocolateyToolsLocation)) { + Remove-Item -Path $env:ChocolateyToolsLocation -Recurse -Force + } + + foreach ($scope in 'User', 'Machine') { + [Environment]::SetEnvironmentVariable('ChocolateyToolsLocation', [string]::Empty, $scope) + } + + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } +} + +function Register-ChocolateyDailyUpgrade() { + Begin { + $ChocolateyJobParams = @{ + Name = "Chocolatey" + Time = "13:00" + UpdateScriptBlock = + { + Remove-Item -Path "$env:TEMP\Win-Debloat-Tools\logs\*" -Include "ChocolateyDailyUpgrade_*.log" + Start-Transcript -Path "$env:TEMP\Win-Debloat-Tools\logs\ChocolateyDailyUpgrade_$(Get-Date -Format "yyyy-MM-dd_HH-mm-ss").log" + choco upgrade all --ignore-dependencies --yes | Out-Host + Stop-Transcript + } + } + } + + Process { + Register-DailyUpgradeJob -PackageManagerFullName $ChocolateyJobParams.Name -Time $ChocolateyJobParams.Time -UpdateScriptBlock $ChocolateyJobParams.UpdateScriptBlock + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } +} + +function Unregister-ChocolateyDailyUpgrade() { + Begin { + $JobName = "Chocolatey Daily Upgrade" + } + + Process { + Unregister-DailyUpgradeJob -Name $JobName + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } +} + +function Remove-AllChocolateyPackage() { + Begin { + Import-Module -DisableNameChecking "$PSScriptRoot\Manage-Software.psm1" + $Ask = "Are you sure you want to remove:`n$((choco list) -match '\w \d.*\d' | ForEach-Object { "`n- $_" })`n`nPress YES to confirm." + $Question = Show-Question -Title "Remove ALL Chocolatey Packages?" -Message $Ask -BoxIcon "Warning" + } + + Process { + switch ($Question) { + 'Yes' { + Uninstall-Software -Name "All Chocolatey Packages" -Packages @("all") -PackageProvider 'Chocolatey' + } + 'No' { + Write-Host "Aborting..." + } + 'Cancel' { + Write-Host "Aborting..." # With Yes, No and Cancel, the user can press Esc to exit + } + } + } +} diff --git a/src/lib/package-managers/Manage-DailyUpgradeJob.psm1 b/src/lib/package-managers/Manage-DailyUpgradeJob.psm1 new file mode 100644 index 00000000..2c048519 --- /dev/null +++ b/src/lib/package-managers/Manage-DailyUpgradeJob.psm1 @@ -0,0 +1,67 @@ +Import-Module PSScheduledJob +Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" + +# Adapted from: https://blogs.technet.microsoft.com/heyscriptingguy/2013/11/23/using-scheduled-tasks-and-scheduled-jobs-in-powershell/ + +function Register-DailyUpgradeJob() { + [CmdletBinding()] + param ( + [Parameter(Position = 0, Mandatory)] + [String] $PackageManagerFullName, + [String] $Time, + [ScriptBlock] $UpdateScriptBlock + ) + + Begin { + $JobName = "$PackageManagerFullName Daily Upgrade" + $ScheduledJob = @{ + Name = $JobName + ScriptBlock = $UpdateScriptBlock + Trigger = New-JobTrigger -Daily -At $Time + ScheduledJobOption = New-ScheduledJobOption -RunElevated -MultipleInstancePolicy StopExisting -RequireNetwork + } + $ScheduledJobsPath = "\Microsoft\Windows\PowerShell\ScheduledJobs\" + } + + Process { + Write-Status -Types "@", $PackageManagerFullName -Status "Creating a daily task to automatically upgrade $PackageManagerFullName packages at $Time." + + If ((Get-ScheduledTask -TaskPath $ScheduledJobsPath -TaskName $JobName -ErrorAction SilentlyContinue) -or (Get-ScheduledJob -Name $JobName -ErrorAction SilentlyContinue)) { + Write-Status -Types "@", $PackageManagerFullName -Status "The ScheduledJob '$JobName' already exists!" -Warning + Write-Status -Types "@", $PackageManagerFullName -Status "Re-Creating with the command:" + Write-Host " { $("$UpdateScriptBlock".Trim(' ')) }`n" -ForegroundColor Cyan + Stop-ScheduledTask -TaskPath $ScheduledJobsPath -TaskName $JobName + Unregister-ScheduledJob -Name $JobName + Register-ScheduledJob @ScheduledJob | Out-Null + } Else { + Write-Status -Types "@", $PackageManagerFullName -Status "Creating Scheduled Job with the command:" + Write-Host " { $("$UpdateScriptBlock".Trim(' ')) }`n" -ForegroundColor Cyan + Register-ScheduledJob @ScheduledJob | Out-Null + } + } +} + +function Unregister-DailyUpgradeJob() { + [CmdletBinding()] + param ( + [Alias('ScheduledJobName')] + [Parameter(Position = 0, Mandatory)] + [String] $Name + ) + + Begin { + $ScheduledJobsPath = "\Microsoft\Windows\PowerShell\ScheduledJobs\" + } + + Process { + Write-Status -Types "@", "Scripted Job" -Status "Removing the Scheduled Job $Name." + + If ((Get-ScheduledTask -TaskPath $ScheduledJobsPath -TaskName $Name -ErrorAction SilentlyContinue) -or (Get-ScheduledJob -Name $Name -ErrorAction SilentlyContinue)) { + Write-Status -Types "@", "Scripted Job" -Status "ScheduledJob: $Name FOUND!" + Stop-ScheduledTask -TaskPath $ScheduledJobsPath -TaskName $Name + Unregister-ScheduledJob -Name $Name + } Else { + Write-Status -Types "@", "Scripted Job" -Status "Scheduled Job $Name was not found." -Warning + } + } +} diff --git a/src/lib/Manage-Software.psm1 b/src/lib/package-managers/Manage-Software.psm1 similarity index 82% rename from src/lib/Manage-Software.psm1 rename to src/lib/package-managers/Manage-Software.psm1 index 670f231f..3841fa99 100644 --- a/src/lib/Manage-Software.psm1 +++ b/src/lib/package-managers/Manage-Software.psm1 @@ -1,9 +1,12 @@ -Import-Module -DisableNameChecking "$PSScriptRoot\Title-Templates.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\ui\Show-MessageDialog.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\Manage-Chocolatey.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\Manage-Winget.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Open-File.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\ui\Show-MessageDialog.psm1" function Install-Software() { [CmdletBinding()] - [OutputType([String])] + [OutputType([ScriptBlock])] param ( [Parameter(Position = 0, Mandatory)] [String] $Name, @@ -17,18 +20,41 @@ function Install-Software() { [Switch] $NoDialog ) - $DoneTitle = "Information" - $DoneMessage = "$Name installed successfully!" + [ScriptBlock] $CheckVersionCommand + [String] $Script:DoneTitle = "Information" + [String] $Script:DoneMessage = "$Name installed successfully!" + + If ($PackageProvider -in @('Winget', 'MsStore')) { + $CheckVersionCommand = { winget --version } + } If ($PackageProvider -eq 'Chocolatey') { + $CheckVersionCommand = { choco --version } $InstallBlock = { choco install --ignore-dependencies --yes $Package } Write-Status -Types "?" -Status "Chocolatey is configured to ignore dependencies (bloat), you may need to install it before using any program." -Warning } If ($PackageProvider -eq 'WSL') { + $CheckVersionCommand = { wsl --version } $InstallBlock = { wsl --install --distribution $Package } } + Try { + $Err = (Invoke-Expression "$CheckVersionCommand") + If (($LASTEXITCODE)) { throw $Err } # 0 = False, 1 = True + Write-Status -Types "?", $PackageProvider -Status "$PackageProvider is already installed." -Warning + } Catch { + If ($PackageProvider -in @('Winget', 'MsStore')) { + Install-Winget -Force + } + If ($PackageProvider -in @('Chocolatey')) { + Install-Chocolatey -Force + } + If ($PackageProvider -in @('WSL')) { + Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("Install-WSL.ps1") -NoDialog + } + } + Write-Title "Installing $($Name) via $PackageProvider" $DoneMessage += "`n`nInstalled via $PackageProvider`:`n" diff --git a/src/lib/package-managers/Manage-Winget.psm1 b/src/lib/package-managers/Manage-Winget.psm1 new file mode 100644 index 00000000..b3c46234 --- /dev/null +++ b/src/lib/package-managers/Manage-Winget.psm1 @@ -0,0 +1,149 @@ +Import-Module -DisableNameChecking "$PSScriptRoot\Install-PackageManager.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\Manage-DailyUpgradeJob.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Get-HardwareInfo.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Get-TempScriptFolder.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Request-FileDownload.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\ui\Show-MessageDialog.psm1" + +# Adapted from: https://github.com/ChrisTitusTech/win10script/blob/master/win10debloat.ps1 +# Adapted from: https://github.com/W4RH4WK/Debloat-Windows-10/blob/master/utils/install-basic-software.ps1 + +$Script:DoneTitle = "Information" +$Script:DoneMessage = "Process Completed!" + +function Install-Winget() { + [CmdletBinding()] + param ( + [Switch] $Force + ) + + Begin { + $WingetParams = @{ + Name = "Winget" + CheckExistenceBlock = { winget --version } + InstallCommandBlock = + { + New-Item -Path "$(Get-TempScriptFolder)\downloads\" -Name "winget-install" -ItemType Directory -Force | Out-Null + Push-Location -Path "$(Get-TempScriptFolder)\downloads\winget-install\" + Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted + Install-Script -Name winget-install -Force + winget-install.ps1 + Pop-Location + Remove-Item -Path "$(Get-TempScriptFolder)\downloads\winget-install\" + } + } + + $WingetParams2 = @{ + Name = "Winget (Method 2)" + CheckExistenceBlock = { winget --version } + InstallCommandBlock = + { + $WingetDepOutput = Install-WingetDependency + $WingetOutput = Get-APIFile -URI "https://api.github.com/repos/microsoft/winget-cli/releases/latest" -ObjectProperty "assets" -FileNameLike "*.msixbundle" -PropertyValue "browser_download_url" -OutputFile "Microsoft.DesktopAppInstaller.msixbundle" + $AppName = Split-Path -Path $WingetOutput -Leaf + + Try { + # Method from: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md#machine-wide-provisioning + If ($WingetDepOutput) { + Write-Status -Types "@" -Status "Trying to install the App (w/ dependency): $AppName" -Warning + $InstallPackageCommand = { Add-AppxProvisionedPackage -Online -PackagePath $WingetOutput -SkipLicense -DependencyPackagePath $WingetDepOutput | Out-Null } + Invoke-Expression "$InstallPackageCommand" + } + + Write-Status -Types "@" -Status "Trying to install the App (no dependency): $AppName" -Warning + $InstallPackageCommand = { Add-AppxProvisionedPackage -Online -PackagePath $WingetOutput -SkipLicense | Out-Null } + Invoke-Expression "$InstallPackageCommand" + } Catch { + Write-Status -Types "@" -Status "Couldn't install '$AppName' automatically, trying to install the App manually..." -Warning + Start-Process "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" -Wait # GUI App installer can't install itself + } + + Remove-Item -Path $WingetOutput + Remove-Item -Path $WingetDepOutput + } + } + } + + Process { + If ($Force) { + # Install Winget on Windows (Method 1) + Install-PackageManager -PackageManagerFullName $WingetParams.Name -CheckExistenceBlock $WingetParams.CheckExistenceBlock -InstallCommandBlock $WingetParams.InstallCommandBlock -Force + # Install Winget on Windows (Method 2) + } Else { + # Install Winget on Windows (Method 1) + Install-PackageManager -PackageManagerFullName $WingetParams.Name -CheckExistenceBlock $WingetParams.CheckExistenceBlock -InstallCommandBlock $WingetParams.InstallCommandBlock + # Install Winget on Windows (Method 2) + } + + Install-PackageManager -PackageManagerFullName $WingetParams2.Name -CheckExistenceBlock $WingetParams2.CheckExistenceBlock -InstallCommandBlock $WingetParams2.InstallCommandBlock + + If (!$Force) { + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } + } +} + +function Install-WingetDependency() { + # Dependency for Winget: https://docs.microsoft.com/en-us/troubleshoot/developer/visualstudio/cpp/libraries/c-runtime-packages-desktop-bridge#how-to-install-and-update-desktop-framework-packages + $OSArchList = Get-OSArchitecture + + ForEach ($OSArch in $OSArchList) { + If ($OSArch -like "x64" -or "x86" -or "arm64" -or "arm") { + $WingetDepOutput = Request-FileDownload -FileURI "https://aka.ms/Microsoft.VCLibs.$OSArch.14.00.Desktop.appx" -OutputFile "Microsoft.VCLibs.14.00.Desktop.appx" + $AppName = Split-Path -Path $WingetDepOutput -Leaf + + Try { + Write-Status -Types "@" -Status "Trying to install the App: $AppName" -Warning + $InstallPackageCommand = { Add-AppxPackage -Path $WingetDepOutput } + Invoke-Expression "$InstallPackageCommand" + If ($LASTEXITCODE) { Throw "Couldn't install automatically" } + } Catch { + Write-Status -Types "@" -Status "Couldn't install '$AppName' automatically, trying to install the App manually..." -Warning + Start-Process -FilePath $WingetDepOutput + $AppInstallerId = (Get-Process AppInstaller).Id + Wait-Process -Id $AppInstallerId + } + + Return $WingetDepOutput + } Else { + Write-Status -Types "?" -Status "$OSArch is not supported!" -Warning + } + } + + Return $false +} + +function Register-WingetDailyUpgrade() { + Begin { + $WingetJobParams = @{ + Name = "Winget" + Time = "12:00" + UpdateScriptBlock = + { + Remove-Item -Path "$env:TEMP\Win-Debloat-Tools\logs\*" -Include "WingetDailyUpgrade_*.log" + Start-Transcript -Path "$env:TEMP\Win-Debloat-Tools\logs\WingetDailyUpgrade_$(Get-Date -Format "yyyy-MM-dd_HH-mm-ss").log" + Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force # Only needed to run Winget + winget source update --disable-interactivity | Out-Host + winget upgrade --all --silent | Out-Host + Stop-Transcript + } + } + } + + Process { + Register-DailyUpgradeJob -PackageManagerFullName $WingetJobParams.Name -Time $WingetJobParams.Time -UpdateScriptBlock $WingetJobParams.UpdateScriptBlock + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } +} + +function Unregister-WingetDailyUpgrade() { + Begin { + $JobName = "Winget Daily Upgrade" + } + + Process { + Unregister-DailyUpgradeJob -Name $JobName + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" + } +} diff --git a/src/scripts/other-scripts/Update-AllPackage.ps1 b/src/lib/package-managers/Update-AllPackage.psm1 similarity index 71% rename from src/scripts/other-scripts/Update-AllPackage.ps1 rename to src/lib/package-managers/Update-AllPackage.psm1 index e1b8b4d2..04b19ed4 100644 --- a/src/scripts/other-scripts/Update-AllPackage.ps1 +++ b/src/lib/package-managers/Update-AllPackage.psm1 @@ -1,4 +1,8 @@ -Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Title-Templates.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\Title-Templates.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\ui\Show-MessageDialog.psm1" + +$Script:DoneTitle = "Information" +$Script:DoneMessage = "Process Completed!" function Update-AllPackage() { Write-Section "Upgrade all Packages" @@ -22,6 +26,6 @@ function Update-AllPackage() { } Catch { Write-Status -Types "!" -Status "Failed to upgrade packages through WSL (maybe it's uninstalled?)" -Warning } -} -Update-AllPackage + Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage" +} diff --git a/src/scripts/Install-PackageManager.ps1 b/src/scripts/Install-PackageManager.ps1 deleted file mode 100644 index db1bc5d8..00000000 --- a/src/scripts/Install-PackageManager.ps1 +++ /dev/null @@ -1,177 +0,0 @@ -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Get-HardwareInfo.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Get-TempScriptFolder.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Request-FileDownload.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Title-Templates.psm1" - -# Adapted from: https://github.com/ChrisTitusTech/win10script/blob/master/win10debloat.ps1 -# Adapted from: https://github.com/W4RH4WK/Debloat-Windows-10/blob/master/utils/install-basic-software.ps1 - -function Install-PackageManager() { - [CmdletBinding()] - param ( - [Parameter(Position = 0, Mandatory)] - [String] $PackageManagerFullName, - [Parameter(Position = 1, Mandatory)] - [ScriptBlock] $CheckExistenceBlock, - [Parameter(Position = 2, Mandatory)] - [ScriptBlock] $InstallCommandBlock, - [String] $Time, - [ScriptBlock] $UpdateScriptBlock, - [ScriptBlock] $PostInstallBlock - ) - - Try { - $Err = (Invoke-Expression "$CheckExistenceBlock") - If (($LASTEXITCODE)) { throw $Err } # 0 = False, 1 = True - Write-Status -Types "?", $PackageManagerFullName -Status "$PackageManagerFullName is already installed." -Warning - } Catch { - Write-Status -Types "?", $PackageManagerFullName -Status "$PackageManagerFullName was not found." -Warning - Write-Status -Types "+", $PackageManagerFullName -Status "Downloading and Installing $PackageManagerFullName package manager." - - Invoke-Expression "$InstallCommandBlock" - - If ($PostInstallBlock) { - Write-Status -Types "+", $PackageManagerFullName -Status "Executing post install script: { $("$PostInstallBlock".Trim(' ')) }." - Invoke-Expression "$PostInstallBlock" - } - } - - # Self-reminder, this part stay out of the Try-Catch block - If ($UpdateScriptBlock) { - # Adapted from: https://blogs.technet.microsoft.com/heyscriptingguy/2013/11/23/using-scheduled-tasks-and-scheduled-jobs-in-powershell/ - Write-Status -Types "@", $PackageManagerFullName -Status "Creating a daily task to automatically upgrade $PackageManagerFullName packages at $Time." - $JobName = "$PackageManagerFullName Daily Upgrade" - $ScheduledJob = @{ - Name = $JobName - ScriptBlock = $UpdateScriptBlock - Trigger = New-JobTrigger -Daily -At $Time - ScheduledJobOption = New-ScheduledJobOption -RunElevated -MultipleInstancePolicy StopExisting -RequireNetwork - } - - If ((Get-ScheduledTask -TaskName $JobName -ErrorAction SilentlyContinue) -or (Get-ScheduledJob -Name $JobName -ErrorAction SilentlyContinue)) { - Write-Status -Types "@", $PackageManagerFullName -Status "ScheduledJob: $JobName FOUND!" - Write-Status -Types "@", $PackageManagerFullName -Status "Re-Creating with the command:" - Write-Host " { $("$UpdateScriptBlock".Trim(' ')) }`n" -ForegroundColor Cyan - Stop-ScheduledTask -TaskPath "\Microsoft\Windows\PowerShell\ScheduledJobs" -TaskName $JobName - Unregister-ScheduledJob -Name $JobName - Register-ScheduledJob @ScheduledJob | Out-Null - } Else { - Write-Status -Types "@", $PackageManagerFullName -Status "Creating Scheduled Job with the command:" - Write-Host " { $("$UpdateScriptBlock".Trim(' ')) }`n" -ForegroundColor Cyan - Register-ScheduledJob @ScheduledJob | Out-Null - } - } -} - -function Install-WingetDependency() { - # Dependency for Winget: https://docs.microsoft.com/en-us/troubleshoot/developer/visualstudio/cpp/libraries/c-runtime-packages-desktop-bridge#how-to-install-and-update-desktop-framework-packages - $OSArchList = Get-OSArchitecture - - ForEach ($OSArch in $OSArchList) { - If ($OSArch -like "x64" -or "x86" -or "arm64" -or "arm") { - $WingetDepOutput = Request-FileDownload -FileURI "https://aka.ms/Microsoft.VCLibs.$OSArch.14.00.Desktop.appx" -OutputFile "Microsoft.VCLibs.14.00.Desktop.appx" - $AppName = Split-Path -Path $WingetDepOutput -Leaf - - Try { - Write-Status -Types "@" -Status "Trying to install the App: $AppName" -Warning - $InstallPackageCommand = { Add-AppxPackage -Path $WingetDepOutput } - Invoke-Expression "$InstallPackageCommand" - If ($LASTEXITCODE) { Throw "Couldn't install automatically" } - } Catch { - Write-Status -Types "@" -Status "Couldn't install '$AppName' automatically, trying to install the App manually..." -Warning - Start-Process -FilePath $WingetDepOutput - $AppInstallerId = (Get-Process AppInstaller).Id - Wait-Process -Id $AppInstallerId - } - - Return $WingetDepOutput - } Else { - Write-Status -Types "?" -Status "$OSArch is not supported!" -Warning - } - } - - Return $false -} - -$WingetParams = @{ - Name = "Winget" - CheckExistenceBlock = { winget --version } - InstallCommandBlock = - { - New-Item -Path "$(Get-TempScriptFolder)\downloads\" -Name "winget-install" -ItemType Directory -Force | Out-Null - Push-Location -Path "$(Get-TempScriptFolder)\downloads\winget-install\" - Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted - Install-Script -Name winget-install -Force - winget-install.ps1 - Pop-Location - Remove-Item -Path "$(Get-TempScriptFolder)\downloads\winget-install\" - } - Time = "12:00" - UpdateScriptBlock = - { - Remove-Item -Path "$env:TEMP\Win-Debloat-Tools\logs\*" -Include "WingetDailyUpgrade_*.log" - Start-Transcript -Path "$env:TEMP\Win-Debloat-Tools\logs\WingetDailyUpgrade_$(Get-Date -Format "yyyy-MM-dd_HH-mm-ss").log" - Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force # Only needed to run Winget - winget source update --disable-interactivity | Out-Host - winget upgrade --all --silent | Out-Host - Stop-Transcript - } -} - -$WingetParams2 = @{ - Name = "Winget (Method 2)" - CheckExistenceBlock = { winget --version } - InstallCommandBlock = - { - $WingetDepOutput = Install-WingetDependency - $WingetOutput = Get-APIFile -URI "https://api.github.com/repos/microsoft/winget-cli/releases/latest" -ObjectProperty "assets" -FileNameLike "*.msixbundle" -PropertyValue "browser_download_url" -OutputFile "Microsoft.DesktopAppInstaller.msixbundle" - $AppName = Split-Path -Path $WingetOutput -Leaf - - Try { - # Method from: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md#machine-wide-provisioning - If ($WingetDepOutput) { - Write-Status -Types "@" -Status "Trying to install the App (w/ dependency): $AppName" -Warning - $InstallPackageCommand = { Add-AppxProvisionedPackage -Online -PackagePath $WingetOutput -SkipLicense -DependencyPackagePath $WingetDepOutput | Out-Null } - Invoke-Expression "$InstallPackageCommand" - } - - Write-Status -Types "@" -Status "Trying to install the App (no dependency): $AppName" -Warning - $InstallPackageCommand = { Add-AppxProvisionedPackage -Online -PackagePath $WingetOutput -SkipLicense | Out-Null } - Invoke-Expression "$InstallPackageCommand" - } Catch { - Write-Status -Types "@" -Status "Couldn't install '$AppName' automatically, trying to install the App manually..." -Warning - Start-Process "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" -Wait # GUI App installer can't install itself - } - - Remove-Item -Path $WingetOutput - Remove-Item -Path $WingetDepOutput - } -} - -$ChocolateyParams = @{ - Name = "Chocolatey" - CheckExistenceBlock = { choco --version } - InstallCommandBlock = - { - Set-ExecutionPolicy Bypass -Scope Process -Force - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 - Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - } - Time = "13:00" - UpdateScriptBlock = - { - Remove-Item -Path "$env:TEMP\Win-Debloat-Tools\logs\*" -Include "ChocolateyDailyUpgrade_*.log" - Start-Transcript -Path "$env:TEMP\Win-Debloat-Tools\logs\ChocolateyDailyUpgrade_$(Get-Date -Format "yyyy-MM-dd_HH-mm-ss").log" - choco upgrade all --ignore-dependencies --yes | Out-Host - Stop-Transcript - } - PostInstallBlock = { choco install --ignore-dependencies --yes "chocolatey-core.extension" "chocolatey-fastanswers.extension" "dependency-windows10" } -} - -# Install Winget on Windows (Method 1) -Install-PackageManager -PackageManagerFullName $WingetParams.Name -CheckExistenceBlock $WingetParams.CheckExistenceBlock -InstallCommandBlock $WingetParams.InstallCommandBlock -Time $WingetParams.Time -UpdateScriptBlock $WingetParams.UpdateScriptBlock -# Install Winget on Windows (Method 2) -Install-PackageManager -PackageManagerFullName $WingetParams2.Name -CheckExistenceBlock $WingetParams2.CheckExistenceBlock -InstallCommandBlock $WingetParams2.InstallCommandBlock -# Install Chocolatey on Windows -Install-PackageManager -PackageManagerFullName $ChocolateyParams.Name -CheckExistenceBlock $ChocolateyParams.CheckExistenceBlock -InstallCommandBlock $ChocolateyParams.InstallCommandBlock -Time $ChocolateyParams.Time -UpdateScriptBlock $ChocolateyParams.UpdateScriptBlock -PostInstallBlock $ChocolateyParams.PostInstallBlock - diff --git a/src/scripts/Register-PersonalTweaksList.ps1 b/src/scripts/Register-PersonalTweaksList.ps1 index a1e2dd35..6d5783bd 100644 --- a/src/scripts/Register-PersonalTweaksList.ps1 +++ b/src/scripts/Register-PersonalTweaksList.ps1 @@ -1,3 +1,4 @@ +Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Get-HardwareInfo.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Open-File.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Title-Templates.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Remove-ItemVerified.psm1" @@ -7,6 +8,7 @@ Import-Module -DisableNameChecking "$PSScriptRoot\..\utils\Individual-Tweaks.psm # Adapted from: https://github.com/ChrisTitusTech/win10script # Adapted from: https://github.com/Sycnex/Windows10Debloater # Adapted from: https://github.com/kalaspuffar/windows-debloat +# Adapted From: https://learn.microsoft.com/en-us/answers/questions/288732/url-associate-with-internet-browser function Register-PersonalTweaksList() { [CmdletBinding()] @@ -44,17 +46,58 @@ function Register-PersonalTweaksList() { $PathToLMPoliciesExplorer = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $PathToLMPoliciesNewsAndInterest = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" $PathToLMPoliciesWindowsSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + $PathToLMRemovableDevices = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\DelegateFolders\{F5FB2C77-0E2F-4A16-A381-3E560C68BC83}" Write-Title "My Personal Tweaks" If (!$Revert) { $Scripts = @("enable-photo-viewer.reg") Enable-DarkTheme + Enable-LegacyContextMenu } Else { $Scripts = @("disable-photo-viewer.reg") Disable-DarkTheme + Disable-LegacyContextMenu } Open-RegFilesCollection -RelativeLocation "src\utils" -Scripts $Scripts -NoDialog + If ((Get-SystemSpec)[2] -like '*Windows 10*') { + Write-Status -Types "+", $TweakType -Status "Fixing .URL file association with Internet Browser..." + + # Changing .url to Internet Browser by enforcing + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\DefaultIcon" -Name "(default)" -Type ExpandString -Value "C:\Windows\System32\url.dll,5" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\Shell\Open" -Name "CLSID" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\Shell\Open" -Name "LegacyDisable" -Type String -Value "" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\Shell\Open\Command" -Name "(default)" -Type String -Value "`"C:\Windows\System32\rundll32.exe`" `"C:\Windows\System32\ieframe.dll`",OpenURL %l" + New-Item -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\ShellEx" -Force | Out-Null + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\ShellEx\{000214EE-0000-0000-C000-000000000046}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\ShellEx\{000214F9-0000-0000-C000-000000000046}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\ShellEx\{00021500-0000-0000-C000-000000000046}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\ShellEx\{CABB0DA0-DA57-11CF-9974-0020AFD79762}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Classes\IE.AssocFile.URL\ShellEx\{FBF23B80-E3F0-101B-8488-00AA003E56F8}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + + # Linking InternetShortcut to url files + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url" -Name "(default)" -Type String -Value "InternetShortcut" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\OpenWithProgIds" -Name "InternetShortcut" -Type String -Value "" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\PersistentHandler" -Name "(default)" -Type String -Value "{8CD34779-9F10-4f9b-ADFB-B3FAEABDAB5A}" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\ShellEx\{000214EE-0000-0000-C000-000000000046}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\ShellEx\{000214F9-0000-0000-C000-000000000046}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\ShellEx\{00021500-0000-0000-C000-000000000046}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\ShellEx\{CABB0DA0-DA57-11CF-9974-0020AFD79762}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\.url\ShellEx\{FBF23B80-E3F0-101B-8488-00AA003E56F8}" -Name "(default)" -Type String -Value "{FBF23B40-E3F0-101B-8488-00AA003E56F8}" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\InternetShortcut" -Name "(default)" -Type String -Value "InternetShortcut" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\InternetShortcut\DefaultIcon" -Name "(default)" -Type ExpandString -Value "%SystemRoot%\System32\url.dll,5" + Set-ItemPropertyVerified -Path "Registry::HKEY_CLASSES_ROOT\InternetShortcut\tabsets" -Name "selection" -Type DWord -Value 0x00000705 + + # Doing changes to Current User + New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.url\OpenWithList" -Force | Out-Null + Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.url\OpenWithProgids" -Name "InternetShortcut" -Type None -Value ([byte[]]@()) + Open-RegFilesCollection -RelativeLocation "src\utils" -Scripts "fix-url-association.reg" -NoDialog + Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.url\UserChoice" -Name "Hash" -Type String -Value "wMx4BywX2RI=" + Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.url\UserChoice" -Name "ProgId" -Type String -Value "IE.AssocFile.URL" + Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\Roaming\OpenWith\FileExts\.url\UserChoice" -Name "Hash" -Type String -Value "wMx4BywX2RI=" + Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\Roaming\OpenWith\FileExts\.url\UserChoice" -Name "ProgId" -Type String -Value "IE.AssocFile.URL" + } + # Show Task Manager details - Applicable to 1607 and later - Although this functionality exist even in earlier versions, the Task Manager's behavior is different there and is not compatible with this tweak If ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name CurrentBuild).CurrentBuild -lt 22557) { Write-Status -Types "+", $TweakType -Status "Showing task manager details..." @@ -90,10 +133,6 @@ function Register-PersonalTweaksList() { Write-Status -Types $EnableStatus[1].Symbol, $TweakType -Status "$($EnableStatus[1].Status) Show Drives without Media..." Set-ItemPropertyVerified -Path "$PathToCUExplorerAdvanced" -Name "HideDrivesWithNoMedia" -Type DWord -Value $Zero - Write-Status -Types $EnableStatus[0].Symbol, $TweakType -Status "$($EnableStatus[0].Status) MRU lists (jump lists) of XAML apps in Start Menu..." - Set-ItemPropertyVerified -Path "$PathToCUExplorerAdvanced" -Name "Start_TrackDocs" -Type DWord -Value $Zero - Set-ItemPropertyVerified -Path "$PathToCUExplorerAdvanced" -Name "Start_TrackProgs" -Type DWord -Value $Zero - Write-Status -Types "*", $TweakType -Status "Restoring Aero-Shake Minimize feature..." Remove-ItemProperty -Path "$PathToCUExplorerAdvanced" -Name "DisallowShaking" -Force -ErrorAction SilentlyContinue @@ -110,10 +149,16 @@ function Register-PersonalTweaksList() { Write-Status -Types "-", $TweakType -Status "Disabling '- Shortcut' name after creating a shortcut..." Set-ItemPropertyVerified -Path "$PathToCUExplorer" -Name "link" -Type Binary -Value ([byte[]](0x00, 0x00, 0x00, 0x00)) + Write-Status -Types "-", $TweakType -Status "Hiding duplicated Removable Devices on Navigation Pane..." + Remove-ItemVerified -Path $PathToLMRemovableDevices -Recurse + + Write-Status -Types "*", $TweakType -Status "Disabling expand to folder in Navigation Pane..." + Set-ItemPropertyVerified -Path "$PathToCUExplorerAdvanced" -Name "NavPaneExpandToCurrentFolder" -Type DWord -Value 0 + Write-Section "Task Bar Tweaks" Write-Caption "Task Bar - Windows 10 Compatible" Write-Status -Types $EnableStatus[0].Symbol, $TweakType -Status "$($EnableStatus[0].Status) the 'Search Box' from taskbar..." - # [@] (0 = Hide completely, 1 = Show icon only, 2 = Show long Search Box) + # [@] (0 = Hide completely, 1 = Show icon only, 2 = Show long Search Box, 3 = Search Icon and Label (Windows 11)) Set-ItemPropertyVerified -Path "$PathToCUWindowsSearch" -Name "SearchboxTaskbarMode" -Type DWord -Value $Zero Write-Status -Types $EnableStatus[0].Symbol, $TweakType -Status "$($EnableStatus[0].Status) Windows search highlights from taskbar..." @@ -170,6 +215,16 @@ function Register-PersonalTweaksList() { Write-Status -Types $EnableStatus[1].Symbol, $TweakType -Status "$($EnableStatus[1].Status) driver download over metered connections..." Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceSetup" -Name "CostedNetworkPolicy" -Type DWord -Value $One + Write-Section "Personalization" + Write-Caption "Start" + Write-Status -Types $EnableStatus[0].Symbol, $TweakType -Status "$($EnableStatus[0].Status) Most Recent Used (MRU) items in Start, Jump Lists and File Explorer..." + Set-ItemPropertyVerified -Path "$PathToCUExplorerAdvanced" -Name "Start_TrackDocs" -Type DWord -Value $Zero + + Write-Section "Privacy" + Write-Caption "General" + Write-Status -Types "*", $TweakType -Status "Enabling Let Windows track app launches to improve Start and search results (Run Dialog History)..." + Set-ItemPropertyVerified -Path "$PathToCUExplorerAdvanced" -Name "Start_TrackProgs" -Type DWord -Value 1 + Write-Section "Cortana Tweaks" Write-Status -Types $EnableStatus[0].Symbol, $TweakType -Status "$($EnableStatus[0].Status) Bing Search in Start Menu..." Set-ItemPropertyVerified -Path "$PathToCUWindowsSearch" -Name "BingSearchEnabled" -Type DWord -Value $Zero diff --git a/src/scripts/Remove-BloatwareAppsList.ps1 b/src/scripts/Remove-BloatwareAppsList.ps1 index cf88b2e3..d9b8643b 100644 --- a/src/scripts/Remove-BloatwareAppsList.ps1 +++ b/src/scripts/Remove-BloatwareAppsList.ps1 @@ -2,7 +2,7 @@ Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Remove-UWPApp.psm1" function Remove-BloatwareAppsList() { - $Apps = @( + $MSApps = @( # Default Windows 10+ apps "Microsoft.3DBuilder" # 3D Builder "Microsoft.549981C3F5F10" # Cortana @@ -48,64 +48,93 @@ function Remove-BloatwareAppsList() { "Microsoft.ZuneMusic" # Groove Music / (New) Windows Media Player "Microsoft.ZuneVideo" # Movies & TV + # Apps which other apps depend on + "Microsoft.Advertising.Xaml" + # Default Windows 11 apps "Clipchamp.Clipchamp" # Clipchamp – Video Editor "MicrosoftWindows.Client.WebExperience" # Taskbar Widgets "MicrosoftTeams" # Microsoft Teams / Preview - # 3rd party Apps - "ACGMediaPlayer" - "ActiproSoftwareLLC" - "AdobePhotoshopExpress" # Adobe Photoshop Express - "Amazon.com.Amazon" # Amazon Shop - "Asphalt8Airborne" # Asphalt 8 Airbone - "AutodeskSketchBook" - "BubbleWitch3Saga" # Bubble Witch 3 Saga - "CaesarsSlotsFreeCasino" - "CandyCrush" # Candy Crush - "COOKINGFEVER" - "CyberLinkMediaSuiteEssentials" - "DisneyMagicKingdoms" - "Dolby" # Dolby Products (Like Atmos) - "DrawboardPDF" - "Duolingo-LearnLanguagesforFree" # Duolingo - "EclipseManager" - "Facebook" # Facebook - "FarmVille2CountryEscape" - "FitbitCoach" - "Flipboard" # Flipboard - "HiddenCity" - "Hulu" - "iHeartRadio" - "Keeper" - "LinkedInforWindows" - "MarchofEmpires" - "Netflix" # Netflix - "NYTCrossword" - "OneCalendar" - "PandoraMediaInc" - "PhototasticCollage" - "PicsArt-PhotoStudio" - "Plex" # Plex - "PolarrPhotoEditorAcademicEdition" - "RoyalRevolt" # Royal Revolt - "Shazam" - "Sidia.LiveWallpaper" # Live Wallpaper - "SlingTV" - "Speed Test" - "Sway" - "TuneInRadio" - "Twitter" # Twitter - "Viber" - "WinZipUniversal" - "Wunderlist" - "XING" + # <==========[ DIY ]==========> (Remove the # to Uninstall) - # Apps which other apps depend on - "Microsoft.Advertising.Xaml" + # [DIY] Default apps i'll keep + #"Microsoft.FreshPaint" # Paint + #"Microsoft.MicrosoftStickyNotes" # Sticky Notes + #"Microsoft.WindowsCalculator" # Calculator + #"Microsoft.WindowsCamera" # Camera + #"Microsoft.ScreenSketch" # Snip and Sketch (now called Snipping tool, replaces the Win32 version in clean installs) + #"Microsoft.Windows.DevHome" # Dev Home + #"Microsoft.Windows.Photos" # Photos / Video Editor + + # [DIY] Can't be reinstalled + #"Microsoft.WindowsStore" # Windows Store + + # Apps which cannot be removed using Remove-AppxPackage + #"Microsoft.BioEnrollment" + #"Microsoft.WindowsFeedback" # Feedback Module + #"Windows.ContactSupport" + ) + + $ThirdPartyApps = @( + "*ACGMediaPlayer*" + "*ActiproSoftwareLLC*" + "*AdobePhotoshopExpress*" # Adobe Photoshop Express + "Amazon.com.Amazon" # Amazon Shop + "*Asphalt8Airborne*" # Asphalt 8 Airbone + "*AutodeskSketchBook*" + "*BubbleWitch3Saga*" # Bubble Witch 3 Saga + "*CaesarsSlotsFreeCasino*" + "*CandyCrush*" # Candy Crush + "*COOKINGFEVER*" + "*CyberLinkMediaSuiteEssentials*" + "*DisneyMagicKingdoms*" + "*Dolby*" # Dolby Products (Like Atmos) + "*DrawboardPDF*" + "*Duolingo-LearnLanguagesforFree*" # Duolingo + "*EclipseManager*" + "*FarmVille2CountryEscape*" + "*FitbitCoach*" + "*Flipboard*" # Flipboard + "*HiddenCity*" + "*Keeper*" + "*LinkedInforWindows*" + "*MarchofEmpires*" + "*NYTCrossword*" + "*OneCalendar*" + "*PandoraMediaInc*" + "*PhototasticCollage*" + "*PicsArt-PhotoStudio*" + "*PolarrPhotoEditorAcademicEdition*" + "*RoyalRevolt*" # Royal Revolt + "*Shazam*" + "*Sidia.LiveWallpaper*" # Live Wallpaper + "*Speed Test*" + "*Sway*" + "*WinZipUniversal*" + "*Wunderlist*" + "*XING*" + ) + + $ManufacturerApps = @( + # Dell Bloat + "DB6EA5DB.MediaSuiteEssentialsforDell" + "DB6EA5DB.PowerDirectorforDell" + "DB6EA5DB.Power2GoforDell" + "DB6EA5DB.PowerMediaPlayerforDell" + #"DellInc.423703F9C7E0E" # Alienware OC Controls + #"DellInc.6066037A8FCF7" # Alienware Control Center + #"DellInc.AlienwareCommandCenter" # Alienware Command Center + #"DellInc.AlienwareFXAW*" # Alienware FX AWxx versions + #"DellInc.AlienwareFXAW21" # Alienware FX AW21 + "DellInc.DellCustomerConnect" # Dell Customer Connect + "DellInc.DellDigitalDelivery" # Dell Digital Delivery + "DellInc.DellHelpSupport" + "DellInc.DellProductRegistration" + "DellInc.MyDell" # My Dell # SAMSUNG Bloat - #"SAMSUNGELECTRONICSCO.LTD.SamsungSettings1.2" # Allow user to Tweak some hardware settings + #"SAMSUNGELECTRONICSCO.LTD.SamsungSettings1.2" # Allow user to Tweak some hardware settings "SAMSUNGELECTRONICSCO.LTD.1412377A9806A" "SAMSUNGELECTRONICSCO.LTD.NewVoiceNote" "SAMSUNGELECTRONICSCoLtd.SamsungNotes" @@ -115,43 +144,47 @@ function Remove-BloatwareAppsList() { "SAMSUNGELECTRONICSCO.LTD.SamsungUpdate" "SAMSUNGELECTRONICSCO.LTD.SamsungSecurity1.2" "SAMSUNGELECTRONICSCO.LTD.SamsungScreenRecording" - #"SAMSUNGELECTRONICSCO.LTD.SamsungRecovery" # Used to Factory Reset + #"SAMSUNGELECTRONICSCO.LTD.SamsungRecovery" # Used to Factory Reset "SAMSUNGELECTRONICSCO.LTD.SamsungQuickSearch" "SAMSUNGELECTRONICSCO.LTD.SamsungPCCleaner" "SAMSUNGELECTRONICSCO.LTD.SamsungCloudBluetoothSync" "SAMSUNGELECTRONICSCO.LTD.PCGallery" "SAMSUNGELECTRONICSCO.LTD.OnlineSupportSService" "4AE8B7C2.BOOKING.COMPARTNERAPPSAMSUNGEDITION" + ) - # <==========[ DIY ]==========> (Remove the # to Uninstall) - - # [DIY] Default apps i'll keep - - #"Microsoft.FreshPaint" # Paint - #"Microsoft.MicrosoftEdge" # Microsoft Edge - #"Microsoft.MicrosoftStickyNotes" # Sticky Notes - #"Microsoft.WindowsCalculator" # Calculator - #"Microsoft.WindowsCamera" # Camera - #"Microsoft.ScreenSketch" # Snip and Sketch (now called Snipping tool, replaces the Win32 version in clean installs) - #"Microsoft.Windows.Photos" # Photos - - # [DIY] Common Streaming services - - #"SpotifyMusic" # Spotify - - # [DIY] Can't be reinstalled - - #"Microsoft.WindowsStore" # Windows Store + $SocialMediaApps = @( + "5319275A.WhatsAppDesktop" # WhatsApp + "BytedancePte.Ltd.TikTok" # TikTok + "FACEBOOK.317180B0BB486" # Messenger + "FACEBOOK.FACEBOOK" # Facebook + "Facebook.Instagram*" # Instagram / Beta + "*Twitter*" # Twitter + "*Viber*" + ) - # Apps which cannot be removed using Remove-AppxPackage - #"Microsoft.BioEnrollment" - #"Microsoft.WindowsFeedback" # Feedback Module - #"Windows.ContactSupport" + $StreamingServicesApps = @( + "AmazonVideo.PrimeVideo" # Amazon Prime Video + "*Hulu*" + "*iHeartRadio*" + "*Netflix*" # Netflix + "*Plex*" # Plex + "*SlingTV*" + "SpotifyAB.SpotifyMusic" # Spotify + "*TuneInRadio*" ) - Write-Title "Remove Bloatware Apps" - Write-Section "Removing Windows unneeded Apps" - Remove-UWPApp -AppxPackages $Apps + Write-Title "Remove Windows unneeded Apps (Bloatware)" + Write-Section "Microsoft Apps" + Remove-UWPApp -AppxPackages $MSApps + Write-Section "3rd-party Apps" + Remove-UWPApp -AppxPackages $ThirdPartyApps + Write-Section "Manufacturer Apps" + Remove-UWPApp -AppxPackages $ManufacturerApps + Write-Section "Social Media Apps" + Remove-UWPApp -AppxPackages $SocialMediaApps + Write-Section "Streaming Services Apps" + Remove-UWPApp -AppxPackages $StreamingServicesApps } # List all Packages: @@ -161,4 +194,3 @@ function Remove-BloatwareAppsList() { #Get-AppxProvisionedPackage -Online | Select-Object -Property DisplayName, Architecture, Version, PublisherId, InstallLocation, Region, ResourceId | Sort-Object PublisherId, DisplayName, Architecture | Format-Table Remove-BloatwareAppsList # Remove the main Bloat from Pre-installed Apps - diff --git a/src/scripts/Remove-MSEdge.ps1 b/src/scripts/Remove-MSEdge.ps1 index 433a2b9f..cdad1ce5 100644 --- a/src/scripts/Remove-MSEdge.ps1 +++ b/src/scripts/Remove-MSEdge.ps1 @@ -10,13 +10,13 @@ function Remove-MSEdge() { Write-Status -Types "@" -Status "Stopping all 'msedge' processes before uninstalling..." Get-Process -Name msedge | Stop-Process -PassThru -Force - If ((Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge\Application") -or (Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeWebView\Application")) { + If (Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge\Application") { ForEach ($FullName in (Get-ChildItem -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge*\Application\*\Installer\setup.exe").FullName) { Write-Status -Types "@" -Status "Uninstalling MS Edge from $FullName..." - Start-Process -FilePath $FullName -ArgumentList "--uninstall", "--msedgewebview", "--system-level", "--verbose-logging", "--force-uninstall" -Wait + Start-Process -FilePath $FullName -ArgumentList "--uninstall", "--system-level", "--verbose-logging", "--force-uninstall" -Wait } } Else { - Write-Status -Types "?" -Status "Edge/EdgeWebView folder does not exist anymore..." -Warning + Write-Status -Types "?" -Status "Edge folder does not exist anymore..." -Warning } If (Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeCore") { @@ -28,7 +28,9 @@ function Remove-MSEdge() { Write-Status -Types "?" -Status "EdgeCore folder does not exist anymore..." -Warning } - Remove-UWPApp -AppxPackages "Microsoft.MicrosoftEdge" + Remove-UWPApp -AppxPackages @("Microsoft.MicrosoftEdge", "Microsoft.MicrosoftEdge.Stable", "Microsoft.MicrosoftEdge.*", "Microsoft.MicrosoftEdgeDevToolsClient") + Set-ScheduledTaskState -State Disabled -ScheduledTasks @("\MicrosoftEdgeUpdateTaskMachineCore", "\MicrosoftEdgeUpdateTaskMachineUA", "\MicrosoftEdgeUpdateTaskUser*") + Set-ServiceStartup -State 'Disabled' -Services @("edgeupdate", "edgeupdatem", "MicrosoftEdgeElevationService") Write-Status -Types "@" -Status "Preventing Edge from reinstalling..." Set-ItemPropertyVerified -Path "$PathToLMEdgeUpdate" -Name "DoNotUpdateToEdgeWithChromium" -Type DWord -Value 1 @@ -36,12 +38,15 @@ function Remove-MSEdge() { Write-Status -Types "@" -Status "Deleting Edge appdata\local folders from current user..." Remove-ItemVerified -Path "$env:LOCALAPPDATA\Packages\Microsoft.MicrosoftEdge*_*" -Recurse -Force | Out-Host - Write-Status -Types "@" -Status "Deleting Edge from Program Files (x86)..." - Remove-ItemVerified -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge*" -Recurse -Force | Out-Host + Write-Status -Types "@" -Status "Deleting Edge from $env:SystemDrive\Program Files (x86)\Microsoft\..." + Remove-ItemVerified -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge" -Recurse -Force | Out-Host + # Remove-ItemVerified -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeCore" -Recurse -Force | Out-Host + Remove-ItemVerified -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeUpdate" -Recurse -Force | Out-Host + # Remove-ItemVerified -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeWebView" -Recurse -Force | Out-Host Remove-ItemVerified -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Temp" -Recurse -Force | Out-Host } -$Ask = "Are you sure you want to remove Microsoft Edge from Windows?`nYou can reinstall it anytime.`nNote: all users logged in will remain." +$Ask = "Are you sure you want to remove Microsoft Edge from Windows?`nWill uninstall WebView2 and thus break many PWA (Progressive Web App) applications`n(e.g., Snapchat, Instagram...)`n`nYou can reinstall Edge anytime.`nNote: all users logged in will remain." switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") { 'Yes' { diff --git a/src/scripts/Remove-Xbox.ps1 b/src/scripts/Remove-Xbox.ps1 index 2a60a48e..bfb54a2a 100644 --- a/src/scripts/Remove-Xbox.ps1 +++ b/src/scripts/Remove-Xbox.ps1 @@ -17,9 +17,9 @@ function Remove-Xbox() { ) $XboxApps = @( + "Microsoft.GamingApp" # Xbox "Microsoft.GamingServices" # Gaming Services - "Microsoft.XboxApp" # Xbox Console Companion (Replaced by new App) - "Microsoft.GamingApp" + "Microsoft.XboxApp" # Xbox Console Companion (Legacy App) "Microsoft.XboxGameCallableUI" "Microsoft.XboxGameOverlay" "Microsoft.XboxSpeechToTextOverlay" diff --git a/src/scripts/other-scripts/Git-GnupgSshKeysSetup.ps1 b/src/scripts/other-scripts/Git-GnupgSshKeysSetup.ps1 index 0e28e120..64581e59 100644 --- a/src/scripts/other-scripts/Git-GnupgSshKeysSetup.ps1 +++ b/src/scripts/other-scripts/Git-GnupgSshKeysSetup.ps1 @@ -1,6 +1,6 @@ -Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Manage-Software.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Title-Templates.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\debloat-helper\Remove-ItemVerified.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\package-managers\Manage-Software.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\ui\Select-Folder.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\ui\Show-MessageDialog.psm1" @@ -181,7 +181,7 @@ function Set-GPGKey() { git config --global commit.gpgsign true Write-Host "Copy and Paste the lines below on your`nGithub/Gitlab > Settings > SSH and GPG Keys > New GPG Key" - Get-Content "$GnuPGPath/$($GnuPGFileName)_public.gpg" + Get-Content -Path "$GnuPGPath/$($GnuPGFileName)_public.gpg" -Encoding UTF8 } Else { Write-Host "Failed to retrieve your key_id: $key_id" } diff --git a/src/scripts/other-scripts/Install-WSL.ps1 b/src/scripts/other-scripts/Install-WSL.ps1 index 1e666baf..5f185e8c 100644 --- a/src/scripts/other-scripts/Install-WSL.ps1 +++ b/src/scripts/other-scripts/Install-WSL.ps1 @@ -1,10 +1,10 @@ Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Get-HardwareInfo.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Manage-Software.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Request-FileDownload.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\Title-Templates.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\debloat-helper\Remove-ItemVerified.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\debloat-helper\Set-ItemPropertyVerified.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\debloat-helper\Set-OptionalFeatureState.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\..\lib\package-managers\Manage-Software.psm1" function Install-WSL() { [CmdletBinding()] param() diff --git a/src/utils/Individual-Tweaks.psm1 b/src/utils/Individual-Tweaks.psm1 index dd49a0f2..3a85ab17 100644 --- a/src/utils/Individual-Tweaks.psm1 +++ b/src/utils/Individual-Tweaks.psm1 @@ -1,13 +1,20 @@ Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Get-HardwareInfo.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Grant-RegistryPermission.psm1" -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Manage-Software.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\New-Shortcut.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Title-Templates.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Remove-ItemVerified.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-CapabilityState.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ItemPropertyVerified.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-OptionalFeatureState.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ScheduledTaskState.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ServiceStartup.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\package-managers\Manage-Software.psm1" + +$MouseAccelerationCode = @' +[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")] + public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, int[] pvParam, uint fWinIni); +'@ + +Add-Type $MouseAccelerationCode -name Win32 -NameSpace System $DesktopPath = [Environment]::GetFolderPath("Desktop"); $PathToLMPoliciesCloudContent = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" @@ -20,6 +27,7 @@ $PathToCUClipboard = "HKCU:\Software\Microsoft\Clipboard" $PathToCUOnlineSpeech = "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" $PathToCUThemes = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" $PathToCUXboxGameBar = "HKCU:\Software\Microsoft\GameBar" +$PathToCUMouse = "HKCU:\Control Panel\Mouse" function Disable-ActivityHistory() { Write-Status -Types "-", "Privacy" -Status "Disabling Activity History..." @@ -139,6 +147,22 @@ function Enable-EncryptedDNS() { Set-DNSClientServerAddress -InterfaceAlias "Wi-Fi*" -ServerAddresses ("1.1.1.1", "8.8.8.8", "2606:4700:4700::1111", "2001:4860:4860::8888") } +function Disable-FamilySafety() { + Set-ScheduledTaskState -State 'Disabled' -ScheduledTask @( + "\Microsoft\Windows\Shell\FamilySafetyMonitor", + "\Microsoft\Windows\Shell\FamilySafetyRefreshTask", + "\Microsoft\Windows\Shell\FamilySafetyUpload" + ) +} + +function Enable-FamilySafety() { + Set-ScheduledTaskState -State 'Enabled' -ScheduledTask @( + "\Microsoft\Windows\Shell\FamilySafetyMonitor", + "\Microsoft\Windows\Shell\FamilySafetyRefreshTask", + "\Microsoft\Windows\Shell\FamilySafetyUpload" + ) +} + function Disable-FastShutdownShortcut() { Write-Status -Types "*" -Status "Removing the shortcut to shutdown the computer on the Desktop..." -Warning Remove-ItemVerified -Path "$DesktopPath\Fast Shutdown.lnk" @@ -219,6 +243,14 @@ function Enable-Hibernate() { powercfg -Hibernate -Type $Type | Out-Host } +function Disable-HyperV() { + Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("Microsoft-Hyper-V-All") +} + +function Enable-HyperV() { + Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("Microsoft-Hyper-V-All") +} + function Disable-InternetExplorer() { Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("Internet-Explorer-Optional-*") } @@ -227,17 +259,47 @@ function Enable-InternetExplorer() { Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("Internet-Explorer-Optional-*") } +function Disable-LegacyContextMenu() { + Write-Status -Types "*", "Personal" -Status "Disabling legacy context menu on Windows 11 (requires reboot!)..." + Remove-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" +} + +function Enable-LegacyContextMenu() { + Write-Status -Types "+", "Personal" -Status "Enabling legacy context menu on Windows 11 (requires reboot!)..." + New-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Value "" -Force | Out-Null +} + +# Adapted from: https://www.reddit.com/r/gaming/comments/qs0387/i_created_a_powershell_script_to_enabledisable/ + +function Disable-MouseAcceleration() { + Write-Status -Types "-", "Misc" -Status "Disabling Mouse Acceleration..." + $SysPvParam = @(0, 0, 0) + [System.Win32]::SystemParametersInfo(4, 0, $SysPvParam, 2) + Set-ItemPropertyVerified -Path "$PathToCUMouse" -Name "MouseSpeed" -Type String -Value $SysPvParam[0] + Set-ItemPropertyVerified -Path "$PathToCUMouse" -Name "MouseThreshold1" -Type String -Value $SysPvParam[1] + Set-ItemPropertyVerified -Path "$PathToCUMouse" -Name "MouseThreshold2" -Type String -Value $SysPvParam[2] +} + +function Enable-MouseAcceleration() { + Write-Status -Types "*", "Misc" -Status "Enabling Mouse Acceleration..." + $SysPvParam = @(1, 6, 10) + [System.Win32]::SystemParametersInfo(4, 0, $SysPvParam, 2) + Set-ItemPropertyVerified -Path "$PathToCUMouse" -Name "MouseSpeed" -Type String -Value $SysPvParam[0] + Set-ItemPropertyVerified -Path "$PathToCUMouse" -Name "MouseThreshold1" -Type String -Value $SysPvParam[1] + Set-ItemPropertyVerified -Path "$PathToCUMouse" -Name "MouseThreshold2" -Type String -Value $SysPvParam[2] +} + # Code from: https://answers.microsoft.com/en-us/windows/forum/all/set-the-mouse-scroll-direction-to-reverse-natural/ede4ccc4-3846-4184-a86d-a028515040c0 function Disable-MouseNaturalScroll() { Get-PnpDevice -Class Mouse -PresentOnly -Status OK | ForEach-Object { - Write-Status -Types "*" -Status "Disabling mouse natural mode on $($_.Name): $($_.DeviceID) (requires reboot!)" + Write-Status -Types "*", "Misc" -Status "Disabling mouse natural mode on $($_.Name): $($_.DeviceID) (requires reboot!)" Set-ItemPropertyVerified -Path "HKLM:\SYSTEM\CurrentControlSet\Enum\$($_.DeviceID)\Device Parameters" -Name "FlipFlopWheel" -Type DWord -Value 0 } } function Enable-MouseNaturalScroll() { Get-PnpDevice -Class Mouse -PresentOnly -Status OK | ForEach-Object { - Write-Status -Types "+" -Status "Enabling mouse natural mode on $($_.Name): $($_.DeviceID) (requires reboot!)" + Write-Status -Types "+", "Misc" -Status "Enabling mouse natural mode on $($_.Name): $($_.DeviceID) (requires reboot!)" Set-ItemPropertyVerified -Path "HKLM:\SYSTEM\CurrentControlSet\Enum\$($_.DeviceID)\Device Parameters" -Name "FlipFlopWheel" -Type DWord -Value 1 } } @@ -344,15 +406,23 @@ function Enable-WindowsMediaPlayer() { Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("MediaPlayback") } -function Disable-WSearchService() { +function Disable-WindowsSandbox() { + Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("Containers-DisposableClientVM") +} + +function Enable-WindowsSandbox() { + Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("Containers-DisposableClientVM") +} + +function Disable-WindowsSearch() { Write-Status -Types "-", "Service" -Status "Disabling Search Indexing (Recommended for HDDs)..." - Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled + Set-ServiceStartup -State 'Disabled' -Services "WSearch" Stop-Service "WSearch" -Force -NoWait } -function Enable-WSearchService() { +function Enable-WindowsSearch() { Write-Status -Types "*", "Service" -Status "Enabling Search Indexing (Recommended for SSDs)..." - Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Automatic + Set-ServiceStartup -State 'Automatic' -Services "WSearch" Start-Service "WSearch" } @@ -363,7 +433,6 @@ function Disable-XboxGameBarDVRandMode() { Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 0 Set-ItemPropertyVerified -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0 Set-ItemPropertyVerified -Path "$PathToLMPoliciesGameDVR" -Name "AllowGameDVR" -Type DWord -Value 0 - Set-ServiceStartup -State 'Disabled' -Services "BcastDVRUserService*" Write-Status -Types "-", "Performance" -Status "Enabling Game mode..." Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "AutoGameModeEnabled" -Type DWord -Value 0 @@ -374,7 +443,6 @@ function Disable-XboxGameBarDVRandMode() { Write-Status -Types "-", "Performance" -Status "Enabling Open Xbox Game Bar using Xbox button on Game Controller..." Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "UseNexusForGameBarEnabled" -Type DWord -Value 0 - Grant-RegistryPermission -Key "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" Write-Status -Types "-", "Performance" -Status "Disabling GameBar Presence Writer..." Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" -Name "ActivationType" -Type DWord -Value 0 } @@ -398,7 +466,6 @@ function Enable-XboxGameBarDVRandMode() { Write-Status -Types "*", "Performance" -Status "Enabling Open Xbox Game Bar using Xbox button on Game Controller..." Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "UseNexusForGameBarEnabled" -Type DWord -Value 1 - Grant-RegistryPermission -Key "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" Write-Status -Types "*", "Performance" -Status "Enabling GameBar Presence Writer..." Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" -Name "ActivationType" -Type DWord -Value 1 } diff --git a/src/utils/Install-Individual-System-Apps.psm1 b/src/utils/Install-Individual-System-Apps.psm1 index 4d9c6504..168c5599 100644 --- a/src/utils/Install-Individual-System-Apps.psm1 +++ b/src/utils/Install-Individual-System-Apps.psm1 @@ -1,15 +1,10 @@ -Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Manage-Software.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Title-Templates.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ItemPropertyVerified.psm1" +Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\package-managers\Manage-Software.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\..\utils\Individual-Tweaks.psm1" $Script:TweakType = "App" -function Install-Cortana() { - $Apps = @("9NFFX4SZZ23L") - Install-Software -Name "Cortana" -Packages $Apps -PackageProvider 'MsStore' -} - function Install-DolbyAudio() { $Apps = @("9NJZD5S7QN99") Install-Software -Name "Dolby Audio" -Packages $Apps -PackageProvider 'MsStore' diff --git a/src/utils/fix-url-association.reg b/src/utils/fix-url-association.reg new file mode 100644 index 00000000..7b7499a4 --- /dev/null +++ b/src/utils/fix-url-association.reg @@ -0,0 +1,3 @@ +Windows Registry Editor Version 5.00 + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.url\UserChoice]