Closed erotavlasme closed 1 month ago
@chocolatey/developers does anyone remember who worked on this one?
Do you need log or debug? I can reproduce them.
@erotavlas85 that is helpful - if you save it as a gist and provide the link, that would be helpful.
While I dont recalll this being a problem in win 7, I have noticed that pinning is broken in win 10 and need to research why. Adding this to my to do list but might be a wek or so before I get to it.
I've added this to the backlog and assigned it to you. If you get to it in time for 0.9.10, great! We can update the milestone. :)
This is the output log gist link https://gist.githubusercontent.com/erotavlas85/a92ac6974212882ecf17/raw/c7b71db8ac1bccfbb10f20b11410856cb338cf9a/log.sh
A possible solution to unpin all is the following `Remove-Item "$env:USERPROFILE\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar*" -recurse
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -recurse
Get-Process explorer | Stop-Process`
Any news?
Did a bit of research on this. It turns out that according to MSDN "A small set of applications are pinned by default for new installations. Other than these, only the user can pin further applications; programmatic pinning by an application is not permitted.". This concurs with a blog post from Raymond Chen - "there is no PinToTaskBar function".
So basically any technique to achieve this is unsupported - which is probably why it stopped working in Windows 10.
I came across a comment on an issue in another repo related to the same problem where they figured out that "Pin to task bar" verb is no longer being returned.
But then after all that they apparently managed to figure out another workaround that does work in Windows 10. So if you can read this code, and figure out what it is doing, it might be possible to do the same in PowerShell
The interesting bits are the DWORD at https://github.com/lordmulder/stdutils/commit/839107dc719899d31b0f67e33d76befa57ded768#diff-994c180910d9ef09478cfe0e8e854b98R723
There may also be bits in those compiled DLLs they included.
There is a small program to do this described here. The source code is included although I don't see a license.
More details on the how here.
Any news on adding support for this in win10?
Hi, there is PowerShell snippet that works pretty well.
Maybe it could be incorporated in Install-ChocolateyPinnedTaskBarItem
and Install-ChocolateyShortcut -PinToTaskbar
...
Confirming that works. Here's a tidied up version (with Close()
method calls)
Param($Target)
$ValueData = (
Get-ItemProperty("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.taskbarpin")
).ExplorerCommandHandler
$classesStarKey = (Get-Item "HKCU:\SOFTWARE\Classes").OpenSubKey("*", $true)
$shellKey = $classesStarKey.CreateSubKey("shell", $true)
$specialKey = $shellKey.CreateSubKey("{:}", $true)
$specialKey.SetValue("ExplorerCommandHandler", $ValueData)
$specialKey.Close()
$Shell = New-Object -ComObject "Shell.Application"
$Folder = $Shell.Namespace((Get-Item $Target).DirectoryName)
$Item = $Folder.ParseName((Get-Item $Target).Name)
$Item.InvokeVerb("{:}")
$shellKey.DeleteSubKey("{:}")
if ($shellKey.SubKeyCount -eq 0 -and $shellKey.ValueCount -eq 0) {
$classesStarKey.DeleteSubKey("shell")
}
$shellKey.Close()
$classesStarKey.Close()
Hi all.
There is also tool which we use to automate the process of pinning Office 2016 and 2019 Icons to the taskbar of windows 10 (release 1809. Which is actually the most recent release). The website http://www.technosys.net/ --> Products --> Utils --> PinToTaskbar (syspin.exe).
We install office product and write in cmd (as admin):
> cmd /c "c:\path_to_syspin.exe" "C:\Program Files\Microsoft Office\...\WINWORD.EXE" c:5386
and we do the same for the other office products (excel, outlook, etc..).
The tool works fine. Anyway this is not a programmatic solution which was provided just above and it not suited for this particular choco case.. but anyway this might help some people which look for an easy way to pin the ofice icons to the taskbar.
Is it me or is this not working for Windows 10 1903?
@DavidNgoDev which thing in particular are you referring to as not working?
@DavidNgoDev which thing in particular are you referring to as not working?
Install-ChocolateyShortcut : The term 'Install-ChocolateyShortcut' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Install-ChocolateyShortcut
is a Chocolatey function. I don't believe you can call those by default from a Boxstarter script. This issue is about Install-ChocolateyPinnedTaskBarItem
@flcdrg The code you posted works fine for admins (which is how most packages install anyway), but I didn't get it to work for non-admins.
Here is some alternative code that works for both.. I think it only works for applications that are already in the Start Menu programs list, although it's easy enough to create an icon in %APPDATA%\Microsoft\Windows\Start Menu
first.
Edit: Oops! This is for pinning to the Start Menu which I should have noticed is not the point of this issue. It does not appear to work for the taskbar. (At one time, the code for pinning to Start and pinning to taskbar were nearly identical. MS blocked Start menu pinning via code, and this is the first time since that I have seen it work.) Sorry for the distraction.
@teknowledgist That script talks about pinning to the start menu - does it pin to the task bar though?
Due to the constant moving target provided by Microsoft, we have opted to deprecate the Install-ChocolateyPinnedTaskBarItem
function in the next release of Chocolatey CLI (#3520) to be removed with 3.0.0 (#3521).
As such I will close this issue.
For instance
I modified the source code of Install-ChocolateyPinnedTaskBarItem in order to print all the operations and this is the output
Am I making a mistake on calling the function?
Moreover, I would like also to unpin programs. It seems that chocolatey does not have any function to do this. I found from this thread How to unpin "Library" folder from Task Bar using Powershell? this function that is the complementary of the previous pin function.
In the same way this does not work. I know that I can use other solutions like this https://gallery.technet.microsoft.com/ScriptCenter/b66434f1-4b3f-4a94-8dc3-e406eb30b750/. However, I prefer to use all stuff from chocolatey. Do you have any suggestions?
UPDATE: We would only support this on supported operating systems which, on the client side, would be some Windows 10 and 11.