Installing Fonts During OSD

Patch My Pc | install & update thousands of apps

Here’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

Your email address will not be published. Required fields are marked *

4  +    =  9

Proudly powered by WordPress | Theme: Wanderz Blog by Crimson Themes.