For Windows 10 buildĀ 1809, see notes.
Older builds, use this:
$ErrorActionPreference = "SilentlyContinue" $path = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" Remove-ItemProperty -Path HKLM:$path -Name "OpenSans (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Bold (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Bold Italic (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Extrabold (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Extrabold Italic (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Italic (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Light (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Light Italic (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Semibold (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans (TrueType)" Remove-ItemProperty -Path HKLM:$path -Name "Open Sans Semibold Italic (TrueType)" start-sleep 10 dir *.ttf | %{ (New-Object -ComObject Shell.Application).Namespace(0x14).CopyHere($_.fullname) }
Notes
{ Updated 3/26/2019 }
Since build 1809, the shell variable 0x14 is being overloaded and redirected to the user’s profile (if using SCCM and admin mode, the systemprofile is used). Not great. Microsoft, please fix it. Basically, this causes font issues, where the fonts appear to be installed, but are not. The workaround is to not use 0x14.
Windows 1809 breaks PowerShell script to install font
Can no longer install fonts via script in Windows 10 1809
Font Key Reg Location
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
Font File Folder Location
C:\Windows\Fonts
If fonts don’t show up in C:\Windows\Fonts, delete the fonts from the user profile and the user’s registry—using the admin profile (or a different profile)
C:\Users\%username%\AppData\Local\Microsoft\Windows\Fonts
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
Rebuild Font cache in Windows 10
sc stop "FontCache" ping -n 10 127.0.0.1>nul sc config "FontCache" start= disabled ping -n 4 127.0.0.1>nul sc stop "FontCache3.0.0.0" ping -n 10 127.0.0.1>nul sc config "FontCache3.0.0.0" start= disabled ping -n 4 127.0.0.1>nul reg DELETE "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /f del /f /a /q "C:\Windows\ServiceProfiles\LocalService\AppData\Local\*FontCache*" del /f /a /q "C:\Windows\System32\FNTCACHE.DAT" del /q "C:\Users\%username%\AppData\Local\Microsoft\Windows\Fonts\*.*" sc config "FontCache" start= auto ping -n 4 127.0.0.1>nul sc start "FontCache" ping -n 10 127.0.0.1>nul sc config "FontCache3.0.0.0" start= auto ping -n 4 127.0.0.1>nul sc start "FontCache3.0.0.0" ping -n 10 127.0.0.1>nul
Fonts and SCCM
Yes, there are other areas Font data is stored in 1809, if using SCCM and System Account:
HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Fonts
“C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Fonts\”
Scripting
For scripting, resort to something simple (no 0x14) (simple…is working for me)
copy /y C:\fonts\*.ttf C:\Windows\Fonts\
regedit /s C:\fonts\OpenSansFont.reg
OpenSansFont.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
“Open Sans Extrabold (TrueType)”=”OpenSans-ExtraBold.ttf”
“Open Sans Extrabold Italic (TrueType)”=”OpenSans-ExtraBoldItalic.ttf”
“Open Sans Italic (TrueType)”=”OpenSans-Italic.ttf”
“Open Sans Light (TrueType)”=”OpenSans-Light.ttf”
“Open Sans Light Italic (TrueType)”=”OpenSans-LightItalic.ttf”
“Open Sans (TrueType)”=”OpenSans-Regular.ttf”
“Open Sans Semibold (TrueType)”=”OpenSans-Semibold.ttf”
“Open Sans Semibold Italic (TrueType)”=”OpenSans-SemiboldItalic.ttf”
“Open Sans Bold (TrueType)”=”OpenSans-Bold.ttf”
“Open Sans Bold Italic (TrueType)”=”OpenSans-BoldItalic.ttf”
“OpenSans (TrueType)”=”OpenSans-Bold.ttf”
Franklin Gothic Demi Reg Keys
“Franklin Gothic Demi (TrueType)”=”ITCFranklinGothicStd-Demi.otf”
“Franklin Gothic Demi Cond (TrueType)”=”ITCFranklinGothicStd-Demi.otf”
“Franklin Gothic Demi Italic (TrueType)”=”ITCFranklinGothicStd-Demi.otf”
Found Online (not tested)
Command line in SCCM Task Sequence
%SCRIPTROOT%\nircmd.exe elevate \\Server\d$\MDTBuildLab\Fonter\AddFonts.cmd \\server\d$\MDTBuildLab\Fonter\fonts\
AddFonts.cmd
@ECHO OFF TITLE Adding Fonts color 0a cls :: Filename: ADD_Fonts.cmd :: Script to ADD TrueType and OpenType Fonts for Windows :: How to use: :: Place the batch file inside the folder of the font files OR: :: Optional Add source folder as parameter with ending backslash and don't use quotes, spaces are allowed :: example "ADD_fonts.cmd" C:\Folder 1\Folder 2\ IF NOT "%*"=="" SET SRC=%* ECHO Adding Fonts... ECHO. FOR /F %%i in ('dir /b "%SRC%*.*tf"') DO CALL :FONT %%i ECHO Done! :: PAUSE EXIT :FONT ECHO. ECHO FILE=%~f1 SET FFILE=%~n1%~x1 SET FNAME=%~n1 SET FNAME=%FNAME:-= % IF "%~x1"==".otf" SET FTYPE=(OpenType) IF "%~x1"==".ttf" SET FTYPE=(TrueType) ECHO FILE=%FFILE% ECHO NAME=%FNAME% ECHO TYPE=%FTYPE% COPY /Y "%SRC%%~n1%~x1" "%SystemRoot%\Fonts\" reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "%FNAME% %FTYPE%" /t REG_SZ /d "%FFILE%" /f GOTO :EOF