Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.7k stars 1.08k forks source link

pin iexplorer only on a taskbar #236

Closed vince50 closed 5 years ago

vince50 commented 5 years ago

adding ieplorer in the taskbar

Disassembler0 commented 5 years ago

This isn't a setting offered by the basic system, this is already an extra customization which creates something new, so I would suggest creating a custom tweak for this too. (See again Advanced usage in FAQ on how to work with custom tweaks and presets). However pinning/unpinning is a bit problematic. You can read about this in #8 and #147.

For iexplore in particular, the tweak would look like

Function PinIExplore {
    # Bring pinning / unpinning handler into '*' class scope
    $pinHandler = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.taskbarpin" -Name "ExplorerCommandHandler"
    New-Item -Path "HKCU:Software\Classes\*\shell\pin" -Force | Out-Null
    Set-ItemProperty -LiteralPath "HKCU:Software\Classes\*\shell\pin" -Name "ExplorerCommandHandler" -Type String -Value $pinHandler

    # Pin iexplore.exe
    $item = Get-Item "$($env:ProgramFiles)\internet explorer\iexplore.exe"
    $item = (New-Object -Com "Shell.Application").Namespace($item.DirectoryName).ParseName($item.Name)
    $item.InvokeVerb("pin")

    # Remove the handler
    Remove-Item -LiteralPath "HKCU:Software\Classes\*\shell\pin" -Recurse
}

but for the reasons given above, I'm not gonna add it to the basic tweak library.

Lastwish90 commented 4 years ago

Does the above function to Pin iexplorer on taskbar currently work on W10? Or has it been blocked by MS?