From cb3edcfa5552af52c737f1482b7dedbbbd503980 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 8 Aug 2024 02:28:40 +0200 Subject: [PATCH] Allow removing task bar icons --- scripts/Common/Scripts/System.ps1 | 16 ++++++++++++++++ scripts/Windows/OS/Install.ps1 | 1 + 2 files changed, 17 insertions(+) diff --git a/scripts/Common/Scripts/System.ps1 b/scripts/Common/Scripts/System.ps1 index fb530358..71805ef5 100644 --- a/scripts/Common/Scripts/System.ps1 +++ b/scripts/Common/Scripts/System.ps1 @@ -29,3 +29,19 @@ function Remove-DesktopIcon { } } } + +<# + .SYNOPSIS + Removes icons from the task bar. + + .PARAMETER Pattern + The pattern of the icon names to remove. +#> +function Remove-TaskbarItem { + param( + [string] $Pattern + ) + + Import-Module -UseWindowsPowerShell PinnedItem; + Get-PinnedItem -Type TaskBar | Where-Object { $_.Name -like "$Pattern" } | ForEach-Object { Remove-PinnedItem $_ }; +} diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 78deed68..b27d2e0c 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -65,6 +65,7 @@ $null = New-Module { Invoke-Hook "Install-PSModules" -Fallback { Install-Module -AcceptLicense -Force PSWindowsUpdate; Install-Module -AcceptLicense -Force PSScriptAnalyzer; + . "$PSScriptRoot/../../Common/Software/PinnedItem/Manage.ps1"; }; if (-not (Test-Winget)) {