Windows 10.1903 Broke PowerShell Automatic Pining to Task Bar... Again... Please make it an optional feature via Group Policy...

  • Thread starter Thread starter Fin Design
  • Start date Start date
F

Fin Design

Guest
NOTE: This is mostly a feature request for Microsoft (unless somone else knows of a work around).

Hey,

Well, it seems like deja vu again... for every release of windows, someone inside Microsoft is removing the ability to automatically pin icons to the user's Task Bar. For security reasons this could be considered fair enough, but you really should enable a mode via group policy that allows the pin verb to be enabled again at the discretion of the IT department (if this is possible, please tell me where). Or allow some other way of automatically pinning taskbar icons via PowerShell (and document it properly). It's highly useful for onboarding users with applications that don't fit the standard installation models. As in a movie VFX pipeline that utilises a whole bunch of python utilities and bootstrap processes launched via scripts (not an executable directly).

Essentially give us the option. I'm fine if the default is restricted, but like scripts, we should be able to choose if we enable the potential vulnerability.


Thanks,
Mark



Oh, and this is the broken hacky PowerShell way after the verb was removed from the older updates (kudos to Pin program to taskbar using PS in Windows 10).
------------------------------------------------------------------------------------------------------------------
param (
[parameter(Mandatory=$True, HelpMessage="Target item to pin")]
[ValidateNotNullOrEmpty()]
[string] $Target
)
if (!(Test-Path $Target)) {
Write-Warning "$Target does not exist"
break
}

$KeyPath1 = "HKCU:\SOFTWARE\Classes"
$KeyPath2 = "*"
$KeyPath3 = "shell"
$KeyPath4 = "{:}"
$ValueName = "ExplorerCommandHandler"
$ValueData =
(Get-ItemProperty `
("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\" + `
"CommandStore\shell\Windows.taskbarpin")
).ExplorerCommandHandler

$Key2 = (Get-Item $KeyPath1).OpenSubKey($KeyPath2, $true)
$Key3 = $Key2.CreateSubKey($KeyPath3, $true)
$Key4 = $Key3.CreateSubKey($KeyPath4, $true)
$Key4.SetValue($ValueName, $ValueData)

$Shell = New-Object -ComObject "Shell.Application"
$Folder = $Shell.Namespace((Get-Item $Target).DirectoryName)
$Item = $Folder.ParseName((Get-Item $Target).Name)
$Item.InvokeVerb("{:}")

$Key3.DeleteSubKey($KeyPath4)
if ($Key3.SubKeyCount -eq 0 -and $Key3.ValueCount -eq 0) {
$Key2.DeleteSubKey($KeyPath3)
}


Continue reading...
 
Back
Top