Unpin Microsoft Edge and compile taskbar shortcuts programmatically
I install computers on a daily basis and I need to remove the Microsoft Edge and Store taskbar shortcuts.
I had a problem creating a script and I searched other stackoverflow posts but they didn't work for me.
Does anyone have a script that can disable MS Edge and Store taskbar shortcuts?
source to share
Yes, you can cancel Microsoft Edge and keep apps from the taskbar by running the following ps commands.
$appname = "Microsoft Edge"
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}
$appname = "Store"
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}
Changing the variable $appname
should work for any application on the taskbar, and if it doesn't throw an error InvokeMethodOnNull
.
What it does: It lists the namespace of the wrapper / taskbar COM objects
Matches an element with a name $appname
(in this case, Edge and Store)
Gets the magic Unpin from taskbar
verb of this COM object
Executes the verb AND removes it from the taskbar without killing explorer.exe.
source to share
Very nice solution from Judge2020, +1
- With RegEx and -match instead of -eq, you can disable multiple applications in one pass
- Fixed verbs are localized, on it
Von "Start" lösen
$appnames = "^Microsoft Edge$|^Store$"
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() |
Where-Object{$_.Name -match $appnames}).Verbs() |
Where-Object{$_.Name.replace('&','') -match 'Unpin from taskbar|Von "Start" lösen'} |
ForEach-Object{$_.DoIt(); $exec = $true}
source to share