PSAppDeployToolkit icon indicating copy to clipboard operation
PSAppDeployToolkit copied to clipboard

[Feature] Add option to define logos as base64 encoded string

Open mdmplayground opened this issue 2 months ago • 1 comments

Summary of the new feature / enhancement

To avoid any copy jobs of corporate logos, I would need the possibility to define logos as a base64 image in the admx templates/config. In order to provide backwards combability both methods should work.

Proposed technical implementation details (optional)

If the logic behind the scene is PowerShell, I would suggest the following approach:

try {
    $ImageFile = Get-ItemPropertyValue -LiteralPath "HKLM:SOFTWARE\Policies\PSAppDeployToolkit\Config\Assets" -Name "Logo"
    If ($ImageFile -match "(^[A-Za-z]\:)|(^\\)" ){
        $base64ImageString = [convert]::ToBase64String((get-content $ImageFile -encoding byte))
        $imageBytes = [Convert]::FromBase64String($base64ImageString)
        $ms = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length)
        $ms.Write($imageBytes, 0, $imageBytes.Length);
        $Image = [System.Drawing.Image]::FromStream($ms, $true)
    }
    else {
        $base64ImageString = $ImageFile 
        $imageBytes = [Convert]::FromBase64String($base64ImageString)
        $ms = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length)
        $ms.Write($imageBytes, 0, $imageBytes.Length);
        $Image = [System.Drawing.Image]::FromStream($ms, $true)
    }

}
catch {
    Write-Host "No image set via policy or invalid"
    #Do some other stuff
}

mdmplayground avatar Oct 09 '25 15:10 mdmplayground

What a brilliant idea! We'll have this in 4.2.0.

mjr4077au avatar Oct 09 '25 20:10 mjr4077au