I have been successfully using this little hack to programmatically PinToTaskbar in Windows 10.
$workingTarget = 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\WordPad.lnk'
$lmPropertyValue = '{90AA3A4E-1CBA-4233-B8BB-535773D48449}'
$userClassKeys = (Get-Item 'HKCU:\SOFTWARE\Classes').OpenSubKey('*', $true)
$shellKey = $userClassKeys.CreateSubKey('shell', $true)
$verbKey = $shellKey.CreateSubKey('PxToolsWin10PinToTaskbar', $true)
$verbKey.SetValue('ExplorerCommandHandler', $lmPropertyValue)
$shell = New-Object -ComObject "Shell.Application"
$folder = $Shell.Namespace((Get-Item $workingTarget).DirectoryName)
$item = $folder.ParseName((Get-Item $workingTarget).Name)
$item.InvokeVerb("PxToolsWin10PinToTaskbar")
# Remove the temporary shell and verb keys
Remove-Item -path:'HKCU:\SOFTWARE\Classes\*\shell\PxToolsWin10PinToTaskbar' -recurse -force
It has worked fine, right up until the 1903 update. I have verified that the GUID has not changed, it still references pinToTaskbar, so not sure what Microsoft changed, but hopefully someone has a recommendation on how to make this work in the newest build.
For what it's worth, I DO know that Microsoft seems to think that IT in an office shouldn't be able to do this, or more correctly that developers shouldn't, and Microsoft's clumsy solution ALSO blocks firm IT. I find that interesting because Microsoft hasn't blocked Autodesk from putting things on the All User desktop, while a non local admin user is logged in, which is to my mind a MUCH more user hostile behavior. My goal is to pin to the USER's taskbar, to alert them to new software, while allowing them to manage those pinned items as they see fit after that initial pin. The right answer from Microsoft would be a group policy where I can just specifically enable certain programs to allow this, while all other programs are blocked. But to my knowledge that still sin't an option, so I keep looking for whacky workarounds to maintain needed functionality. :(