/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Install Fonts via scripting with Kace SMA

11/21/2019 527 views

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!

Answer Summary:
0 Comments   [ + ] Show comments

Comments


Answer Chosen by the Author

1

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.


  1. Create a new basic installer project. No templates, no wizards.
    2Q==

  2. Enter some project details. Disable "Modify" unless you want to divide the fonts to features.
    Z

  3. 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.
    2Q==

  4. Now select all the TTF files you just added, right-click them and choose "Properties". Go to the "Registration" tab and enable "Register font".
    9k=

  5. 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".
    2Q==


Thats all. Now save your project and build it to get your MSI file.

Answered 12/04/2019 by: chrpetri
Senior Purple Belt

  • That's perfect :)
  • Thank you, this is very helpful!
  • A very helpful documentation! Thank you
  • 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?
    • 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
      • 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!

All Answers

1

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
Z

Answered 11/22/2019 by: Nico_K
Red Belt

  • 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?
    • 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/
1

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

Answered 11/25/2019 by: Timokirch
Black Belt

  • What's the best way to create an MSI for this? I haven't done it before and am unsure of the process.
    • Hey Scott,
      i have used RayPack Studio for this. Back then it was super easy through the assistant of the software.
      https://raynet.de/en/products/raypack-studio/quest-kace/

      Kind Regards
      timo
      • Thank you! I'll look into this.
0

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.

Answered 11/21/2019 by: Kiyolaka
Purple Belt