Forum Discussion
PowerShell script to change font of office apps
Jason275 SteveMacNZ I also like to have Arial 10 on all 3 but i can't seem to find the right bits/ How did you got the code for the font? Could you please advice?
Hi Aaron - you might find it easier to follow my original solution where you edit the existing Normal.dotm and NormalEmail.dotm files and make your changes and save the updated files to a new location. the Templates are located under %Appdata%\Microsoft\Templates and you right click on the .dotm file and select "open" not the default "new" - new will create a copy of the template as a new document - where open opens the actual template.
then the script to actually copy the files is simple compared to setting via registry
(there was a typo in the original where i used Normal.dotx - which i have corrected below and expanded out with creating a detection file)
# Variables
$Script:dest = "$($env:ProgramData)\MEM\OfficeTemplates"
$Script:GUID = 'GUID using New-Guid'
# Test and create paths and detection .tag file for MEM detection
if (-not (Test-Path $Script:dest)){
New-Item -Path $Script:dest -ItemType Directory
}
if (-not (Test-Path "$Script:dest\OffTemp.tag")){
Set-Content -Path "$Script:dest\OffTemp.tag" -Value "$Script:GUID"
}
# Copy the Templates to the local device
copy-item -path .\Normal.dotm -destination $env:Appdata\Microsoft\Templates -force
copy-item -path .\NormalEmail.dotm -destination $env:Appdata\Microsoft\Templates -forceI also write a transcription log to the destination folder as well so you can see what is going on (these just a subset of the script logic I use. Feel free to grab a copy of the PowerShell template from my GitHub if you like https://github.com/SteveMacNZ/PowerShell_Templates/tree/main/Templates
- Aaron89Aug 22, 2023Copper ContributorHow did you do it?
- Pallav1011Feb 14, 2023Copper Contributor
Aaron89, I have managed to change the default font for Outlook.
Is there any way if I can change the default font for Word and Powerpoint too?
- Ashish_AryaJan 24, 2022Brass Contributor
Jason275 : Can you please add the full code here. I would prefer in text format instead of an image.
Thanks.
- Jason275Jan 19, 2022Copper Contributor
Hi Aron,
The script below will work. First you need to go to Outlook on your local device and set the default font to Arial 10, this will set the values in the registry. Then go to the registry and copy the values from HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\MailSettings and replace the ones I have used in the example below. I have also included the write-output "Script worked" | out-file c:\Scripts\output.txt so you can see if the script has worked. This should give you what you need.
- Aaron89Jan 19, 2022Copper Contributor
SteveMacNZ Hi Steven, thank you for the reply!
The document templates are already fixed. The only thing we want to change is the Outlook email font. Jason fixed it with his script, and i can deploy it as a intunewin package, but i can't find the right code for Arial and 10 size.
I checked it, but your script doens't work for the default font in Outlook. Atleast not for me 😞
Regards Aaron