How to install fonts in Windows machine via Hexnode?
How to install fonts in Windows machine via Hexnode?Solved
Tags
Replies (2)
Hi @aakash-shah,
Thank you for reaching out to us. Unfortunately, Hexnode UEM currently does not offer a feature for installing fonts on Windows devices. We will explore alternative solutions and get back to you as soon as possible.
Best regards,
Eden Pierce
Hexnode UEM
Hello @aakash-shah,
Thank you for your patience. Although Hexnode UEM doesn’t have a built-in feature for font installation on Windows devices, you can use the “Execute Custom Script” feature to achieve this. Here is a script you can use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
function WriteLog { param ( [string]$LogString ) $Stamp = (Get-Date).ToString("yyyy/MM/dd HH:mm:ss") $LogMessage = "$Stamp $LogString" Add-Content -Path $LogFile -Value $LogMessage } $LogFile = # Replace with Log file path $FontUrl = #Replace with URL to download .ttf/.otf file $FontDestination = # Replace with the desired destination path $RegistryPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' if (-not (Test-Path -Path (Split-Path -Path $LogFile))) { New-Item -Path (Split-Path -Path $LogFile) -ItemType Directory -Force } # Download the font file try { WriteLog "Downloading font from $FontUrl" Invoke-WebRequest -Uri $FontUrl -OutFile $FontDestination -ErrorAction Stop WriteLog "Font downloaded successfully to $FontDestination" } catch { WriteLog "Error downloading font: $_" exit } # Install the font Add-Type -AssemblyName System.Drawing $WindowsFonts = [System.Drawing.Text.PrivateFontCollection]::new() try { WriteLog "Copying font file to $env:SystemRoot\Fonts" Copy-Item -Path $FontDestination -Destination "$env:SystemRoot\Fonts" -Force -Confirm:$false -PassThru | ForEach-Object { WriteLog "Installing font file $_.Name" $WindowsFonts.AddFontFile($_.FullName) # Update the registry $RegistryValue = @{ Path = $RegistryPath Name = $WindowsFonts.Families[-1].Name Value = $_.FullName } # Remove existing registry entry if present if (Test-Path -Path $RegistryPath) { Remove-ItemProperty -Path $RegistryPath -Name $($WindowsFonts.Families[-1].Name) -ErrorAction SilentlyContinue } New-ItemProperty @RegistryValue WriteLog "Font registry updated with $($WindowsFonts.Families[-1].Name)" } } catch { WriteLog "Error installing font: $_" } finally { # Clean up: Remove the downloaded font file if (Test-Path -Path $FontDestination) { WriteLog "Removing temporary font file $FontDestination" Remove-Item -Path $FontDestination -ErrorAction Stop } } WriteLog "Font installation process completed." |
Please ensure to replace the placeholders with the actual paths and URLs specific to your environment. The script will download the font, install it, and update the Windows registry accordingly. Additionally, a device restart is recommended after running the script to apply the changes.
Best Regards,
Eden Pierce
Hexnode UEM