Powershell Script – Removing Pinned Office 2010 Apps from Taskbar

One of the more annoying things about the Office 2010 to 2013 upgrade that I have found is that Office 2010 applications which were pinned to the taskbar, remain pinned after the upgrade to 2013. Well if you’ve already ran the upgrade, I think you might be stuck, but if you’re reading this because you’re planning a deployment, well, you’re in luck. First, a couple gotchyas:

  1.  This script needs to run before Office 2010 is uninstalled.
  2. This script must be run with as the user you wish to unpin for. This means, this cannot be run from SCCM (would run with system account.) The best way to implement this script would be via a startup script GPO. I don’t believe there is a way to successfully unpin items without the local user being logged in.

Here is the script:

function Unpin-Taskbar{
[cmdletbinding()]
Param(
[Parameter(Mandatory =$true)]
[string]$Item
)

if($test=test-path $item){
Write-Verbose -Message "Creating Shell.Application object..."
$Shell = New-Object -ComObject "Shell.Application"
$ItemParent = Split-Path -Path $Item -Parent
$ItemLeaf = Split-Path -Path $Item -Leaf
$Folder = $Shell.NameSpace($ItemParent)
$ItemObject = $Folder.ParseName($ItemLeaf)
$Verbs = $ItemObject.Verbs()

try{
Write-Verbose -Message "Trying to unpin $ItemLeaf"
$Verb = $Verbs | Where-Object {$_.Name -EQ "Unpin from Tas&kbar"} -ErrorAction Stop
$Verb.DoIt()
}catch{Write-Error -Message "Unable to unpin !" -erroraction silentlycontinue}
}
else {
write-error -message "file no existo" -erroraction silentlycontinue
}
}
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14ACCICONS.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14BCSSync.exe"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14CLVIEW.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14CNFNOT32.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14EXCEL.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14excelcnv.exe"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14GRAPH.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14GROOVE.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14GROOVEMN.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14IEContentService.exe"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14INFOPATH.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14misc.exe"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSACCESS.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSOHTMED.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSOSYNC.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSOUC.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSPUB.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSQRY32.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSTORDB.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14MSTORE.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14NAMECONTROLSERVER.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14OIS.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14ONENOTE.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14ONENOTEM.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14OUTLOOK.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14POWERPNT.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14PPTICO.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14protocolhandler.exe"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14SCANPST.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14SELFCERT.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14SETLANG.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14VPREVIEW.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14WINWORD.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14Wordconv.exe"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14WORDICON.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft OfficeOffice14XLICONS.EXE"
unPin-Taskbar -Item "C:Program Files (x86)Microsoft Lynccommunicator.exe"

I used some of this code as a starting point:

http://itfordummies.net/2014/03/powershell-functions-pin-unpin-windows-taskbar/

Hopefully this saves you some time!

 

 

 




Leave a Reply

Your email address will not be published. Required fields are marked *