Powershell script to remove / unpin microsoft edge from the Windows 10 taskbar

All the random crap I spend all day long figuring out.
Post Reply
User avatar
syntax
Site Admin
Posts: 54
Joined: Tue Jan 06, 2009 9:25 pm

Powershell script to remove / unpin microsoft edge from the Windows 10 taskbar

Post by syntax » Thu Jul 21, 2016 5:20 pm

I spent hours trying to find a solution that simply removed edge and did not involve killing and restarting explorer.exe.

Code: Select all

function UnPin-App ( [string]$appname ) {
	try {
		$exec = $false
		
		((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}
		
		if ($exec) {
			Write "App '$appname' unpinned from Taskbar"
		} else {
			Write "'$appname' not found or 'Unpin from taskbar' not found on item!"
		}
		
	} catch {
		Write-Error "Error unpinning $appname from taskbar!"
	}
}

UnPin-App "Microsoft Edge"

Post Reply