Deploy Fonts via Intune

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:

Open Sans Font deploy intune

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:

Powershell intune font deploy

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:

Intune Portal

After that go to Windows and add an App:

Intune portal add app

Add a Win32App:

Intune portal App type

Select app package file and browse to the InstallFonts.intunewin file.

Apppackage file selection

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!

35 thoughts on “Deploy Fonts via Intune”

  1. I keep getting failed installs with error “the application was not detected after installation completed successfully (0x87d1041c)”.
    Any ideas?

    Reply
  2. I receive error “the application was not detected after installation completed successfully (0x87d1041c)”

    Reply
      • 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

        Reply
          • 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

    • 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

      Reply
  3. 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

    Reply
    • Hi Emran,

      Thanks for your message. That is an interesting idea. I will take a look at that. 🙂

      Have a nice evening.

      Niels Kok

      Reply
  4. 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 ?

    Reply
    • Hi Jeremy,

      Thanks for your comment. What is your question? I don’t actually understand what you are trying to say.

      Kind Regards,

      Niels

      Reply
  5. 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

    Reply
    • 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

      Reply
  6. 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

    Reply
    • 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

      Reply
  7. 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.

    Reply
  8. 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.

    Reply
    • 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

      Reply
  9. 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.

    Reply
  10. 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 🙂

    Reply
    • 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.

      Reply
  11. 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?

    Reply

Leave a Comment