FOG Snapin - Font installation (Windows)



  • Our media department has a couple dozen fonts that they regularly use. I created this FOG snapin to automate the task. Works for TrueType and OpenType fonts.
    alt text

    $Fonts = Get-ChildItem -Path $PSScriptRoot -Recurse | Where-Object -FilterScript { $PSItem.Extension -eq ".ttf" -or $PSItem.Extension -eq ".otf" }
    $FontPath = "$env:SystemRoot\Fonts"
    $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
    
    ForEach ($Font in $Fonts) {
        Copy-Item -Path $Font.FullName -Destination $FontPath -Force
        $Name = $Font.BaseName
        if ($Font.Extention -eq ".ttf") {
            $Name = $Font.BaseName + " (TrueType)"
        } elseif ($Font.Extention -eq ".otf") {
            $Name = $Font.BaseName + " (OpenType)"
        }
        $Value = $Font.Name
        New-ItemProperty -Path $RegPath -Name $Name -Value $Value -Force | Out-Null
    }
    

    Put the install.ps1 file and your fonts into a folder and zip archive it. Then upload it as a SnapinPack.
    alt text

    A restart is required before the fonts will be accessible.


 

441
Online

41.7k
Users

12.2k
Topics

115.1k
Posts