title: Use PowerShell to unpin Taskbar shortcut depending on shortcut Target Path
body: <p>Having an issue with some PowerShell. Basically I am trying to remove certain Taskbar shortcuts based on the shortcuts path/exe file.</p>
  
  <p>The following code I have gets the pinned shortcuts and their name from the AppData folder:</p>
  
  <pre><code>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{}
  }
  </code></pre>
  
  <p>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)?</p>