Functions/Show-TrayIcons.ps1



function Show-TrayIcons {
    [CmdletBinding()]
    param (
        [Parameter()] [switch] $Hide
    )

    $regLocation = "HKCU:\Control Panel\NotifyIconSettings\"

    if (Test-Path $regLocation) {
        $TrayIcons = Get-ChildItem $regLocation

        # $TrayIcons

        foreach ($t in $TrayIcons) {

            Write-Verbose $t.Name -Verbose
            # $IsPromoted = Get-ItemProperty "registry::$($t)" -Name IsPromoted | Select-Object -ExpandProperty IsPromoted

            if ($Hide) {
                $value = 0
            } else {
                $value = 1
            }
            # if ($IsPromoted -ne 1) {
                New-ItemProperty "registry::$($t)" -Name IsPromoted -Value $value -Force -Verbose
            # }
            # Get-ItemProperty "$($reglocation)\$($t)" -Name IsPromoted

        }
    } else {
        Write-Warning "Reg key `"$($regLocation)`" not found"
    }



}