This is a blog about how to deploy fonts via Intune. These fonts are not default available in Windows. I will show you how to deploy the fonts via a Win32App from Intune.
Prerequisites
Licenses to be able to deploy Windows 10 Autopilot machines. How do so you can follow my guide.
The IntuneWinAppUtility which you can download here.
Furthermore, you will need the font files. For example:
Preparation
For prepartion please create these files:
The “Open Sans Regular.ttf” can be your font ofcourse. Additionally, if you want to add more than 1 font you can add them here.
These files contain the following content:
Firstly, the install.cmd file:
if not exist "C:\ProgramData\InstallFonts" md "C:\ProgramData\InstallFonts" robocopy . *.ttf C:\ProgramData\InstallFonts xcopy Uninstall.ps1 C:\ProgramData\InstallFonts /Y Powershell.exe -Executionpolicy bypass -File InstallFonts.ps1
Secondly, the InstallFonts.ps1 file:
if (!(Test-Path "C:\ProgramData\InstallFonts")) { New-Item -Path C:\ProgramData\InstallFonts -ItemType Directory } Start-Transcript -Path "C:\ProgramData\InstallFonts\Installfonts.log" $FontstoInstall = Get-ChildItem -Path C:\ProgramData\InstallFonts\ | Where-Object Name -Like "*.ttf" foreach ($FontFile in $FontstoInstall){ try{ Write-Output "Font file '$($FontFile.Name)' passed as argument" Write-Output "Copying item to: '$("$env:windir\Fonts\$($FontFile.Name)")'" Copy-Item -Path "C:\ProgramData\InstallFonts\$($FontFile.Name)" -Destination "$env:windir\Fonts" -Force -PassThru -ErrorAction Stop Write-Output "Creating item: "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\$($FontFile.Name)"" New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name $($FontFile.Name) -PropertyType String -Value $($FontFile.Name) -Force }catch{ Write-Error $_ } } Stop-Transcript
Lastly, this is the content of the Uninstall.ps1 file:
$FontstoInstall = Get-ChildItem -Path C:\ProgramData\FontsToInstall\ | Where-Object Name -Like "*.ttf" foreach ($FontFile in $FontstoInstall){ Remove-Item -Path C:\Windows\Fonts\$FontFile -Force }
Packaging
Open up Powershell and run the IntuneWinAppUtil.
If you haven’t download the IntuneWinAppUtil, you can do so here.
Use the following parameters within the IntuneWinAppUtil:
The file in the red line is the output:
This is the input for the Intune deployment.
Deployment
The Win32App now need to be deployed.
Log on to the Intune Portal
Go to Apps:
After that go to Windows and add an App:
Add a Win32App:
Select app package file and browse to the InstallFonts.intunewin file.
Specify the package information:
Fill in the program information. The uninstall command will be filled for you due to the MSI in the .intunewin file:
Specify requirements:
Configure the detection rules:
At depencies click next.
Assign the application:
And the font is deployed!
I keep getting failed installs with error “the application was not detected after installation completed successfully (0x87d1041c)”.
Any ideas?
I receive error “the application was not detected after installation completed successfully (0x87d1041c)”
Hi Dieter,
Could you please elaborate, send me an e-mail with the details.
Kind Regards,
Niels
Hi, thank you for your guide. I tried it as you described, but I always get this error: App installation failed Error code: 0x80070000
On my Devices I can see, that the fonts have been copied to the Appdata folder. But it seems that the installation afterwards fails.
Do you have any idea why this happens? Your Help would be much appreciated.
Best Regards,
Tan
Hi Tan,
Thanks for trying the installation. What script do you use for installation and what paths do you copy the files too?
Niels
Hi Niels,
Thanks for your reply. I am using the script you posted for installation and did not change the paths. The files are copied successfully into this path: C:\ProgramData\InstallFonts
Thank you for your help 🙂
Best regards,
Tan
Thanks for your reply!
Thanks so much. I read a few articles on this same issue – but this one was the first one that worked for me.
Thank you!
Hi, Why do you require the .cmd file if when create the package you selected InstallFonts.ps1 as setup file?
Hi Ram,
It is not required. I like to deploy it this way because I then can copy the files to a location which I can later review. Furthermore, you can add more fonts and files to this configuration.
Thanks,
Niels
Hello,
I am appreciated to do “Deploy Fonts via Intune”
Can you help me to figure it out ” How to do for MacOS ”
I mean how to create Create same Package for Mac OS
I did not find any suitable solution for that ! I want to create for Mac same thing !
Can u help me out !
Thank you in Advance
Hi Emran,
Thanks for your message. That is an interesting idea. I will take a look at that. 🙂
Have a nice evening.
Niels Kok
The uninstall command file location is different
Hi Rob,
You are right, I forgot something to add to the install.cmd. I will update the blog.
Niels
Seems like the update messed up the other scripts, there’s a bunch of HTML entities now.
Thanks! I have updated the post. That is one of the things I hate about WordPress.
Hello,
Good job but you not explain how to install.
1 create a c:\temp folder and copy your intunewin file
2 create c:\temp\IntuneFonts folder
3 copy the installfonts.ps1 file to c:\temp\IntuneFonts folder
4Copy you font and Install.cmd and Uninstall.ps1 file in a folder (like you want). For exemple, a create c:\temp\prepareIntuneFonts folder and i copy file
5 Execute the Install.cmd with Administrator right
6 Execute the IntuneWin and answered the question like the screenshot
Are you ok ?
Hi Jeremy,
Thanks for your comment. What is your question? I don’t actually understand what you are trying to say.
Kind Regards,
Niels
Hi Niels,
I work for an architecture firm and I have been tasked with doing this for marketing as my background is not in IT, I am struggling I can get it to make the folder but it doesn’t copy the fonts
Linotype – Neue Haas Grotesk Display Pro 45 Light.ttf
Linotype – Neue Haas Grotesk Display Std 45 Light.ttf
Linotype – Neue Haas Grotesk Text Pro 55 Roman.ttf
do I have to add the font names somewhere in the PowerShell script
Regards
Brendan
Hi Brendan,
When you just run the script on your local machine to copy the fonts. Does that work properly? If it doesn’t, please take a look at the blogpost again and try to get it to work. If it doesn’t work let me know.
Niels
Hello Niels,
I’ve been reading your manuel, i proceed the same steps.
I am running into this error now:
The application was not detected after installation completed successfully (0x87D1041C)
I can’t figure out which problem this should be
Hi IT Guy,
Can you check whether the supporting files have been deployed? Are these copied onto the target machine? If not, check your script to copy the files.
If the files are there check the part of the script to import the files into Windows. Run it manually if you can.
Thanks,
Niels
Great tutorial, mate. It worked perfectly. Thank you very much.
Thanks mate!
If you add more than one font this seems to fail. It does the Reg change for both fonts but wont copy the fonts into C:\Windows\Fonts.
If I have one font it works just fine.
Any ideas, this is driving me crazy.
Hi Josh,
How does your script look?
Thanks,
Niels
HI Neils
This is what I have in the install.cmd
if not exist “C:\ProgramData\InstallFonts” md “C:\ProgramData\InstallFonts”
robocopy . *.otf C:\ProgramData\InstallFonts
xcopy Uninstall.ps1 C:\ProgramData\InstallFonts /Y
Powershell.exe -Executionpolicy bypass -File InstallFonts.ps1
Then in the installFont.ps1 I have this. The only thing I changed was to look for a .otf files
if (!(Test-Path “C:\ProgramData\InstallFonts”)) {
New-Item -Path C:\ProgramData\InstallFonts -ItemType Directory
}
Start-Transcript -Path “C:\ProgramData\InstallFonts\Installfonts.log”
$FontstoInstall = Get-ChildItem -Path C:\ProgramData\InstallFonts\ | Where-Object Name -Like “*.otf”
foreach ($FontFile in $FontstoInstall){
try{
Write-Output “Font file ‘$($FontFile.Name)’ passed as argument”
Write-Output “Copying item to: ‘$(“$env:windir\Fonts\$($FontFile.Name)”)'”
Copy-Item -Path “C:\ProgramData\InstallFonts\$($FontFile.Name)” -Destination “$env:windir\Fonts” -Force -PassThru -ErrorAction Stop
Write-Output “Creating item: “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\$($FontFile.Name)””
New-ItemProperty -Path ‘HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts’ -Name $($FontFile.Name) -PropertyType String -Value $($FontFile.Name) -Force
}catch{
Write-Error $_
}
}
Stop-Transcript
I just can’t work out, if I have more than one .otf font in the folder it seems to fail. It only makes the change in the registry but won’t copy the font to C:Windows\font.
Hi Josh,
What does the transcript log in C:\programdata\installfonts say? That should state an error.
Does it work if you run it manually on the device?
Thanks,
Niels
I literally copied you script but instead of searching for .ttf I changed it to .otf
I works a dream if you have one font but as soon as you have more than one its not happy.
What is strange, the logs files implies its copied the fonts into C:Windows\fonts but when you look, they are not there, however they are in the registry.
if you just have just one font in the folder, is shows in C:Windows\fonts and the registry.
Hi Niels,
From the preparation you explained:
===========================================================================================
The “Open Sans Regular.ttf” can be your font ofcourse. Additionally, if you want to add more than 1 font you can add them here.
==========================================================================================
When I specify detection rule > File or folder > SourceSans3-SemiBoldItalic.ttf > for one font works >
Now: in the same field, shall I use semicolon for all other ones or I can simply add the the folder path that is the same as the Detection rule field > “PATH” > for ex : Path:C:\Windows\Fonts > File or Folder:C:\Windows\Fonts > can those be the same. The reason is I have 50 fonts 🙂
Hi Tim,
You could use something like the following:
$Fonts = @(
“Font1.ttf”
“Font2.ttf”
)
Foreach ($font in $fonts){
Test-Path -Path C:\Windows\Fonts\$font
}
NOTE: This not complete, please complete it yourself.
HI,
Thank you for the blog, this is much appreciated.
I managed to get the fonts installed but I still get an error that states the system failed to check if the operation completed successfully. I see that someone else had a similar question/issue as I and you responded by stating:
“You could use something like the following:
$Fonts = @(
“Font1.ttf”
“Font2.ttf”
)
Foreach ($font in $fonts){
Test-Path -Path C:\Windows\Fonts\$font
}
”
Can you please verify if this is another script? or where do I add this information?
Hello,
Yes, this is another script. You could use this as your custom detection script in the Win32App section.
Thanks,
Niels