How to standardize your company email signature

Often, companies have a mismatch of email signatures. Nothing standard or manageable throughout their business.   There are software applications that can assist, but they can be costly.

In this post, i will detail how to roll out a standard email signature using nothing more that a vb script, group policy and a little elbow grease with regards to your Active Directory.

Lets begin:

Requirement:  To implement a standard email signature throughout your organisation

Solution: Create VB script to pull data from Active Directory and set it as the users default signature within Outlook (tested in Outlook 2007, 2010 and 2013).

Notes:  Email font is set as: Verdana.  Script is rolled out using a group policy attached to the domain root.

I’m assuming a working knowledge of both AD, Group policy and VB scripts for this article.

This script relies on your active directory having up-to-date information.

Make sure you AD info is up-to-date.  For now, concentrate on one use.  Get the signature looking how you want it to.

Under the general tab,

First name: (AD:  givenName) – Users first name – start with a capital letter.

Last name: (AD:  sn) – Users surname – start with a capital letter.

Telephone number: (AD:  telephoneNumber) Users main line work telephone number (not DDI) – use in the following format: +44 (0) 1234 567890

E-mail: (AD:  mail) ie someone@the-server.ninja

Web page: (AD: WWWHomePage); list as the-server.ninja

emailscript_1

Under the Address tab:

Street: (AD:  streetaddress) – Company address of the users. Start with a capital letter, don’t end sentence with punctuation.

P.O. Box: (AD:  postofficebox) – Second Line of street address (if needed). Start with a capital letter, don’t end sentence with punctuation.

City: (AD:  l) Start with a capital letter, don’t end sentence with punctuation.

State / Province: (AD:  st) County.  Start with a capital letter, don’t end sentence with punctuation.

Zip / Postal Code:  (AD: postalcode); Capitalise all letters.

Country / Region: (AD:  c). Select country field. Not currently used by signature but configured for future use.

emailscript_2

Under the Telephone tab:

Home: (AD:  homephone) – Users DDI (or Direct Dial Number). Use in the following format: +44 (0) 1234 567890

Mobile: (AD:  mobile) – Users company (not private) mobile phone number. Use in the following format: +44 (0) 1234 567890

Fax: (AD:  facsimileTelephoneNumber) Users fax number. Use in the following format: +44 (0) 1234 567890

IP phone: (AD:  ipPhone) User internal extension number. Use in the following format: 1234

Notes:  (AD:  info). Any qualifications (letters) to be presented after the users name. Separated by a “,” and “ “. Eg.  “QUAL1, QUAL2”

emailscript_3

Under the Organization tab:

Job Title: (AD:  title) – Users Job Title. Capitalise each word.

Department field: (AD:  Department) By entering the relevant tag in this field, it’s possible to change the users logo.

Options are: “Marketing” & Research. Any text that does not match the highlighted tags will result in the default company logo being displayed (as shown).

Company: (AD:  Company) Company name as shown “The Ninjas”

emailscript_4

This is an example of how your signature will appear with a reference to each AD file so you know what your editing.

emailscript_5

################################################

Next up,  you’ll want test that your signature works.  Copy the script below into a .VBS file and run it (with Outlook closed).

Open outlook after 30 seconds and create a new message.  you should see the above signature populated with your AD details.

Once your happy with your signature, you’ll need to roll it out via group policy.

Copy the .VBS and any logos to a central file-share (under a domain share would be useful if you have multiple offices)

Connect to your DC and create a new GPO Object (attach it to a test group first)

Under the Users, Policies, Windows Settings, Scripts (Logon / Logoff), Logon.

Attach your vbs file.

Ask your users to log off / on and their signature should update.

‘==========================

‘ Custom .vbs
‘ Script that creates a standard company signature for all users (in a corporate environment); pulling data from Active Directory – dynamic logo insertion depending on department field if needed.

‘===========================

On Error Resume Next

Set objSysInfo = CreateObject(“ADSystemInfo”)

‘ ########### This section connects to Active Directory as the currently logged on user #####

strUser = objSysInfo.UserName

