Adding Fonts with Powershell?

Hello,

I’m tring to write a script that’ll install a folder of fonts acrross our domain, I’ll push it out using group policy.

I understand that it’s not enough to just copy the fonts to C:\windows\fonts these days and that you need to use the shell.application to register the fonts. Howver if I run :

Set objShell = CreateObject(“Shell.Application”)
Set objFolder = objShell.Namespace(“C:\fonts”)
Set objFolderItem = objFolder.ParseName(“sbd_____.pfm”)

Nothing happens, with either otf,ttf or .pfm fonts. The fonts are copied to the fonts folder but don’t show up in apps or in the registry.

The fonts only install if I add : objFolderItem.InvokeVerb(“Install”)

Is this line literally doign the same thing as i do if I manually install the font when right clicking the file?

My powershell script looks like :

$FONTS = 0x14
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.Namespace($FONTS)
$objFolder.CopyHere(“C:\fonts\vagroundedstd-thin.otf”)

Again, this only copies the fonts, they don’t show up in apps of the registry. Is there an equivalent in powershell for objFolderItem.InvokeVerb(“Install”)?

I managed to find that the font folders have a verb named &install which is the install option from the fonts contextual menu. There must be a way to run that? Invoke-Item?

Thanks fro any help.

What happens if you do:

$objFolderItem = $objFolder.Self
$objFolderItem.InvokeVerb("Install")

Should I add those to my script or execute on their own? If I execute on their own nothing seems to happen. No fonts are installed in the font folder.

ok, I added those lines to the end of my script…the fonts are copied over, but not available to any apps.

The install progress bar doesn’t appear the way it does when you run the vb version of the install command.

hi,

Found this article on msdn. At the bottom in the comments section, there is a powershell script.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb787816(v=vs.85).aspx