Skip to content

Instantly share code, notes, and snippets.

@LawrenceHwang
Created October 14, 2021 04:57
Show Gist options
  • Save LawrenceHwang/d7c5809dc50f1ad8cf40a008ec0c9810 to your computer and use it in GitHub Desktop.
Save LawrenceHwang/d7c5809dc50f1ad8cf40a008ec0c9810 to your computer and use it in GitHub Desktop.
Helper function to set the taskbar icon size
function Set-TaskbarIconSize {
# Sets the windows 11 task bar icon size. Default value is medium.
[CmdletBinding()]
param(
[validateset("small", "medium", "large")]
[string]$Size = "medium"
)
$sizeChart = @{
"small" = 0
"medium" = 1
"large" = 2
}
try {
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\' -Name 'TaskbarSi' -Value $sizeChart[$Size]
Write-Warning -Message "Taskbar icon set to $Size, please reboot to take effect."
} catch {
$PSItem
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment