HTML Script For Company Wide Email Signatures

We are trying to roll out company wide email signatures for employees using an html script to be deployed via GPO or other means if easier.

We would like a simple script that pulls employee information for active directory: name, title, phone number, fax, company name, company confidentially agreement. possibly logo.

Our environment is a mix of Office 2010 and 2016, Exchange 2013, Server 2012 R2, and a mix of windows 7 and windows 10 machines.

Thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeTwo SoftwareSoftware DeveloperCommented:
Perhaps some third-party product would be better than constant deployment of email signatures (that are being changed from time to time). Please take a look at CodeTwo Exchange Rules product that works directly on Exchange and allows to add professional email signatures on the fly. It supports all kind of devices and its installation is very easy.

Also, the software is equipped with WYSIWYG HTML editor and allows to set different signatures for different departments.
Adam BrownSr Solutions ArchitectCommented: covers how to force signatures with a transport rule in Exchange. This is an effective way to make certain that signatures are appended to emails even if users don't have them set up in outlook. The caveat here is that you will get duplicate signatures if they aren't set up correctly, and the signature can end up appearing in weird places in replies.

Aside from that method, there are third party solutions for managing organizational signatures. CodeTwo has a good one here:

There's also a very complicated GPO-based method here:
RDCitAuthor Commented:
It will not be edited once in place.

The guidelines for the email signatures are as follows: FONT: Calibri, size 11 in black---both for new email and reply (no blue reply). No wallpaper background.

need the following items added in.

Name (bold)
title, Company name
work number, fax number
link to webpage.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

DonNetwork AdministratorCommented:
I have used the following vbs to create an html sig, you may need to edit

Set objUser = CreateObject("WScript.Network")
userName = objUser.UserName
domainName = objUser.UserDomain

Set ObjTrans = CreateObject("NameTranslate")
objTrans.init 1, DN
objTrans.set 3, DN & "\" & UN
strUserDN = objTrans.Get(1)
GetUserDN = strUserDN

Set objLDAPUser = GetObject("LDAP://" & GetUserDN(userName,domainName))

'Prepare to create some files
Dim strReply
Dim strNew
Dim objFSO, objWsh, appDataPath, pathToCopyTo, plainTextFile,plainTextFilePath, richTextFile, richTextFilePath, htmlFile, htmlFilePath, website
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWsh = CreateObject("WScript.Shell")
appDataPath = objWsh.ExpandEnvironmentStrings("%APPDATA%")
pathToCopyTo = appDataPath & "\Microsoft\Signatures\"
website = ""

' This section checks if the signature directory exists and if not creates one.
Dim objFS1
Set objFS1 = CreateObject("Scripting.FileSystemObject")
If (objFS1.FolderExists(pathToCopyTo)) Then
    Call objFS1.CreateFolder(pathToCopyTo)
End if

'Let's create the plain text signature
plainTextFilePath = pathToCopyTo & "Default.txt"
Set plainTextFile = objFSO.CreateTextFile(plainTextFilePath, TRUE)
plainTextFile.WriteLine("--------------------------- ")
plainTextFile.WriteLine("Telephone: " & objLDAPUser.telephoneNumber)
plainTextFile.WriteLine("Fax: " & objLDAPUser.facsimileTelephoneNumber)
plainTextFile.WriteLine("Email: " & objLDAPUser.mail)
plainTextFile.Write("Website: " & objLDAPUser.wWWHomePage)

'Now we create the Rich Text signature
richTextFilePath = pathToCopyTo & "Default.rtf"
Set richTextFile = objFSO.CreateTextFile(richTextFilePath, TRUE)
richTextFile.WriteLine("\viewkind4\uc1\pard\f0\fs20 ---------------------- \par")
richTextFile.WriteLine(objLDAPUser.DisplayName & "\par")
richTextFile.WriteLine(objLDAPUser.title & "\par")
richTextFile.WriteLine( & "\par")
richTextFile.WriteLine(objLDAPUser.streetAddress & "\par")
richTextFile.WriteLine(objLDAPUser.l & "\par")
richTextFile.WriteLine("Telephone: " & objLDAPUser.telephoneNumber & "\par")
richTextFile.WriteLine("Fax: " & objLDAPUser.facsimileTelephoneNumber & "\par")
richTextFile.WriteLine("Email: " & objLDAPUser.mail & "\par")
richTextFile.WriteLine("Website: " & objLDAPUser.wWWHomePage & "\par")

