3
votes

Here's the code I have been using... (and it's been working great!)

function DoUnpin([string]$appname) {
   $ErrorActionPreference = 'silentlycontinue'
    ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() `
     | Where-Object { $_.Name -eq $appname }).Verbs() `
     | Where-Object { $_.Name.replace('&', '') -match 'Unpin from taskbar' } `
     | ForEach-Object { $_.DoIt(); }
   $ErrorActionPreference = 'continue'
}
DoUnpin "Microsoft Store"
DoUnpin "Mail"
DoUnpin "Store"
DoUnpin "Edge"
DoUnpin "Microsoft Edge"

But in the last couple weeks Microsoft has been rolling out the new Chromium-based Edge (the one with the swirly icon) and I have not been able to figure out how to unpin it without using the mouse/GUI.

Anyone have any inisght on as to why this might be?

2

2 Answers

2
votes

MS is getting sneakier with their edge-forcefulness. It is now saved (for new users on 20H2) in the Registry under:

"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband"

Under "Favorites."

That key is where the user modifications to the taskbar are saved. Since we want to remove Edge from there for new users just delete that Key and all values inside of it which will remove all taskbar customizations. If you have a custom LayoutModification.xml it will still apply your customizations without the forced pinned Edge shortcut in the Taskbar.

Remove-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Recurse -Force

Then just stop and restart the Explorer process and the shortcut is removed for the current user.

Stop-Process -Processname Explorer -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -Force

If you want this to happen for all new users you can add a RunOnce key to the Default registry hive to run the above two commands.

1
votes

You could try reviewing the LayoutModification.xml file. If there's an Edge entry in there, it will just keep getting pinned to Taskbar.

The file is in %userprofile%\AppData\Local\Microsoft\Windows\Shell.

If the file exists, open it and look for a "CustomTaskbarLayoutCollection" section. Then check for any Edge related entries and delete those lines.