Jump to content
shnladd

UAC interfering with font addition?

Recommended Posts

I'm working on a script to deploy some TTF font files to a client but am running up against a wall at the last stage. My script is successfully able to download a 7zip archive containing the TTF files and the FontReg.exe utility to install them, along with the 7z binary and library, and decompress the archive. However, when the time comes to run "C:\LTTemp\FontReg.exe /copy" to deploy the fonts, the script either hangs until a reboot or reports success with no actual results.

 

Running FontReg.exe /copy from the shell manually on the endpoint brings up a UAC prompt. I'm not sure which shell command I should be configuring in Labtech (shell as admin, shell as user, shell enhanced, plain shell) but what I've tried so far - Admin, User with known-good domain creds, and plain shell - doesn't seem to actually install and register the font files.

 

Can anyone help me see what I'm doing wrong? I have a feeling like it's something obvious that I'm missing but I can't make out what it is right now. Thanks!

Share this post


Link to post
Share on other sites

If UAC is interfering, Run As Admin and Run As User will likely fail. The straight "Execute Shell" function will run with SYSTEM privileges, which resolves UAC but adds other wrinkles.

A little Google for FONTREG.EXE brought a readme with some possibly relevant info? (From https://www.richud.com/wiki/Windows_Fontreg_install_fonts_locally_or_remotely_easily)

The CWD must be where the fonts are! You cant execute the .exe from elsewhere otherwise it wont do anything (still returns errorcode 0 though).

That suggests that your command line should be:

CD /D "@PATHTOEXTRACTEDFONTS@" & FONTREG.EXE /copy

This page even has an example batch file that you could drop into an "Execute Script" batch function step: http://texhex.blogspot.com/2012/06/silent-installation-of-ttf-fonts-on.html

Share this post


Link to post
Share on other sites

I have a little script which installs fonts. It downloads this .vbs file from my server:

strPath = WScript.Arguments.Item(0)
strFontname = WScript.Arguments.Item(1)
wscript.echo  "Installing font from " & strPath & StrFontName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strPath)
Set objFolderItem = objFolder.ParseName(strFontname)
objFolderItem.InvokeVerb("Install")

which I drop into a temp folder, along with the font file. The script takes a path and filename.

 

All I do in my automate script is download the above vbs and the ttf. I then shell

cscript above-file.vbs c:\temp\myfont.ttf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×