Forum Discussion
PowerShell script to change font of office apps
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
Pulling from Azure Blob is a good idea - just make sure that you include the detection so it only downloads the file from Blob if it is changed
- Jason275Nov 12, 2021Copper Contributor
I must admit Ashish_Arya I'm not really sure how to achieve this through your suggestion as I'm quite new to this.
SteveMacNZI like the sound of your option but not sure where to find the default profile in the registry, I can only see the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\MailSettings. Any further help would be greatly appreciated. Thanks Jason- Jason275Nov 15, 2021Copper ContributorThis is my script, it works when I run it locally but won't deploy when I roll it out through Intune:
cd HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\MailSettings
Get-Item -path ./
Set-ItemProperty -path ./ -Name ‘NewTheme’ -Value ('')
Set-ItemProperty -path ./ -Name ‘MarkCommentsWith’ -Value ([byte[]](0x00,0x00))
Set-ItemProperty -path ./ -Name ‘ComposeFontComplex’ -Value ([byte[]](0x3c,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a,0x0d,0x0a,0x3c,0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x3c,0x73,0x74,0x79,0x6c,0x65,0x3e,0x0d,0x0a,0x0d,0x0a,0x20,0x2f,0x2a,0x20,0x53,0x74,0x79,0x6c,0x65,0x20,0x44,0x65,0x66,0x69,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x73,0x20,0x2a,0x2f,0x0d,0x0a,0x20,0x73,0x70,0x61,0x6e,0x2e,0x50,0x65,0x72,0x73,0x6f,0x6e,0x61,0x6c,0x43,0x6f,0x6d,0x70,0x6f,0x73,0x65,0x53,0x74,0x79,0x6c,0x65,0x0d,0x0a,0x09,0x7b,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x6e,0x61,0x6d,0x65,0x3a,0x22,0x50,0x65,0x72,0x73,0x6f,0x6e,0x61,0x6c,0x20,0x43,0x6f,0x6d,0x70,0x6f,0x73,0x65,0x20,0x53,0x74,0x79,0x6c,0x65,0x22,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x74,0x79,0x70,0x65,0x3a,0x70,0x65,0x72,0x73,0x6f,0x6e,0x61,0x6c,0x2d,0x63,0x6f,0x6d,0x70,0x6f,0x73,0x65,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x6e,0x6f,0x73,0x68,0x6f,0x77,0x3a,0x79,0x65,0x73,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x75,0x6e,0x68,0x69,0x64,0x65,0x3a,0x6e,0x6f,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x61,0x6e,0x73,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x31,0x30,0x2e,0x30,0x70,0x74,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x31,0x31,0x2e,0x30,0x70,0x74,0x3b,0x0d,0x0a,0x09,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x22,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x22,0x2c,0x73,0x61,0x6e,0x73,0x2d,0x73,0x65,0x72,0x69,0x66,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x61,0x73,0x63,0x69,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x68,0x61,0x6e,0x73,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x22,0x54,0x69,0x6d,0x65,0x73,0x20,0x4e,0x65,0x77,0x20,0x52,0x6f,0x6d,0x61,0x6e,0x22,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x74,0x68,0x65,0x6d,0x65,0x2d,0x66,0x6f,0x6e,0x74,0x3a,0x6d,0x69,0x6e,0x6f,0x72,0x2d,0x62,0x69,0x64,0x69,0x3b,0x0d,0x0a,0x09,0x63,0x6f,0x6c,0x6f,0x72,0x3a,0x77,0x69,0x6e,0x64,0x6f,0x77,0x74,0x65,0x78,0x74,0x3b,0x7d,0x0d,0x0a,0x2d,0x2d,0x3e,0x0d,0x0a,0x3c,0x2f,0x73,0x74,0x79,0x6c,0x65,0x3e,0x0d,0x0a,0x3c,0x2f,0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x0d,0x0a,0x3c,0x2f,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a))
Set-ItemProperty -path ./ -Name ‘ComposeFontSimple’ -Value ([byte[]](0x3c,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00,0x00,0x40,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x22,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00))
Set-ItemProperty -path ./ -Name ‘ReplyFontComplex’ -Value ([byte[]](0x3c,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a,0x0d,0x0a,0x3c,0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x3c,0x73,0x74,0x79,0x6c,0x65,0x3e,0x0d,0x0a,0x0d,0x0a,0x20,0x2f,0x2a,0x20,0x53,0x74,0x79,0x6c,0x65,0x20,0x44,0x65,0x66,0x69,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x73,0x20,0x2a,0x2f,0x0d,0x0a,0x20,0x73,0x70,0x61,0x6e,0x2e,0x50,0x65,0x72,0x73,0x6f,0x6e,0x61,0x6c,0x52,0x65,0x70,0x6c,0x79,0x53,0x74,0x79,0x6c,0x65,0x0d,0x0a,0x09,0x7b,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x6e,0x61,0x6d,0x65,0x3a,0x22,0x50,0x65,0x72,0x73,0x6f,0x6e,0x61,0x6c,0x20,0x52,0x65,0x70,0x6c,0x79,0x20,0x53,0x74,0x79,0x6c,0x65,0x22,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x74,0x79,0x70,0x65,0x3a,0x70,0x65,0x72,0x73,0x6f,0x6e,0x61,0x6c,0x2d,0x72,0x65,0x70,0x6c,0x79,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x6e,0x6f,0x73,0x68,0x6f,0x77,0x3a,0x79,0x65,0x73,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x75,0x6e,0x68,0x69,0x64,0x65,0x3a,0x6e,0x6f,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x61,0x6e,0x73,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x31,0x30,0x2e,0x30,0x70,0x74,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x31,0x31,0x2e,0x30,0x70,0x74,0x3b,0x0d,0x0a,0x09,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x22,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x22,0x2c,0x73,0x61,0x6e,0x73,0x2d,0x73,0x65,0x72,0x69,0x66,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x61,0x73,0x63,0x69,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x68,0x61,0x6e,0x73,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x22,0x54,0x69,0x6d,0x65,0x73,0x20,0x4e,0x65,0x77,0x20,0x52,0x6f,0x6d,0x61,0x6e,0x22,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x74,0x68,0x65,0x6d,0x65,0x2d,0x66,0x6f,0x6e,0x74,0x3a,0x6d,0x69,0x6e,0x6f,0x72,0x2d,0x62,0x69,0x64,0x69,0x3b,0x0d,0x0a,0x09,0x63,0x6f,0x6c,0x6f,0x72,0x3a,0x77,0x69,0x6e,0x64,0x6f,0x77,0x74,0x65,0x78,0x74,0x3b,0x7d,0x0d,0x0a,0x2d,0x2d,0x3e,0x0d,0x0a,0x3c,0x2f,0x73,0x74,0x79,0x6c,0x65,0x3e,0x0d,0x0a,0x3c,0x2f,0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x0d,0x0a,0x3c,0x2f,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a))
Set-ItemProperty -path ./ -Name ‘ReplyFontSimple’ -Value ([byte[]](0x3c,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00,0x00,0x40,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x22,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00))
Set-ItemProperty -path ./ -Name ‘TextFontComplex’ -Value ([byte[]](0x3c,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a,0x0d,0x0a,0x3c,0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x3c,0x73,0x74,0x79,0x6c,0x65,0x3e,0x0d,0x0a,0x0d,0x0a,0x20,0x2f,0x2a,0x20,0x53,0x74,0x79,0x6c,0x65,0x20,0x44,0x65,0x66,0x69,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x73,0x20,0x2a,0x2f,0x0d,0x0a,0x20,0x70,0x2e,0x4d,0x73,0x6f,0x50,0x6c,0x61,0x69,0x6e,0x54,0x65,0x78,0x74,0x2c,0x20,0x6c,0x69,0x2e,0x4d,0x73,0x6f,0x50,0x6c,0x61,0x69,0x6e,0x54,0x65,0x78,0x74,0x2c,0x20,0x64,0x69,0x76,0x2e,0x4d,0x73,0x6f,0x50,0x6c,0x61,0x69,0x6e,0x54,0x65,0x78,0x74,0x0d,0x0a,0x09,0x7b,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x6e,0x6f,0x73,0x68,0x6f,0x77,0x3a,0x79,0x65,0x73,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79,0x3a,0x39,0x39,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x73,0x74,0x79,0x6c,0x65,0x2d,0x6c,0x69,0x6e,0x6b,0x3a,0x22,0x50,0x6c,0x61,0x69,0x6e,0x20,0x54,0x65,0x78,0x74,0x20,0x43,0x68,0x61,0x72,0x22,0x3b,0x0d,0x0a,0x09,0x6d,0x61,0x72,0x67,0x69,0x6e,0x3a,0x30,0x63,0x6d,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x70,0x61,0x67,0x69,0x6e,0x61,0x74,0x69,0x6f,0x6e,0x3a,0x77,0x69,0x64,0x6f,0x77,0x2d,0x6f,0x72,0x70,0x68,0x61,0x6e,0x3b,0x0d,0x0a,0x09,0x66,0x6f,0x6e,0x74,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x31,0x30,0x2e,0x30,0x70,0x74,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x31,0x30,0x2e,0x35,0x70,0x74,0x3b,0x0d,0x0a,0x09,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x22,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x22,0x2c,0x73,0x61,0x6e,0x73,0x2d,0x73,0x65,0x72,0x69,0x66,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x66,0x61,0x72,0x65,0x61,0x73,0x74,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x43,0x61,0x6c,0x69,0x62,0x72,0x69,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x66,0x61,0x72,0x65,0x61,0x73,0x74,0x2d,0x74,0x68,0x65,0x6d,0x65,0x2d,0x66,0x6f,0x6e,0x74,0x3a,0x6d,0x69,0x6e,0x6f,0x72,0x2d,0x6c,0x61,0x74,0x69,0x6e,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x66,0x6f,0x6e,0x74,0x2d,0x66,0x61,0x6d,0x69,0x6c,0x79,0x3a,0x22,0x54,0x69,0x6d,0x65,0x73,0x20,0x4e,0x65,0x77,0x20,0x52,0x6f,0x6d,0x61,0x6e,0x22,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x62,0x69,0x64,0x69,0x2d,0x74,0x68,0x65,0x6d,0x65,0x2d,0x66,0x6f,0x6e,0x74,0x3a,0x6d,0x69,0x6e,0x6f,0x72,0x2d,0x62,0x69,0x64,0x69,0x3b,0x0d,0x0a,0x09,0x6d,0x73,0x6f,0x2d,0x66,0x61,0x72,0x65,0x61,0x73,0x74,0x2d,0x6c,0x61,0x6e,0x67,0x75,0x61,0x67,0x65,0x3a,0x45,0x4e,0x2d,0x55,0x53,0x3b,0x7d,0x0d,0x0a,0x2d,0x2d,0x3e,0x0d,0x0a,0x3c,0x2f,0x73,0x74,0x79,0x6c,0x65,0x3e,0x0d,0x0a,0x3c,0x2f,0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x0d,0x0a,0x3c,0x2f,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a))
Set-ItemProperty -path ./ -Name ‘TextFontSimple’ -Value ([byte[]](0x3c,0x00,0x00,0x00,0x1f,0x00,0x00,0xf8,0x00,0x00,0x00,0x40,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x22,0x56,0x65,0x72,0x64,0x61,0x6e,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00))- SteveMacNZNov 16, 2021Iron Contributor
Hi Jason - sorry about the slow reply - been tied up on projects.
When deploying registry settings via MEM (Intune) as a win32app the registry values are actually written to the WOW6432Node - as the win32apps scripts are run in 32bit PowerShell not in the native 64 bit.
Use this code below in the script to relaunch the script in a 64 bit console. Note: the SysNative path only exist when the 32bit session is running 🙂
# If we are running as a 32-bit process on an x64 system, re-launch as a 64-bit process if ("$env:PROCESSOR_ARCHITEW6432" -ne "ARM64") { if (Test-Path "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe") { & "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy bypass -File "$PSCommandPath" Exit $lastexitcode } }