Set objUser = GetObject(“LDAP://” & strUser)

‘ ########### This section sets up the variables we want to call in the script (items on the left; whereas the items on the right are the active directory database field names) – ie strVariablename = objuser.ad.databasename ########

strGiven = objuser.givenName

strSurname = objuser.sn

strAddress1 = objUser.streetaddress

strAddress1EXT = objUser.postofficebox

strAddress2 = objuser.l

strAddress3 = objuser.st

strPostcode = objuser.postalcode

strCountry = objuser.c

strFax = objuser.facsimileTelephoneNumber

strMobile = objuser.mobile

strTitle = objUser.Title

strDepartment = objUser.Department

strCompany = objUser.Company

strPhone = objUser.telephoneNumber

strEmail =objuser.mail

strWeb = objuser.wWWHomePage

strNotes = objuser.info

strExt = objuser.ipPhone

strDDI = objuser.homephone

‘ ########### Sets up word template #####

Wscript.Sleep 500

Set objWord = CreateObject(“Word.Application”)

Set objDoc = objWord.Documents.Add()

Set objSelection = objWord.Selection

objSelection.Style = “No Spacing”

Set objEmailOptions = objWord.EmailOptions

Set objSignatureObject = objEmailOptions.EmailSignature

Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

‘ ########### Calls the variables from above section and inserts into word template, also sets initial font typeface, colour etc. ###

objSelection.Font.Name = “Verdana”

objSelection.Font.Size = 10

objselection.Font.Bold = true

objSelection.Font.Color = RGB (000,045,154)

objSelection.TypeParagraph()

objSelection.TypeText strGiven & ” ” & strSurname

objSelection.Font.Size = 7

‘objSelection.TypeText ” (“

objSelection.TypeText ” “

objselection.TypeText strnotes

‘objselection.TypeText “)” & Chr(11)

objselection.TypeText Chr(11)
objSelection.Font.Size = 8

objselection.Font.Bold = false

objSelection.TypeText strTitle & Chr(11)

objselection.TypeText Chr(11)

‘ ########### This section looks at the department field and loads the appropriate logo for that department. #####

‘ ##### ie, those users with the department field set as marketing or research will get a different logo from the rest of the business. #####

If (objUser.Department = “Marketing”) Then

objSelection.InlineShapes.AddPicture(“\\path\marketing_logo.jpg”)

ElseIf (objUser.Department = “Research”) Then

objSelection.InlineShapes.AddPicture(“\\path\research_logo.jpg”)
Else
objSelection.InlineShapes.AddPicture(“\\path\email_logo.jpg”)

End If

‘ This section sets up a table to display your company contact details

objselection.TypeText Chr(11)

Const Number_of_rows = 6
Const Number_of_columns = 3
Const END_OF_STORY = 6

objSelection.TypeParagraph()
Set objRange = objSelection.Range
objDoc.Tables.Add objRange, number_of_rows, number_of_columns

Set objTable = objDoc.Tables(1)

If (objUser.postofficebox = “”) Then

objTable.Cell(1, 1).Range.Text = strAddress1
objTable.Cell(2, 1).Range.Text = strAddress2
objTable.Cell(3, 1).Range.Text = strAddress3
objTable.Cell(4, 1).Range.Text = strPostcode

Else

objTable.Cell(1, 1).Range.Text = strAddress1
objTable.Cell(2, 1).Range.Text = strAddress1EXT
objTable.Cell(3, 1).Range.Text = strAddress2
objTable.Cell(4, 1).Range.Text = strAddress3
objTable.Cell(5, 1).Range.Text = strPostcode
End If
If (objUser.ipPhone = “”) Then

objTable.Cell(1, 3).Range.Text = strPhone
Else

objTable.Cell(1, 3).Range.Text = strPhone & ” | Ext: ” & strExt
End If

objTable.Cell(1, 2).Range.Text = “Telephone:”
objTable.Cell(2, 2).Range.Text = “Fax:”
objTable.Cell(3, 2).Range.Text = “DDI:”
objTable.Cell(4, 2).Range.Text = “Mobile:”
objTable.Cell(5, 2).Range.Text = “Web:”
If (objuser.mobile = “”) Then

objTable.Cell(4, 3).Range.Text = “-“

Else

objTable.Cell(4, 3).Range.Text = strMobile

End If

If (objuser.facsimileTelephoneNumber = “”) Then

objTable.Cell(2, 3).Range.Text = “-“

Else

objTable.Cell(2, 3).Range.Text = strFax

End If

If (objuser.homephone = “”) Then

objTable.Cell(3, 3).Range.Text = “-“

Else

objTable.Cell(3, 3).Range.Text = strDDI

End If
‘ This part adds a clickable web address to your table.

Set objCell = objTable.Cell(5, 3)
Set objCellRange = objCell.Range
objCell.Select
‘objSelection.TypeText “Web: “
Set objLink = objSelection.Hyperlinks.Add(objSelection.Range, “https://the-server.ninja/”, , , “the-server.ninja”)
objLink.Range.Font.Name = “Verdana”
objLink.Range.Font.Size = 8
objLink.Range.Font.Bold = false
objSelection.Font.Color = RGB (000,045,154)

objTable.AutoFitBehavior(1)

objSelection.EndKey END_OF_STORY

objSelection.TypeParagraph()
objSelection.TypeParagraph()

End If
‘ ########### This adds a tag-line to the bottom of your signature. you could have your company’s disclaimer here, but Exchange server will do this for you anyway)
‘objSelection.Font.Color = RGB (000,153,000)

‘objselection.Font.Bold = true

‘objSelection.TypeParagraph()

‘objselection.typetext “Help cut carbon… “

‘objselection.Font.Bold = false

‘objselection.typetext “please don’t print this email unless you really need to.”

‘objSelection.TypeParagraph()

‘objSelection.TypeParagraph()

‘ ########### Final Part of the script, tells outlook to use this signature for new messages and reply’s ########

Set objSelection = objDoc.Range()

objSignatureEntries.Add “the serverninja Signature”, objSelection

objSignatureObject.NewMessageSignature = “the server ninga Signature”

objSignatureObject.ReplyMessageSignature = “the server ninga Signature”

‘##################################################################################################################
objDoc.Saved = True

objWord.Quit

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s