Installing fonts on Windows 7/2008 with a login script

Monday, June 27th, 2011 | Uncategorized | Mike Smith

It is possible using a simple VBS script to install fonts via a logon script on Windows 7 or Server 2008 operating systems.

The pre-reqs for this are very low, all you need to have is a share with the fonts available.

The first step is to add a line to your logon script to see if the fonts have not been installed.  I keep track of this using an empty text file.  If the file does not exist, install fonts and files.  If the file does, then skip the install.  My Example:

IF NOT EXIST “C:\Users\font.txt” “\\domain\netlogon\Fonts\font.bat”

The next step is the batch file text.  To have this work, you must first copy the font files locally to the user workstation, install them, then delete them as follows:

xcopy  “\\domain\netlogon\font.txt” “C:\Users\”

xcopy “\\domain\netlogon\Fonts\*.otf” “C:\” /E /I /Y
xcopy “\\domain\netlogon\Fonts\*.ttf” “C:\” /E /I /Y
cscript.exe “\\domain\netlogon\Fonts\fonts.vbs”
del “c:\*.ttf”
del “c:\*.otf”

If you notice the above script, I also copy the text file allowing me to skip this at the next and future logons.

The contents of the VBS file are simple:

Const FONTS = &H14&

Set objShell = CreateObject(“Shell.Application”)
Set objFolder = objShell.Namespace(FONTS)
objFolder.CopyHere “C:\font1.otf”
objFolder.CopyHere “C:\font2.ttf”

This works with both true type and open type fonts.  This method also ensures the fonts are not copied to the workstation every time the user logs in.  Adding additional fonts are as easy as adding another line to the end of the VBS script with the file name of the font.

 

Tags: , , , , , ,

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Page 1 of 11

Leave a Reply