Hi Techie,
I recently observed in my environment that both the old outlook and new outlook are pinned to the taskbar. I need a script that can remove the old outlook shortcut and simultaneously unpin it from the taskbar. I have tried below script, which removes the shortcut from this path %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\outlook.link. However, it does not unpin it from the taskbar. When I click on the old outlook icon on the taskbar, it says "it might be deleted, moved, or renamed. Do you want to remove item?" I restarted many times but but outlook icon not removing on taskbar,
My goal is to remove the shortcut and also unpin it from the taskbar.
@echo off
REM Unpinning Outlook from taskbar
powershell -Command "& {$tbs = New-Object -ComObject Shell.Application; $tbs.Namespace('C:\ProgramData\Microsoft\Windows\Start Menu\Programs').Items() | ? {$_.Name -eq 'Outlook'} | % {$_.InvokeVerb('Unpin from Taskbar')}}"
REM Removing old Outlook shortcut from taskbar
DEL /F /S /Q /A "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Outlook.lnk"
REM Deleting registry key
REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v FavoritesRemoved /f
REM Restarting explorer.exe
taskkill /f /im explorer.exe
start explorer.exe