Page 1 of 1

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

Posted: Thu Jul 21, 2016 5:20 pm
by syntax
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"