Install Fonts from a Server Share

This is a simple script that allows you to put as many fonts as you would like in a share, and install them on a PC. This should be run as a user with local admin access, and access to the server share. It can be run with your RMM.

Note: Once this script is run, it will create a done.txt file in the FontInstall folder. Unless you modify the script, this will stop the script from running again. This is designed to prevent fonts or reg keys from being run over if the script is run at logon or startup.

#see if the folder is there
if(!(Test-Path -Path "C:\FontInstall")) {
    New-Item "C:\FontInstall" -ItemType Directory 
#check if we've already done this
if(Test-Path -Path "C:\FontInstall\done.txt") {
$path = "C:\FontInstall"
#server share where fonts exist w/ trailing '\' Place all of your fonts in this folder
$ServerShare = "\\server\share\fonts\deploy\"
robocopy "$ServerShare" "$path\"
$files = dir $path
#install each font
foreach($file in $files) {
    #generate key name
    $fontname = $file.BaseName
    #copy file to the fonts folder
    robocopy "$path\" "C:\Windows\Fonts\" $file
    #create reg key
    New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\ -Name "$fontname" -PropertyType "String" -Value "$file"
#plants blank txt file so that we don't overwrite fonts all the time
#if you do a new set of fonts, delete done.txt or remove the exit function above
New-Item "C:\FontInstall\done.txt" -ItemType File
  • Last modified: 2018/02/25 01:18
  • (external edit)