How to change the MS Word font type and size using PowerShell ?

0

Hi All,
I’ve got the below PowerShell script for setting the default Outlook email signature: https://github.com/a118n/poweradmin/blob/master/Set-Outlook-Signature/Set-Outlook-Signature.ps1
Now I wonder what’s the command to set the font to be “Courier New” rather than the default Calibri font?

I have already got the MS Word document template created by the designer in the shared folder and saved with all font as Courier New, but still failed to change the font type from the default Calibri as per Normal.Dot file.

$MSWord = New-Object -com word.application $MSWord.Documents.Open("$LocalSignaturePath\$SignatureName.docx") $MSWord.Documents.Selection.Font.Name = 'Courier New'

And I have tried the below combination as well:

$MSWord.ActiveDocument.FontName = 'Courier New' $MSWord.ActiveDocument.Range.Font.Name = 'Courier New' $MSWord.ActiveDocument.Selection.Font.Name = 'Courier New' $MSWord.ActiveDocument.Text.Selection.Font= 'Courier New' $MSWord.ActiveDocument.Text.Selection.Font.Name = 'Courier New' $MSWord.ActiveDocument.Selection.Range.Font.Name = 'Courier New' $MSWord.ActiveDocument.Selection.Text.Font.Name = 'Courier New'

But it does not recognize the “Name” as the property.

Any help would be greatly appreciated.

https://social.technet.microsoft.com/Forums/en-US/f962a66e-a80b-4a1c-9dcc-31719a1e75a0/powershell-command-or-line-to-set-the-default-font-for-ms-word-?forum=winserverpowershell

Hi Olaf, that did not work.
Hence it is posted here.