Add script for removing pinned icons

This commit is contained in:
Manuel Thalmann 2023-07-18 20:04:34 +02:00
parent 73cd34d783
commit 409851f563
2 changed files with 11 additions and 0 deletions

View file

@ -28,6 +28,11 @@ class Context {
Remove-Item "$env:PUBLIC/Desktop/$pattern";
}
[void] RemoveTaskbarItem($pattern) {
Import-Module -UseWindowsPowerShell PinnedItem;
Get-PinnedItem -Type TaskBar | Where-Object { $_.Name -like "$pattern" } | Remove-PinnedItem;
}
[Microsoft.Win32.RegistryKey] EnsureConfigKey() {
if (-not (Test-Path $this.ConfigRoot)) {
$null = New-Item $this.ConfigRoot;

View file

@ -7,5 +7,11 @@ foreach ($module in @("PSWindowsUpdate", "KnownFolders"))
}
}
foreach ($nativeModule in @("PinnedItem")) {
if (-not (powershell -c Get-Module -ListAvailable $nativeModule)) {
powershell -c Install-Module -AcceptLicense -Force "$nativeModule";
}
}
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";