Skip to content

Commit 2d321ea

Browse files
committed
minor
1 parent 3208277 commit 2d321ea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Modules/Scripts/Set-PinTaskbar.ps1

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ If true then unpin target from the Taskbar
1010
1111
.NOTES
1212
https://community.spiceworks.com/topic/2165665-pinning-taskbar-items-with-powershell-script
13+
https://github.com/gunnarhaslinger/Add-or-Remove-Application-To-Windows-10-Taskbar/blob/master/TaskbarPinning.ps1
1314
#>
1415

1516
param(
@@ -44,8 +45,12 @@ Begin
4445
{
4546
Write-Verbose '... unregistering shell handler verb'
4647
$shellKey.DeleteSubKeyTree('{:}', $false)
47-
$shellKey.Close()
48-
$shellKey.Dispose()
48+
if ($shellKey.SubKeyCount -eq 0 -and $shellKey.ValueCount -eq 0)
49+
{
50+
(Get-Item 'HKCU:\SOFTWARE\Classes'
51+
).OpenSubKey('*', $true
52+
).DeleteSubKey("shell")
53+
}
4954
Write-Verbose '... shell handler verb unregistered'
5055
}
5156
}

0 commit comments

Comments
 (0)