How to pin to start menu using PowerShell

cethint picture cethint · Mar 28, 2012 · Viewed 16.3k times · Source

I can pin some programs to taskbar on Win7 using PowerShell.

$shell = new-object -com "Shell.Application"  
$folder = $shell.Namespace('C:\Windows')    
$item = $folder.Parsename('notepad.exe')
$verb = $item.Verbs() | ? {$_.Name -eq 'Pin to Tas&kbar'}
if ($verb) {$verb.DoIt()}

How do I modify the above code to pin a program to the Start menu?

Answer

Steven Penny picture Steven Penny · Feb 22, 2014

Another way

$sa = new-object -c shell.application
$pn = $sa.namespace($env:windir).parsename('notepad.exe')
$pn.invokeverb('startpin')

Or unpin

$pn.invokeverb('startunpin')