Forum Discussion
ashisharya
Jun 22, 2021Copper Contributor
PowerShell script to change font of office apps
Hi,
We are using Microsoft 365 for Enterprise for delivery office apps to users via Microsoft Intune.
Currently the default font for all office apps is Calibri and now users want that it should change to Arial, 11 font.
Is there a way in Powershell to make that change.
I have been suggested ways to do it with .net objects or Interop.
Can someone please share a sample PowerShell script or a full script to make that change.
Thanks,
Ashish Arya
We are using Microsoft 365 for Enterprise for delivery office apps to users via Microsoft Intune.
Currently the default font for all office apps is Calibri and now users want that it should change to Arial, 11 font.
Is there a way in Powershell to make that change.
I have been suggested ways to do it with .net objects or Interop.
Can someone please share a sample PowerShell script or a full script to make that change.
Thanks,
Ashish Arya
- SteveMacNZIron Contributor
Hi Ashish,
are you able to clarify are you wanting to just change the default settings for new documents? or are you wanting to retro-fix existing documents as well?
If it's just changing the default settings for word/outlook then the easiest method is to update the Normal.dotx / NormalEmail.dotm file on a device and replace the versions on the rest of the devices with the updated ones...
quick steps for creation
1 - update Normal.dotx / NormalEmail.dotm and save to a folder
2 - create a PowerShell script to copy the above files to the correct location - you will want to include something in the script to write a file or a reg key that you can use in the detection rules in MEM
copy-item -path .\Normal.dotx -destination $env:Appdata\Microsoft\Templates -force copy-item -path .\NormalEmail.dotm -destination $env:Appdata\Microsoft\Templates -force
3 - using the Microsoft Win32 Content Prep tool make an .intunewin containing the script and the new files
4 - upload to MEM as Win32 application and configure detection rules etc
5 - link Win32 Application to a device and test
if you are wanting to reto-fix existing documents then that becomes a bit more complex... I was trying to find the example for this that explained the process of doing this (came out around the same time they introduced the new file format). but basically the new office format documents are really just zip files containing XML files. styles.xml contains the document styles so this xml file could be pulled out of a document manually updated then write a PS script to loop through a document share etc, and open the file as an archive and inject this updated xml file.
hope that helps
Regards
Steve:)
- Jason275Copper Contributor
Hi Steve, this is exactly what I am looking for to be able to change Outlook's default font on all of our organisations devices. Would you be able to provide more details of the PS script so I can replicate this on our machines? Any help would be greatly appreciated. Thanks Jason
- Ashish_AryaBrass Contributor
Jason275: Jason I have been able to achieve this by replacing my custom Normal.dotm file (stored at the Azure blob) with the default Normal.dotm file located at %appdata%\Microsoft\Templates (the default location of word and Outlook templates).
Below are the steps that I took for changing fonts for Word and same can be tried for Outlook as well.
1. I pushed out a PS script (Schdtask) from Intune to create a scheduled task on all Intune devices.
2. This task will run another PS script(LogonScript) stored at the same Azure blob whenever there is a user login.
2. This LogonScript will first remove the default Normal.dotm file.
3. Then it will then connect to the same Azure blob and get our custom Normal.dotm file and place it under the same default template location.
I am sure this is not the best solution to go with but this can be tried if you have no other choice.
I will also be keen to get any other solution for this.
Regards,
Ashish Arya