Font install

HI all,

I'm trying to install a font to all machines using a script (powershell) in SCCM. i have tried a whole bunch that some work some say they work (they don't show up)  i have over 700 machines that need it.

Here is one i have tried:

# Set Font Location $FontLocation = "\\servername\fontshare\" # Set Font Reg Key Path $FontRegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" # Get the list of font files from the Font Location $FontFiles = Get-ChildItem -Path $FontLocation -Include *.ttf, *.otf, *.fon, *.fnt

-Recurse # Loop through each font file foreach ($FontFile in $FontFiles) { # Copy Font to the Windows Font Directory $FontDestinationPath = "C:\Windows\Fonts\" + $FontFile.Name Copy-Item $FontFile.FullName $FontDestinationPath -Force # Set the Registry Key to indicate the Font has been installed $RegistryValueData =

"$($FontFile.Name) ($($FontFile.Extension))" # Font name and extension New-ItemProperty -Path $FontRegPath -Name $FontFile.Name

-Value $RegistryValueData -PropertyType String | Out-Null Write-Host "Font $($FontFile.Name) installed successfully." }

0 Comments   [ + ] Show comments

Answers (1)

Posted by: JordanNolan 10 months ago
10th Degree Black Belt

I think your Include statement is a little off.  Try this

$FontFolder = "\\NetworkShare\FontsFolder"
$FontItem = Get-Item -Path $FontFolder
$FontList = Get-ChildItem -Path "$FontItem\*" -Include ('*.fon','*.otf','*.ttc','*.ttf')
foreach ($Font in $FontList) {
     Write-Host 'Installing font -' $Font.BaseName
     Copy-Item $Font "C:\Windows\Fonts"
     New-ItemProperty -Name $Font.BaseName -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" -PropertyType string -Value $Font.name

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