Private/UI/Initialize-EwWorkbenchDialogChrome.ps1

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

function Initialize-EwWorkbenchDialogChrome {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [System.Windows.Window]$Window
    )

    # A null WPF icon falls back to the PowerShell executable's icon.
    $pixels = [byte[]]::new(16 * 16 * 4)
    $icon = [System.Windows.Media.Imaging.BitmapSource]::Create(
        16, 16, 96, 96, [System.Windows.Media.PixelFormats]::Bgra32, $null, $pixels, 16 * 4
    )
    $icon.Freeze()
    $Window.Icon = $icon
    Write-Verbose -Message "EvergreenUI: Removed the title bar icon from dialog '$($Window.Title)'"
}