Microsoft Outlook Tech Tip – signatures

Pushing out a Microsoft Outlook signature to an entire group of users becomes trivial if you know how to use Visual Basic Scripting (VBS).  The following script can either be run manually by saving the script as a file named “UpdateSig.vbs” and then typing “cscript UpdateSig.vbs” in a command prompt or by saving the file to the NETLOGON share of your domain controller and directing the script to run at login.

 

When run, the script will query Active Directory for the current user and create a signature file in Microsoft Word and save it for use by Microsoft Outlook.  The format of the signature will be as follows:

 

Cordially,

 

User Name

Title

Phone Number

<Logo.jpg> (with a hyperlink to a website)

 

The salutation “Cordially,” in the signature is specified in the script and can be changed there.  The “User Name” is the “Description” field on the General tab of the user properties in Active Directory.  This makes it easy to personalize exactly what will be included in the signature (including prefixes like Dr. or suffixes like R.N.).  “Title” is pulled from the contents of the “Job Title” field on the Organization tab and “Phone Number” is “Telephone number” on the General tab.  An image (Logo.jpg) will be included at the bottom of the signature and will have a hyperlink to a site specified by sLinkFile in the script below.  There are a lot of other options available that can easily be added by simply adding additional script lines.  Have fun!

 

On Error Resume Next

 

Set objSysInfo = CreateObject(“ADSystemInfo”)

 

strUser = objSysInfo.UserName

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

 

strName = objUser.description

strTitle = objUser.title

strPhone = objUser.TelephoneNumber

 

Set objWord = CreateObject(“Word.Application”)

 

Set objDoc = objWord.Documents.Add()

Set objSelection = objWord.Selection

 

Set objEmailOptions = objWord.EmailOptions

Set objSignatureObject = objEmailOptions.EmailSignature

 

Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

 

objSelection.Font.Name = “Arial”

objSelection.Font.Size = 11

objSelection.TypeText “Cordially,”

objSelection.TypeParagraph()

objSelection.TypeText strName

objSelection.TypeText Chr(11)

objSelection.TypeText strTitle

objselection.TypeText Chr(11)

objSelection.TypeText strPhone

objSelection.TypeText Chr(11)

objSelection.TypeText Chr(11)

 

sPicFile = “\\SERVER\NETLOGON\Logo.jpg

sLinkFile = “http://www.mycompany.com

 

Set objShape1 = objSelection.InlineShapes.AddPicture(sPicFile, True)

 

objDoc.Hyperlinks.Add objShape1.Range, sLinkFile

 

Set oHLink = oDoc.InlineShapes(1).Hyperlink

 

Set objSelection = objDoc.Range()

 

objSignatureEntries.Add “Company Signature”, objSelection

objSignatureObject.NewMessageSignature = “Company Signature”

 

objDoc.Saved = True

objWord.Quit

March 02, 2013 by Abe Varughese Category: General IT 0 comments

Recent Posts