Installing Fonts During a Task Sequence
For those who spend their time designing task sequences and trying to get that 100% zero touch process you will know what I mean when I say some things are just plain difficult to do without using the GUI. One example of this is installing fonts.
I have been working with a customer recently who has some custom enterprise fonts in their task sequence and the installer they had for it was a little cumbersome and did things which were not required and complicated the whole process.
I spent some time looking as I have never deployed any fonts in a task sequence before. I came across a script on The Deployment Guys blog which is really cool. The PowerShell scripts here Add-Font.ps1 and Remove-Font.ps1 enable you to call a PowerShell script to install or remove fonts from Windows.
Using the script is pretty simple, a command line pointing to the directory where the fonts are stored is the way the script works as follows.
Add-Font.ps1 -path "<Path to Font File or Directory for Multiple Fonts>"
When in the task sequence I have a package a bit like the MDT Toolkit with my own useful scripts that I deploy to the customers environment, so I just placed the PowerShell script in here and updated my distribution points.
First of all though, I did discover the script does not accept a UNC path which is a shame and something I will look at improving. So I created a Temp directory local to the machine and then used xcopy to send everything to that directory as shown.
xcopy *.ttf %SystemDrive%\Temp /Y /I /Q
Here I have just obfuscated the customers names and initials. From here we simply use the Run PowerShell Script MDT task sequence action with the appropriate parameter on the end, again as shown in the screenshot.
Once this has done we can delete the Temp directory unless you want to use it for anything else such as a staging directory. We can delete just using a simple command:
rmdir "%SystemDrive%\Temp" /S /Q