'And finally, the HTML signature
htmlFilePath = pathToCopyTo & "Default.htm"
Set htmlFile = objFSO.CreateTextFile(htmlFilePath, TRUE)
htmlfile.WriteLine("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0Transitional//EN"""""">")
htmlfile.WriteLine("<html xmlns="""" >")
htmlfile.WriteLine("<div style=""font-size:10pt;font-family:'Arial','helvetica';"">")
htmlfile.WriteLine("<div>____________________ </div>")
htmlfile.WriteLine("<div style='font-family:Arial;font-size:12pt;color:blue;font-weight:bold'>" & objLDAPUser.DisplayName & "</div>")
htmlfile.WriteLine("<div>" & objLDAPUser.title & "</div>")
htmlfile.WriteLine("<div>" & & "</div>")
htmlfile.WriteLine("<div>" & objLDAPUser.streetAddress & "</div>")
htmlfile.WriteLine("<div>" & objLDAPUser.l & "," & & " " & objLDAPUser.postalCode & "</div>")
htmlfile.WriteLine("<div>Telephone: " & objLDAPUser.telephoneNumber & "</div>")
htmlfile.WriteLine("<div>Fax: " & objLDAPUser.facsimileTelephoneNumber & "</div>")
htmlfile.WriteLine("<div>Cell: " & & "</div>")
htmlfile.WriteLine("<div>Email: <a href="" & objLDAPUser.mail & "">" &objLDAPUser.mail & "</a></div>")
htmlfile.WriteLine("<div>Website:<a href="""">" &website & "</a></div>")
htmlfile.WriteLine("		<br/>")
htmlfile.WriteLine("		<br/>")
htmlfile.WriteLine("		<br/>")
htmlfile.WriteLine("		<br/>")
htmlfile.WriteLine("<td><a href=><img src=file:///\\path\to\your\Logo.jpg></a></td>")
htmlfile.WriteLine("<div>This message (including any attachments) may contain confidential information and is intended only for the individual to which it is addressed. If you are not the intended recipient, please delete this message and contact the sender. You are also hereby notified that any review, disclosure, copying, or distribution of this message, or the taking of any action based on it, is prohibited. </div>")

Dim objShell, RegKey, RegKeyParm
Set objShell = CreateObject("WScript.Shell")
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General"
RegKey = RegKey & "\Signatures"
objShell.RegWrite RegKey , "Signatures"
UserDataPath = ObjShell.ExpandEnvironmentStrings("%appdata%")
FolderLocation = UserDataPath &"\Microsoft\Signatures\"
HTMFileString = FolderLocation & "Default.htm"
' This section disables the change of the signature by the user.
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\MailSettings\NewSignature" , "Default"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\MailSettings\ReplySignature" , "Default"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail\EditorPreference" , "131073" , "REG_DWORD"

objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\NewSignature" , "Default"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\ReplySignature" , "Default"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\EditorPreference" , "131072" , "REG_DWORD"

'Set default signature to new mail and none for replies and forwards
strReply = Array(68,0,101,0,102,0,97,0,117,0,108,0,116,0,0,0)
strNew = Array(68,0,101,0,102,0,97,0,117,0,108,0,116,0,0,0)


    const HKEY_CURRENT_USER = &H80000001
    strComputer = "."
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
        strComputer & "\root\default:StdRegProv")
    strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000004"

            strValueName = "Reply-Forward Signature"
            oReg.SetBinaryValue HKEY_CURRENT_USER,strKeyPath & "\" & subkey, strValueName,strValue
            strValueName = "New Signature"
            oReg.SetBinaryValue HKEY_CURRENT_USER,strKeyPath & "\" & subkey, strValueName,strValue


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RDCitAuthor Commented:
Hey Donald,

I tried to edit this script to what I need.
how did you execute the script? Using gpo?
DonNetwork AdministratorCommented:
Thru ADUC under users profile tab --> logon script. To do this to multiple users at once you can highlight them all --> Right Click--> Properties--> Profile tab--> Logon Script.
DonNetwork AdministratorCommented:
Side note: Be sure that the logo if used is accessible to external users. I ran into issues where email was getting flagged as spam because of a link within the email pointed to a location that couldn't be reached.
RDCitAuthor Commented:
We want a very basic signature, maybe add one photo later during the holidays....

I have created some HTML code I want to use (below) that works when doing transport rules in ECP, but it is very limited in formatting and never shows in the body of the most recent message.

I would like to use this code as you are suggesting in a script but not sure how or if this will link to ADUC and pull the information that I want.

*Forgive me, my coding background is very very limited.

'' works for transport rule in ECP''

<div style="font-size:11pt;  font-family: 'Calibri',sans-serif;">
%%title%% , %%company%%</br>
%%street%%, %%city%%, %%state%% %%zipcode%%</br>
Phone: %%Phone%% , Fax: %%Fax%%</br>
DonNetwork AdministratorCommented:
The script does pull all the info you mentioned and creates three files to be used for signature: Plain txt, rich text, and html

Name (bold)
 title, Company name
 work number, fax number
 link to webpage.
RDCitAuthor Commented:
Okay good,

So do I need to add anything else to it before I link it to a gpo? I feel like I need extra parameters in order for exchange to pull this information out of ADUC as an email signature.
DonNetwork AdministratorCommented:
Sorry, I didn't create/write the script. I just edited to my liking. I would just test it on yourself and see how it looks.

For example from the script

plainTextFile.WriteLine(objLDAPUser.DisplayName)  ---->Pulls "Display Name" from general tab of users AD properties
plainTextFile.WriteLine(objLDAPUser.title)                   ---->Pulls "Job Title" from the organization tab
plainTextFile.WriteLine(         ---->Pulls "Company" from the organization tab
plainTextFile.WriteLine(objLDAPUser.streetAddress) ---->Pulls "Street" from the Address tab on
DonNetwork AdministratorCommented:
When I was editing I just looked up items as follows
RDCitAuthor Commented:
I got some code working as a VB script, it has everything that need in it. but is there a way to render vbs as html or convert vbs to html?
DonNetwork AdministratorCommented:
I'm not sure I'm following you. When you run the vbs provided it creates the signatures for you with data it pulls from AD. Did you try it ??
RDCitAuthor Commented:
Yes that is correct. I have it working as I want now, a vbscript that is pushed out via gpo. however it is showing as plain text, how I do I write it in html
DonNetwork AdministratorCommented:
It should be writing it in all 3 formats. Look in the folder

DonNetwork AdministratorCommented:
There should be a default.html, default.rtf, and a default.txt
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

-- Donald Stewart (https:#a42356539)
-- CodeTwo Software (https:#a42354107)
-- Adam Brown (https:#a42354113)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.