Having an issue with some PowerShell. Basically I am trying to remove certain Taskbar shortcuts based on the shortcuts path/exe file.
The following code I have gets the pinned shortcuts and their name from the AppData folder:
Function Get-TaskbarShortcuts { Begin{ Clear-Host $Path = "C:\Users\username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" $x=0 } # End of Begin Process { $TaskbarShortcuts = Get-ChildItem $Path -Recurse -Include *.lnk ForEach($ShortCut in $TaskbarShortcuts) { $Shell = New-Object -ComObject WScript.Shell $Properties = @{ ShortcutName = $Shortcut.Name LinkTarget = $Shell.CreateShortcut($Shortcut).targetpath } New-Object PSObject -Property $Properties $x ++ Write-Host $ShortCut } #End of ForEach [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | Out-Null } # End of Process End{} } I need to amend this code to remove certain shortcuts...say for example, a user has pinned 'C:\Windows\notepad.exe' but called the shortcut Name something odd. How would I remove the actual pin from the taskbar (not just delete the shortcut file)?
Thanks in advance!