I have a folder filled with TTF files of custom fonts. I need to install them as system fonts using a powershell script (this is on Windows Server 2008 R2). Does anybody know how to do that in powershell? Thanks!
Run regedit.exe and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont. Right-click in the panel on the right side and create a new string value. Name that value “0″ or “00″ or however many zeros you need to create a new key.
What to Know. To install a font from a folder, open the folder containing the font, but do not open the font file. Next, open Control Panel, double-click Fonts, then drag the font file into the Fonts folder. To install a font directly from the font file, right-click or double-click the font file and select Install.
It is quite simple. Take a look on the snippet below:
$FONTS = 0x14
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.Namespace($FONTS)
$objFolder.CopyHere("C:\test\Myfont.ttf")
And it should not require to restart/logoff...
The 0x14 value is the CLSID of the special folder.
In addition I just found this tutorial explaining each step above:
http://windowsitpro.com/scripting/trick-installing-fonts-vbscript-or-powershell-script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With