Set Automatic Individual Corporate Outlook Web App (OWA) Signatures in Exchange Online / Office 365 with PowerShell
An e-mail signature is part of your corporate branding. Having a professional, uniform e-mail signature across your organization increases recognizability, allows clients to quickly find contact information and allows your business to use it as a spot for advertising.
Requesting employees in a large organization to create and design similar signatures is nearly impossible. Check out this crazy before-picture of the situation in our health care organization. Complete with blue handwriting fonts and Comic Sans. Lovely. Fortunately there are software tools available, such as RES Workspace Manager, to set a default, corporate signature in Outlook, but these tools only support the full version of Outlook. As businesses are moving to the cloud, more and more applications, including Outlook, will be offered web-based only.
Automatic e-mail signature in Outlook 2013 generated by RES Workspace Manager |
The larger part of our employees are kiosk users, who have access to Outlook Web App (OWA) only, as a component of Office 365. We would still like to prevent a signature mess like before and preconfigure uniform, corporate signatures.
PowerShell to the rescue! With PowerShell you can connect to Exchange Online using an administrative or service account and set OWA signatures. I've written a script that sets a template signature for everybody and also inputs their individual contact information by replacing specific variables in the HTML code, such as %DisplayName%, %Title%, %Phone% and so on, with the values from the appropriate Active Directory User Attributes.
Note: by design this script only sets automated signatures for users who have never set a signature before or who have cleared their signature. See "Final Remarks" for other options.
Instructions
- Download and extract SetOWASignatures.zip. Here's a link to view the code.
- Open SetOWASignatures.ps1 and replace "admin@<company>.onmicrosoft.com" with your Office 365/Exchange Online admin account.
- Securely save your password in an encrypted format in Password.txt in the root directory of the script. This is required to run the script without user interaction. You can use the following PowerShell command to generate the Password file:Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File "<path to root of script>\Password.txt"Verify that your directory security is set up correctly.
- Modify Signature.html to reflect your brand. The variables %DisplayName%, %Title%, %Phone% and so on, will be automatically replaced by the script with the appropriate Active Directory User Attributes.
- Run the script (it will not modify existing signatures as only unset or cleared signatures will be set).
Automatic email signature in Outlook Web App (OWA) in Office 365. |
(Optional) Schedule the script to run periodically
You can schedule this script using Task Scheduler to run periodically on any Windows Server in your infrastructure. This way new users and users who have cleared their signature will automatically receive the preconfigured company signature.Final Remarks
- If you want to use images, such as logo's, in your signature, use absolute URL's which are publically accessible.
- Minor alternations to the Where-Object block of the script can change the way it functions. E.g.: reset all user signatures, even those already set previously, or set signatures in which users entered a specific string, such as <insert_signature>, and so on. If you would like to extend or modify the functionality of the script in such a manner but don't know how, please don't hesitate to leave a comment.
This comment has been removed by the author.
ReplyDeleteTo perform the action on a single mailbox replace line 20 from
Delete$MailBoxMessageConfigurationsWithoutSignature = Get-Mailbox -RecipientTypeDetails UserMailbox | Get-MailboxMessageConfiguration | Where-Object { (!($_.SignatureText)) -or $_.SignatureText -eq "`r`n" }
to
$MailBoxMessageConfigurationsWithoutSignature = Get-Mailbox -Identity "mailbox@domain.com" | Get-MailboxMessageConfiguration
Dave
ReplyDeleteHow do you roll this process back? Just in case something goes wrong...or is misspelled... Or the organization changes their mind.
How you force everyone's signature to update regardless of it they have an address input or not?
Will this be the same process for an on premise server?
Will this create a duplicate signature line if the user has a signature set with the outlook client?
By design this script only overwrites empty signatures, so no real information is lost and therefore no roll-back is included. However, read below for an suggestion on how to do this.
DeleteIf you wish to perform the action on all mailbox signatures simply remove
| Where-Object { (!($_.SignatureText)) -or $_.SignatureText -eq "`r`n" }
from the line
$MailBoxMessageConfigurationsWithoutSignature = Get-Mailbox -RecipientTypeDetails UserMailbox | Get-MailboxMessageConfiguration | Where-Object { (!($_.SignatureText)) -or $_.SignatureText -eq "`r`n" }
leaving it like this
$MailBoxMessageConfigurationsWithoutSignature = Get-Mailbox -RecipientTypeDetails UserMailbox | Get-MailboxMessageConfiguration
If you run this in an active production environment, I understand you might want a back-up of all current signatures.
You could run the following code to back-up all HTML and text signatures to files with a file name equal to the user's e-mail address. This allows you to easily restore signatures by reading the files and (re)setting the signature on the right mailbox based on the file name.
$MailBoxMessageConfigurations = Get-Mailbox -RecipientTypeDetails UserMailbox | Get-MailboxMessageConfiguration
ForEach ($MailBoxMessageConfiguration in $MailBoxMessageConfigurations) {
$user = Get-User ($MailBoxMessageConfiguration.Identity)
$MailBoxMessageConfiguration.SignatureHtml | Out-File ($ScriptRoot + "\" + $user.WindowsEmailAddress + ".html")
$MailBoxMessageConfiguration.SignatureText | Out-File ($ScriptRoot + "\" + $user.WindowsEmailAddress + ".txt")
}
As to your question regarding running this process on an on-premises Exchange server. I have not tested this, but I believe this process would run perfectly fine on-premises.
In that case replace "https://outlook.office365.com/powershell-liveid/" with "http://[FQDN of Exchange 2013 Client Access server]/PowerShell/".
This script will only modify HTML e-mail signatures set in Outlook Web App. It will not interfere with e-mail signatures that have been set using the full Outlook client since those e-mail signatures are stored separately in the user profile and not on the Exchange server.
Great article, thanks. One question, is there a way to force Outlook to use a signature from OWA?
ReplyDeleteI'm afraid not. The signature for Outlook (client) is stored in the user profile on the pc.
DeleteThis data includes the registry and file path: %APPDATA%\Microsoft\Signatures
Third-party user profile management software, such as RES Workspace Manager, does allow you to manage this type of signature.
Very good tutorial. Congratulations.
ReplyDeleteDave, We are an organisation that uses OWA , and have got Signature Images , but also made a HTML version too. The Problem is we all use Mac Books, So would need assistance to get it sorted, Any thing on this will be highly appreciated
ReplyDeleteThese instructions are all server-side (Exchange) so it doesn't matter what kind of clients you use. The HTML signature in OWA in a browser on a MacBook should work fine.
DeleteHello Dave,
ReplyDeleteThanks for making this tutorial!
Could you help me with the following modification:
I want to execute the script only for users where the attributed 'title' is filled.
How would I do this?
The command "Set-MailboxMessageConfiguration" including all the "-replace" statements can be put inside an:
DeleteIf ($user.Title) {
// Set-MailboxMessageConfiguration part here
}
Great!
DeleteThanks for your quick reply
Thank you!! This worked beautifully!
ReplyDeleteDo you happen to know if there is a way to force the OWA mobile app to use this html signature?
Also, is there anyway to do this for Outlook? If a third party service can access all of the users signatures then there has to be away for admins too.... well, that would make sense. :)
Thanks again!
Agree! Need that too
DeleteHi Dave,
ReplyDeleteand how could I do to force signatures for users in a dedicated OU in my AD, and not for all my users?
Regards
This comment has been removed by the author.
DeleteThis also something I am interested in. And also, how i can run this on all my users. And not just them who haven't set it yet.
DeleteHello, I've been using your script and its working fine. But, my question is how to modify the script such that it checks the option for "automatically include my signature on message I forward or reply to"
ReplyDelete