Forum Discussion
PowerShell script to change font of office apps
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
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 } }- Jason275Nov 17, 2021Copper ContributorSteveMacNZ
Hi Steve, thank you so much for this! I can now successfully run the script and make the changes to the registry on all of the devices through MEM. Thanks again for all your help with this.