Install Fonts via scripting with Kace SMA
My group has been asked to push a package of True Type fonts to our Windows 10 users. I found a script in a knowledge base article in Quest support that says it should do this but I have been unable to get it to work. I am able to successfully copy the font files to the local computer but the "Install" for the fonts will not work.
Has anyone been able to successfully script the installation of fonts in Windows 10?
Thanks!
Answers (4)
The easiest way is:
- extract the fonts from the package (if they are not just zipped)
- zip the fonts you need
- add this zip to a Software item
- use file sync to copy them over
Comments:
-
Using File Sync I am able to get the zip file with the fonts in it to copy to the computer, it shows up in the KACE downloads folder. However this file doesn't seem to get unzipped into the Fonts folder. I've got the same settings selected as in your screenshot. What am I missing here? - ScottAday 5 years ago
-
I've not had much luck with dumping files into the C:\Windows\Fonts folder and ended up leveraging a powershell script from technet.
https://blogs.technet.microsoft.com/deploymentguys/2010/12/04/adding-and-removing-fonts-with-windows-powershell/ - Kiyolaka 5 years ago
If this is still open for discussion i would add the possibility to create an MSI file for a font.
+ easy to upgrade
+ easy to install & uninstall
Kind Regards
Timo
Comments:
-
What's the best way to create an MSI for this? I haven't done it before and am unsure of the process. - ScottAday 5 years ago
Top Answer
If its about TTFs I totally agree with Timo to use MSI for the mentioned reasons (standard, reliable and you have an uninstall option).
I use Advanced Installer to create MSIs like that. It's free for basic features - you don't need more to create font setup MSIs.
The following sample is created for the free Roboto Font Family avaliable here.
- Create a new basic installer project. No templates, no wizards.
- Enter some project details. Disable "Modify" unless you want to divide the fonts to features.
- Go to "Files and Folders", open the structure "Windows Volume" and "Fonts" underneath. Right-click in the files corner and choose "Add files", select your TTF files then.
You can also use drag&drop to place them there. - Now select all the TTF files you just added, right-click them and choose "Properties". Go to the "Registration" tab and enable "Register font".
- Finally go to "Install Parameters". For this fonts-only package, enter "[FontsFolder]" in both "Application folder" and "Application shortcut folder" (acutally we don't need them, but these are required fields).
"Installation type" should be "Per-machine" and enable "Limit to basic user interface".
Thats all. Now save your project and build it to get your MSI file.
Comments:
-
That's perfect :) - Timokirch 5 years ago
-
Thank you, this is very helpful! - ScottAday 5 years ago
-
A very helpful documentation! Thank you - Gerhart 5 years ago
-
I was able to create an MSI for this that will work properly if I run it manually on my computer. But I can't get it to install the fonts via Kace either as a script or managed installation. Any suggestions for best practices for this? - ScottAday 5 years ago
-
If its run as a script: could you turn on logging and post the log to see what is going on?
Example:
msiexec.exe /i MyFontSetup.msi /qn /L*v C:\Temp\MyLogfile.txt - chrpetri 5 years ago-
I was able to get it working. The script was hanging up during execution for some reason. I duplicated the script in Kace and ran the duplicate and it worked. Thanks for the help! - ScottAday 5 years ago
I do this via a powershell script that leverages some cmndlets from technet.
here is my readme file and beneath it is the script I use.. I use versioning for inventory purposes as well as if we had to purge a font for licensing reasons.
Script for adding bundled fonts.
Script for adding bundled fonts.
Relies upon Microsoft Powershell scripts Add-Font.ps1 and Remove-Font.ps1.
Place these scripts in a subfolder named "Scripts"
https://blogs.technet.microsoft.com/deploymentguys/2010/12/04/adding-and-removing-fonts-with-windows-powershell/
Font files should be placed in a subfolder named "Fonts"
To Do:
Add section to script for removing fonts which is not currently encorporated.
======================== SCRIPT BELOW ==============
# District Font package script
# This script executes the installation of fonts and brands the versioning of the bundle into the registry for reporting purposes.
# Version of the font bundle
$BundleVersion = "1.00"
# Name for the font package
$Bundlename = "PCC Fonts - District Bundle"
# Publisher to display in the registry entry.
$BundlePublisher = "Portland Community College IT Dept"
#### Do not edit anything below
# Set ScripRoot variable to the path which the script is executed fro for PS 2.0 Compatility.
if (!($PSScriptRoot)){
$PSScriptRoot = Split-Path -Path $MyInvocation.MyCommand.Path
}
# Install the fonts contained within the \fonts directory
& "$PSScriptRoot\Scripts\Add-Font.ps1" -Path "$PSScriptRoot\Fonts" |Out-Host
Write-Output "Creating registry branding" |Out-Host
# Set a value with the registry path.
$RegistryPath = "HKLM:Software\Microsoft\Windows\CurrentVersion\Uninstall\$Bundlename"
# Create the registry path if it does not exist.
if (!(Test-Path $RegistryPath)){
New-item -path $Registrypath -Force -ea SilentlyContinue
}
# Create the display name registry key
New-ItemProperty -Path $RegistryPath -Name "DisplayName" -Value "$Bundlename" -PropertyType string -Force |Out-Null
# Create the version registry key
New-ItemProperty -Path $RegistryPath -Name "DisplayVersion" -Value "$BundleVersion" -PropertyType string -Force |Out-Null
# Create the Publisher registry key
New-ItemProperty -Path $RegistryPath -Name "Publisher" -Value "$BundlePublisher" -PropertyType string -Force |Out-Null
# Mark the package as a "System Component" Thus hiding it from the add/remove program menu
New-ItemProperty -Path $RegistryPath -Name "SystemComponent" -Value "1" -PropertyType dword -Force |Out-Null
# Display the program information.
Write-Output "Software Details" |Out-host
Get-ItemProperty -path $RegistryPath |out-Host
Note:
This is a scrubbed copy of the script which I've removed the font files from for licensing reasons.