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.


Log in to reply
 

496
Online

39.4k
Users

11.1k
Topics

105.4k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.