Created
June 16, 2022 00:36
-
-
Save dmoruzzi/31a6e50a96cabe118198381960fa6346 to your computer and use it in GitHub Desktop.
This is a sample script to show how to unpin a shortcut from the taskbar via Powershell without modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a sample script to show how to unpin a shortcut from the taskbar via Powershell without modules. | |
# The path of the shortcut .lnk file to be unpinned. | |
$Application = "$Home\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\App.lnk" | |
if (Test-Path -path "$Application"){ | |
(New-Object -ComObject shell.application).NameSpace($Application.Substring(0, $Application.LastIndexOf("\"))).ParseName($Application.Substring($Application.LastIndexOf("\") + 1)).Verbs() | Where-Object { | |
$_.Name.replace('&', '') -match 'Unpin from taskbar' | |
} | |
| ForEach-Object { | |
$_.DoIt() | |
} | |
} | |
else { | |
Write-Host "The shortcut $Application does not exist." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment