Reputation: 306
I setup computers daily and I need to remove the Microsoft Edge and Store taskbar shortcuts.
I am having trouble creating a script and I have searched for other stackoverflow posts but they were not helpful to me.
Does anyone have a script that can unpin the MS Edge and Store taskbar shortcuts?
Upvotes: 8
Views: 17739
Reputation: 1
I just wanted to add a Pin-App method based on Judge2020's post:
function Pin-App([string]$appName) {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() |
Where-Object { $_.Name -eq $appName }
).Verbs() |
Where-Object { $_.Name.Replace('&', '') -match 'Pin to taskbar' } |
ForEach-Object { $_.DoIt() }
}
Pin-App "Google Chrome"
Upvotes: 0
Reputation: 349
You can unpin taskbar items by running the following PowerShell commands.
function Unpin-App([string]$appname) {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() |
?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt()}
}
Unpin-App("Microsoft Edge")
Unpin-App("Microsoft Store")
This should work for any application on the taskbar. If the application isn't found, the error InvokeMethodOnNull
will be thrown.
What this does:
$appname
(in this case, Edge and Store)Unpin from taskbar
of that com objectUpvotes: 16
Reputation:
Very nice solution from Judge2020, +1
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}
Upvotes: 6