This is a question I’ve seen pop up a lot which can be achieved multiple ways. If you are looking for a fully fledged signature manager I would recommend something like CodeTwo’s ExchangeRules, you can trial this without paying if you don’t mind an advert being appended to your email, otherwise their prices are pretty reasonable.

Anyway, today we will look at the free way! There are 3 parts to achieving the goal.

1. VBS script to generate signature

This creates a very simple signature which pulls attributes from active directory.

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

FUNCTION GetUserDN(BYVAL UN, BYVAL DN)
Set ObjTrans = CreateObject(“NameTranslate”)
objTrans.init 1, DN
objTrans.set 3, DN & “\” & UN
strUserDN = objTrans.Get(1)
GetUserDN = strUserDN
END FUNCTION

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

‘Getting prepared to write the files
Dim objFSO, objWsh, appDataPath, pathToCopyTo, plainTextFile, plainTextFilePath, htmlFile, htmlFilePath
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objWsh = CreateObject(“WScript.Shell”)
appDataPath = objWsh.ExpandEnvironmentStrings(“%APPDATA%”)
pathToCopyTo = appDataPath & “\Microsoft\Signatures\”

‘Plain text signature – signature.txt
plainTextFilePath = pathToCopyTo & “Signature.txt”
Set plainTextFile = objFSO.CreateTextFile(plainTextFilePath, TRUE)
plainTextFile.WriteLine(objLDAPUser.DisplayName)
plainTextFile.WriteLine(objLDAPUser.Description)
plainTextFile.WriteLine(objLDAPUser.telephoneNumber)
plainTextFile.WriteLine(“________________________________”)
plainTextFile.Close

‘HTML signature – signature.htm
htmlFilePath = pathToCopyTo & “signature.htm”
Set htmlFile = objFSO.CreateTextFile(htmlFilePath, TRUE)
htmlfile.WriteLine(“<body>”)
htmlfile.WriteLine(“<font face=””Arial”” COLOR=””#424242″” size=””2″”>”)
htmlfile.WriteLine(“<div><strong>” & objLDAPUser.DisplayName & “</strong></div>”)
htmlfile.WriteLine(“<div><strong>” & objLDAPUser.description & “</strong></div>”)
htmlfile.WriteLine(“<html>”)
htmlfile.WriteLine(“<font face=””Arial”” COLOR=””#424242″” size=””2″”>”)
htmlfile.WriteLine(“<div><strong> Email: <a href=mailto:” & objLDAPUser.mail &”><span style=’color:#008C98’>” & objLDAPUser.mail & “</span></a></trong></div>”)
htmlfile.WriteLine(“<div><strong>Tel: ” & objLDAPUser.telephoneNumber & “</strong></div>”)
htmlfile.WriteLine(“<HR WIDTH=””100%”” COLOR=””#088A85″” SIZE=””1″”>”)
htmlfile.WriteLine(“</body>”)
htmlfile.WriteLine(“</html>”)

‘RTF signature – Copies over pre-made RTF signature
Set fso = CreateObject(“Scripting.FileSystemObject”)
fso.CopyFile “\\fileserver\share\signature.rtf”, appDataPath & “\Microsoft\Signatures\”,TRUE

2. Batch for startup script

Batch file set for the logon script, this creates the signatures directory and runs the vbs script

@echo off
if not exist “%appdata%\Microsoft\Signatures” md “%appdata%\Microsoft\Signatures”
“\\fileserver\share\scripts\Signature.vbs”
EXIT

3. GPO to set startup script and enforce signature

This will enforce use of the signature and grey out the option to change it within the options of Outlook. It however, will not stop the end users removing it from the email when editing.

Set the batch file as a logon script and dig into Administrative templates -> Microsoft Office Outlook 2003 -> Tools | Options -> Mail Format -> Signature. You are interested in the “Signature for new messages” and “Signature for replies and forwards”. Set as required, when enabled set the signature box to signature (the name we used when creating the htm/txt files).

When this is all put together you should find the signatures are created on logon and enforced in Outlook.