Setting email signatures for every user with PowerShell
How to set Outlook signatures for every Microsoft 365 user with Set-MailboxMessageConfiguration, why roaming signatures block it, and which apps it reaches.
5 minute readBy the Geco Signatures team
Connect to Exchange Online PowerShell, turn off roaming signatures with Set-OrganizationConfig -PostponeRoamingSignaturesUntilLater $true, then loop over your mailboxes and run Set-MailboxMessageConfiguration with -SignatureHtml, -AutoAddSignature $true and -AutoAddSignatureOnReply $true for each person. That sets the signature in Outlook on the web and new Outlook for Windows.
It doesn’t reach classic Outlook for Windows, Outlook for Mac or the Outlook mobile apps. Microsoft’s own documentation says these settings are applied in Outlook on the web only, with some also used by new Outlook. Below is a complete script, how to check it worked, and what to do about the other apps.
On this page (8)
What Set-MailboxMessageConfiguration changes
Set-MailboxMessageConfiguration stores mail settings on the mailbox itself. The signature parameters you need are documented by Microsoft as follows.
- SignatureHtml. The signature used in HTML messages. Plain text or HTML tags are allowed, and any JavaScript is removed.
- SignatureText. The signature used in plain-text messages.
- AutoAddSignature. $true adds the signature to new messages automatically.
- AutoAddSignatureOnReply. $true adds the signature to replies automatically.
The cmdlet also lists SignatureName, DefaultSignature, DefaultSignatureOnReply and DeleteSignatureName for Exchange Online, but Microsoft hasn’t published descriptions for them yet. The script below sticks to the documented parameters.
Turn off roaming signatures first
Roaming signatures store signatures in the mailbox so they follow people between devices. While roaming signatures are on, which is the default, SignatureHtml, SignatureText and AutoAddSignature have no effect. Microsoft’s documentation for the cmdlet says so on each of those parameters.
You can turn roaming signatures off for Outlook on the web and new Outlook for the whole tenant. You need the Exchange administrator or Global Administrator role.
Connect-ExchangeOnline -UserPrincipalName admin@michaelscottpaper.com
Set-OrganizationConfig -PostponeRoamingSignaturesUntilLater $true
Get-OrganizationConfig | Format-List PostponeRoamingSignaturesUntilLaterClassic Outlook for Windows has its own switch. Microsoft documents a DisableRoamingSignatures registry value (a DWORD set to 1 under HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Setup, or the matching Group Policy path). That only changes how classic Outlook stores signatures. It doesn’t let PowerShell set them.
How to set a signature for every mailbox
Keep the design in an HTML file with placeholders, and let the script fill them from each person’s directory details. Save this as C:\Signatures\template.html.
<div style="font-family:Arial,sans-serif;font-size:13px;color:#333333;">
<strong>{DisplayName}</strong><br>
{TitleLine}
{PhoneLine}
{MobileLine}
<a href="https://www.michaelscottpaper.com">michaelscottpaper.com</a>
</div>The script reads every user mailbox, looks up the person with Get-User, and only adds a line when the field has a value. That way nobody ends up with an empty “M:” line.
Connect-ExchangeOnline -UserPrincipalName admin@michaelscottpaper.com
$template = Get-Content -Path "C:\Signatures\template.html" -Raw
$mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited
foreach ($mbx in $mailboxes) {
$user = Get-User -Identity $mbx.UserPrincipalName
$titleLine = ""
$phoneLine = ""
$mobileLine = ""
if ($user.Title) { $titleLine = "$($user.Title)<br>" }
if ($user.Phone) { $phoneLine = "T: $($user.Phone)<br>" }
if ($user.MobilePhone) { $mobileLine = "M: $($user.MobilePhone)<br>" }
$html = $template.Replace("{DisplayName}", $user.DisplayName)
$html = $html.Replace("{TitleLine}", $titleLine)
$html = $html.Replace("{PhoneLine}", $phoneLine)
$html = $html.Replace("{MobileLine}", $mobileLine)
Set-MailboxMessageConfiguration -Identity $mbx.UserPrincipalName `
-SignatureHtml $html `
-AutoAddSignature $true `
-AutoAddSignatureOnReply $true
Write-Host "Signature set for $($mbx.UserPrincipalName)"
}Run it against one test mailbox first. Swap the Get-Mailbox line for Get-Mailbox -Identity dwight.schrute@michaelscottpaper.com, check the result, then run it for everyone.
How to check the signature was applied
Read the settings back for one person:
Get-MailboxMessageConfiguration -Identity pam.beesly@michaelscottpaper.com |
Format-List SignatureHtml,AutoAddSignature,AutoAddSignatureOnReplyThen ask that person to open a new message in Outlook on the web or new Outlook. If the setting reads back correctly but the signature doesn’t appear, check PostponeRoamingSignaturesUntilLater is $true and give the change some time to reach their session.
To stop adding signatures for someone, run Set-MailboxMessageConfiguration for that mailbox with -AutoAddSignature $false and -AutoAddSignatureOnReply $false.
Signatures for classic Outlook, Mac and mobile
Set-MailboxMessageConfiguration doesn’t reach these apps, so each needs its own approach.
- Classic Outlook for Windows. Signatures are set in the app under File > Options > Mail > Signatures. Some IT teams deploy signature files to each PC with a logon script or device management, which means writing and maintaining a second script.
- Outlook for Mac. Signatures are set in the app itself. There’s no Exchange setting that pushes one there.
- Outlook for iOS and Android. People set a simple text signature under Settings > Mail > Signature.
If you need the same signature everywhere without touching each device, a server-side approach such as an Exchange mail flow rule covers every app, with its own limits.
Where a PowerShell script falls short
For a company that lives in Outlook on the web and new Outlook, this script is a good free option. It puts a consistent signature in front of people while they write, and you can rerun it whenever details change.
The weak points come with scale and time. It only covers two apps, so anyone on classic Outlook, a Mac or a phone sends something different. It depends on turning off roaming signatures for the whole tenant. A signature is a snapshot, so when Pam changes job or Dwight gets a new mobile number, nothing updates until someone reruns the script, and new starters get nothing until then. People can also edit or delete the signature in their own settings. Most teams end up scheduling the script, and then looking after that schedule.
A managed alternative
Geco Signatures adds signatures on the server as mail leaves Microsoft 365, so there’s no script to run and nothing to set in each app. Details come from Entra ID through a directory sync, so when a job title or phone number changes the signature follows without anyone rerunning anything. It covers classic and new Outlook, Mac, the web, mobile and shared mailboxes. An optional Outlook add-in shows the signature while people write. Pricing is per user per month with a free trial.
Questions people ask
Does Set-MailboxMessageConfiguration work with roaming signatures?
No. Microsoft documents that SignatureHtml, SignatureText and AutoAddSignature don’t work while roaming signatures are enabled. Run Set-OrganizationConfig -PostponeRoamingSignaturesUntilLater $true to turn roaming off for Outlook on the web and new Outlook.
Can PowerShell set the signature in classic Outlook?
Not through Exchange Online. Set-MailboxMessageConfiguration only applies to Outlook on the web and, for some settings, new Outlook. Classic Outlook keeps its own signatures on each PC.
Which permissions do I need to set signatures with PowerShell?
An account with the Exchange administrator or Global Administrator role can run Set-MailboxMessageConfiguration and Set-OrganizationConfig after connecting with Connect-ExchangeOnline.
Will the PowerShell signature update when someone’s job title changes?
No. The script writes fixed HTML into each mailbox. You have to run it again after any change to pick up the new details.