Installing Fonts During OSD

Font_Book_IconHere’s a simple little script to install fonts during OSD. Note that this is an example of not doing any manual work during OSD: manual work is un-IT. A quick web search, using Bing of course (Hey, Scripting Guy! How Can I Install Fonts Using a Script- – Hey), and a little scripting knowledge resulted in this VBScript.

Const FONTS = &H14&

Set shell = CreateObject("Shell.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
Set fontsFolder = shell.Namespace(FONTS)

scriptFullName = WScript.ScriptFullName

Set currentFolder = fso.GetFolder (fso.GetParentFolderName(scriptFullName) & "\Fonts")
 
For Each file In currentFolder.Files
    If fso.GetExtensionName(file.Name) = "ttf" Then
        WScript.Echo "Installing font: " & file.Path
        fontsFolder.CopyHere file.Path
    End If
Next

Dump this is a .vbs file in a ConfigMgr package with a Fonts subfolder containing any fonts that you want to import then simply use a command-line task to call the VBScript; e.g., cscript InstallFonts.vbs.

One possible improvement for this script is to check for the existence of the Font before trying to import it because if it is already imported, a message box will be displayed with an error message which is obviously not a good thing during OSD (note that the message box is actually visible and clickable though so it’s not a show stopper).

Leave a Reply

x

We use cookies to ensure the best possible experience on our website. Detailed information on the use of cookies on this site is provided in our Privacy and Cookie Policy. Further instruction on how to disable our cookies can be found there.