function Pin-ToTaskbar {
	[CmdletBinding()]
	param (
	[string]$Targetfile,
	[validateset('PIN','UNPIN')]
    [String]$Action
	)
	if (!(Test-Path "$Targetfile")) {    
        Write-Host "Отсутствует файл '$Targetfile'" -ForegroundColor Red
        return
    }	
	$ENV_NAME = 'COMMANDER_PATH'
	$TCMD_PATH = Get-Item -Path "Env:\$ENV_NAME" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Value
	if (!($TCMD_PATH)) {    
        Write-Host "Переменная $ENV_NAME не существует" -ForegroundColor Red		
        return
    }
    Write-Host "Переменная $ENV_NAME существует. Eё значение '$TCMD_PATH'" -ForegroundColor Green	
	$PINTOTASKBAR_PATH = Join-Path -Path "$($TCMD_PATH)" -ChildPath 'program\PinToTaskbar\syspin.exe'
	if (!(Test-Path $PINTOTASKBAR_PATH)) {    
        Write-Host "Отсутствует файл $PINTOTASKBAR_PATH" -ForegroundColor Red
        return
    }
	$FMSG = "Start-Process -FilePath '$PINTOTASKBAR_PATH' -ArgumentList '$Targetfile', '5386'"
	Write-Host $FMSG -ForegroundColor Cyan
}

#Examples: 
# Unpin Mail App and Windows Store
# UnPin-AppFromTaskBar -AppName "Microsoft Store" -Verb taskbarunpin
# UnPin-AppFromTaskBar -AppName Mail -Verb taskbarunpin
# Pin Chrome and Office Apps to taskbar

# $StartMenuFolder = "$env:programdata\Microsoft\Windows\Start Menu\Programs"
# $FLNK = Join-Path $StartMenuFolder "Administrative Tools\services.lnk"
# WH "$FLNK"
# Test-Path "$FLNK"
$FPATH = 'l:\progs\AA_v3.exe'
Pin-ToTaskbar -targetfile "$FPATH" -Action PIN


# Pin-ToTaskbar -targetfile "$StartMenuFolder\Google Chrome.lnk" -Action pin
# Pin-ToTaskbar -targetfile "$StartMenuFolder\Excel.lnk" -Action pin
# Pin-ToTaskbar -targetfile "$StartMenuFolder\Word.lnk" -Action pin
# Pin-ToTaskbar -targetfile "$StartMenuFolder\Outlook.lnk" -Action pin
# Pin-ToTaskbar -targetfile "$StartMenuFolder\Firefox.lnk" -Action pin


