Set up Outlook signature with logo, hyperlink and Active Directory information

I prefer to use Notepad++ for writing scripts like these as it has good syntax highlighting. Create a vbscript file as outlook_signature.vbs

Store this file in a network share accessible by everyone. Get the company logo in a jpg format and store it in the same network share. You could use NETLOGON folder for which all users will have read access.

The following script will work for Outlook 2003 and above. Please note that if you are using Outlook 2000, the script needs to be changed.

Error Resume Next

Set objSysInfo = CreateObject(“ADSystemInfo”)
strUser = objSysInfo.UserName

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

strName = objUser.FullName
strTitle = objUser.Title

‘strDepartment = objUser.Department

‘strCompany = objUser.Company

‘strPhone = objUser.telephoneNumber

Set objWord = CreateObject(“Word.Application”)
objDoc = objWord.Documents.Add()
objSelection = objWord.Selection
objSelection.Style =
“No Spacing”
objEmailOptions = objWord.EmailOptions
objSignatureObject = objEmailOptions.EmailSignature
objSignatureEntries = objSignatureObject.EmailSignatureEntries

‘Name of Staff
objSelection.Font.Name =
objSelection.Font.Bold =
objSelection.Font.Size =
objSelection.Font.Color = RGB(

objSelection.TypeText strName


‘Role of Staff
objSelection.Font.Name =
objSelection.Font.Bold =
objSelection.Font.Size =
objSelection.Font.Color =

objSelection.TypeText strTitle


‘Company Logo (stored in network share accessed by everyone)


‘Company Contact details
objSelection.Font.Color = RGB(
“Tel +44 (0) 744 525 5214”
“Fax +44 (0) 744 524 2244”
objSelection.Font.Color = RGB(
objLink = objSelection.Hyperlinks.Add(objSelection.Range,”,,“Sujeeth Home Page”,“”)



‘environment message
objSelection.Font.Name =
objSelection.Font.Size =
objSelection.Font.Color = RGB(
“P “
objSelection.Font.Name =
objSelection.Font.Size =
“Please consider the environment before printing this e-mail.”

Set objSelection = objDoc.Range()

objSignatureEntries.Add “Standard Signature”, objSelection
objSignatureObject.NewMessageSignature =
“Standard Signature”
objSignatureObject.ReplyMessageSignature =
“Standard Signature”

objDoc.Saved = True


You can download the above script from pastebin

After you save the script in the network share, you can call this file from users’ Logon script or directly on the user machine using cscript

cscript \\servername\netlogon\outlook_signature.vbs

Once you run the script, check your Outlook if it has been properly setup. When you open a new email message, the signature should automatically append.

The signature files are usually stored in Application Data\Microsoft\Signatures folder

If you get problems with line spacing, use vbNewline instead of Chr(11)

You can check for Outlook 2000 version as following.

set outlook = createobject(“outlook.application”)

If outlook.version = “” or outlook.version = “” or outlook.version = “” or outlook.version = “” or outlook.version = “”
or outlook.version = “” or outlook.version = “” Then
Outlook2000 =


58 thoughts on “Set up Outlook signature with logo, hyperlink and Active Directory information

  1. If someone send you an email in plain/rich text format ( not HTML ) and you reply it with your signature with logo image. Your image won’t show on the reply email. Anyway to solve this problem? create another signature file without any logo image when dealing with Plain text emails ?


    • Daye,

      You would need to set up the ALT tag to the logo image so that the text that was set as ALT tag appears in the plain text format. If I remember correctly, Outlook 2007 doesn’t support ALT tags. Images are not supported in plain text emails. That’s why they are called “plain text”

    • It is not possible to setup signatures in Outlook Web Access because the content is being served from Exchange 2007 Client Access Server where as Outlook desktop client stores all the signature content files on the local machine. The user will have to add the signature in OWA options. If you have Exchange 2010, the signature can be dynamically generated and added to all outgoing emails using Transport rules.

    • The easiest way to add a grey line is to add the following code after environment message:

      ‘grey line
      objSelection.Font.Name = “Calibri”
      objSelection.Font.Size = “9”
      objSelection.Font.Color = RGB(150,150,150)
      objSelection.TypeText “______________________________________________________”

  2. thanks for the advice on the line

    one more question.

    i have the following line of code to write the contact numbers in a single line

    objSelection.TypeText “Tel ” & uSwitchboard & ” Direct ” & DIRECT & ” Mobile ” & MOBILE & ” Fax ” & FAX

    what i need is for the “Tel” to be in bold but NOT the number itself and in addition to this i would only like the number to be written if it exists. So if the number is not present within AD then it would not write “Tel ” & uSwitchboard for example.

    • In order to format the text, all the charecterisitics of the font has to be set first before the text is being printed. If you want to change from Bold to Normal, you have to set “Font.Bold” to be True or False. So it works like this.

      ‘Company Contact details
      objSelection.Font.Name = “Calibri”
      objSelection.Font.Size = “9″
      objSelection.Font.Color = RGB(38,38,38)
      objSelection.Font.Bold = True
      objSelection.TypeText “Tel ”
      objSelection.Font.Bold = False
      objSelection.TypeText strSwitchboard
      objSelection.Font.Bold = True
      objSelection.TypeText “Direct ”
      objSelection.Font.Bold = False
      objSelection.TypeText strDirect

      With regards to the condition, have an other variable like strGlobalPhonenumber. Assign strGlobalPhonenumber as SwitchBoard number if AD phone numebr is null, else assign it as AD phone number. You can use if-else statement.

      strPhone = objUser.telephoneNumber
      if strPhone =”” Then
      strGlobalPhonenumber = “+447125588945”
      strGlobalPhonenumber = strPhone

  3. thank you for your advice. i am struggling with three more issues at the moment to complete my solution

    1. How do i make the web address appear in bold text
    2. Do you know the “objSelection.Font.Color = RGB(XX,XX,XX)” numbers to write the text in GREY rather than BLACK
    3. Is it possible to resize the inserted images or is it best to resize these before hand

  4. Great advice!
    Is there a way so that the hyperlink is an image? you know like in html when we do a href =”” > Click here to display image /a

    • Yes you can. It is explained here:

      sPicFile = “”
      sLinkFile = “”

      ‘ Insert a picture.
      Set oILPic = oDoc.InlineShapes.AddPicture _
      (Range:=oDoc.Content, FileName:= sPicFile, LinkToFile:=True)

      ‘ Add a hyperlink for the picture.
      oDoc.Hyperlinks.Add Anchor:=oILPic.Range, Address:=sLinkFile

      ‘ Use the InlineShapes Property to reference the object.
      Set oHLink = oDoc.InlineShapes(1).Hyperlink

      • Thanks so much!

        If anyone needs the complete answer for vbs:

        Set objShape1 = objSelection.InlineShapes.AddPicture(sPicFile, True)
        objDoc.Hyperlinks.Add objShape1.Range, sLinkFile

  5. the code i use for the website is as follows although this does not appear in bold text

    objSelection.Font.Bold = True
    Set objLink = objSelection.Hyperlinks.Add(objSelection.Range,””,,”MYSITE”, “”)

    • objSelection.TypeText “Web: ”
      Set objLink = objSelection.Hyperlinks.Add(objSelection.Range,””)
      objLink.Range.Font.Bold = true
      try that.

  6. Sujeeth, you mentioned above you could use the ALT tag to display text when the image cannot be displayed but i cannot find the code for this anywhere.. are you able to assist.

  7. Hello Sujeeth, great article. I had a question regarding wrapping the text around the image. Is there a line of code I can use to have all contact information on the right side of the logo, instead of below it?

    • The best way to acheive this is by using tables. So you will the have the logo in the left cell and the text in the right cell. The script will look something like this. Modify it as per your requirements.

      objDoc.Tables.Add objRange, 1, 3
      Set objTable = objDoc.Tables(1)

      objTable.Cell(1, 1).Range.Text = objSelection.InlineShapes.AddPicture(strLogo)

      objTable.Cell(1, 2).select
      objSelection.TypeText strName
      objSelection.TypeText strMail

      objTable.Cell(1, 3).Range.Select
      objSelection.TypeText strTitle
      objSelection.EndKey 6

  8. Hi. Great post. I have been using a similar script for a while at work and it has been running perfectly. However, work have now decided that they want facebook and twitter icons which will hyperlink to those sites adding to the signatures.

    Im using this code to add the images but cant for the the life of me hyperlink the actual image. I can add hyperlink text, but text only and that looks rubbish:

    objShape = objSelection.InlineShapes.AddPicture(“\\folder\image.gif”)

    If anyone has any suggestions I would really appreacte hearing from you.



    • Hi Dave, have you tried following my earlier comment to Guillermo. He suggested the following worked for him

      Set objShape1 = objSelection.InlineShapes.AddPicture(sPicFile, True)
      objDoc.Hyperlinks.Add objShape1.Range, sLinkFile

  9. Ignore my last comment, it’s late in the week and i obviously didnt read the whole thread properly!

    Guillermo got it, so im now using:

    sPicFile = “\\path\image.gif”
    sLinkFile = “”

    Set objShape1 = objSelection.InlineShapes.AddPicture(sPicFile, True)
    objDoc.Hyperlinks.Add objShape1.Range, sLinkFile

    Bingo! Cheers ears!

  10. Hi,

    I found a basic script and figured out how to apply hyperlinks to the email and website. The only thing that now evades me is formatting those links to follow the rest of the signature. Basically the links should be Verdana 10.

    I’ve done some looking around and testing, but what happens is the script then jumbles everything around. If someone was to take a look at my script, could someone suggest or help with a solution to my problem.

    ‘ VBS Start
    On Error Resume Next

    ‘ Main Email Setup
    Set objSysInfo = CreateObject(“ADSystemInfo”)

    Set WshShell = CreateObject(“WScript.Shell”)

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

    ‘ Getting User Info for Signature
    objSelection.Style = “Normal”
    objSelection.Font.Name = “Verdana”
    objSelection.Font.Size = 10

    strCompany = “”
    strName = objUser.FullName
    strTitle = objUser.Description
    strCred =
    strStreet = objUser.StreetAddress
    strLocation = objUser.l
    strPostCode = objUser.PostalCode
    strPhone = “”
    ‘strPhone = objUser.TelephoneNumber
    strMobile = objUser.Mobile
    strFax = “”
    ‘strFax = objUser.FacsimileTelephoneNumber
    strDX = “”
    strEmail = “Email: ”
    strHypEmail = objUser.FirstName & “.” & objUser.LastName & “”
    strURL = “”
    strWeb = “WWW: ”

    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

    ‘ Forming Signature Format and begin piecing it together
    objSelection.Font.Name = “Verdana”
    objSelection.Font.Size = 10

    objSelection.TypeText “Regards” & Chr(11) & Chr(11)

    objSelection.Font.Bold = True
    objselection.Font.Color = RGB(0, 0, 128)
    objSelection.TypeText strName & Chr(11)
    objSelection.TypeText strTitle & Chr(11) & Chr(11)

    objSelection.TypeText strCompany & Chr(11) & Chr(11)

    ‘ Email Format
    objSelection.Font.Color = RGB(0, 0, 0)

    objSelection.TypeText strEmail
    objSelection.Hyperlinks.Add objselection.range, “mailto;” & strHypEmail,,,strHypEmail
    objSelection.TypeText Chr(11)

    ‘ Phone, Fax & DX
    objSelection.TypeText “Telephone: ” & strPhone & Chr(11)
    objSelection.TypeText “Fax: ” & strFax & Chr(11)
    objSelection.TypeText “DX: ” & strDX &Chr(11)

    ‘ WWW Format
    ‘objSelection.TypeText strWeb
    objSelection.Hyperlinks.Add objselection.range, “http://” & strURL,,,strURL
    objSelection.TypeText Chr(11)
    objSelection.TypeText Chr(11)
    objSelection.Font.Bold = False

    ‘ Insert Company Logo
    objSelection.InlineShapes.AddPicture (“”)
    objSelection.TypeText Chr(11)
    objSelection.TypeText Chr(11)

    ‘ Insert Disclaimer
    objSelection.Font.Size = 8
    objSelection.Font.Color = RGB(128, 128, 128)
    objSelection.TypeText “The contents of this e-mail and any attachments are confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this e-mail is received in error, please contact on quoting the name of the sender and the e-mail address to which it has been sent and then delete it.” & Chr(11) & Chr(11)
    objSelection.TypeText “Please note that neither nor the sender accepts any responsibility for viruses and it is your responsibility to scan or otherwise check this e-mail and any attachments. will not be liable for any losses as a result of any viruses being passed on.” & Chr(11) & Chr(11)
    objSelection.TypeText ” reserves the right to monitor, record and retain any incoming and outgoing e-mails for security reasons. E-mail monitoring and/or blocking software may be used and e-mail content may be read.” & Chr(11) & Chr(11)
    objSelection.TypeText “The contents of any e-mail which does not relate to the official business of the firm is neither given nor endorsed by it.” & Chr(11) & Chr(11)
    objSelection.TypeText ” is regulated by the .”

    ‘ Applying Signature and saving
    Set objSelection = objDoc.Range()

    objSignatureEntries.Add “Full Signature”, objSelection
    objSignatureObject.NewMessageSignature = “Full Signature”

    ‘ Applying Reply Signature same as original
    objSignatureEntries.Add “Reply Signature”, objSelection
    objSignatureObject.ReplyMessageSignature = “Reply Signature”

    objDoc.Saved = True



  11. hello guys.You are having serious problems with your system and I want to say that i have learned a lot from you.I have tried latelly to find an antivirus and i have found about top ten best antiviruses
    wahat it is your opinion about it?
    good luck

  12. hi,

    can you please assist. I have edit the script to suit our company i.e. company logo location and company details.

    I have copied the jpg and vbs script to our netlogon folder. I ran the cscript from my computer and I get:

    U:\>cscript \\demsydfs1\netlogon\signature.vbs
    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.

    \\demsydfs1\netlogon\signature.vbs(51, 81) Microsoft VBScript compilation error:
    Expected ‘)’

    What am I doing wrong?



    • Hi David,

      There must be a syntax error, a closing ) is missing. (51, 81) indicates Line 51 column 81. Double if you have closed all the open (

  13. thanks Sujeeth, that worked. one more question, why does my name, position, address not not show up. I can see the company logo, tel, fax, and web address.


    david lam

    • This will be because you dont have a filled in AD record, the script grabs details from AD and populates the signature that way,

      If you are missing details update you user record in AD and re run the script

  14. How can I change the colour of the link? It’s displaying as the default hyperlink blue where I have the following in the script:

    objSelection.Font.Color = RGB(31,73,125)
    objLink = objSelection.Hyperlinks.Add(objSelection.Range,””,,””,””)

    awesome work on this, btw, but I think my batch version might be implemented as the information we need isn’t in the LDAP (internal phone number etc)

  15. This looks great – but I cannot get it to run?

    I get Line 4 Char 31 invalid character error.

    Also where the company logo is can I point this to an image hosted on a web page? This helps to stop it showing as an attachment in outlook.

  16. Hi,

    I have a situation where several users in an OU who do not have all the required fields that the script will print out on the signature.

    For e.g

    I have staff A, B, C and D

    Staff A has only Office tel number and Fax to be printed out

    Staff B has only Office + Direct Line + Fax numbers to be printed out

    Staff C has only Office + Direct Line + Mobile + Fax numbers to be printed out

    and Staff D has the whole: Office + Direct Line + Mobile + Fax number

    I want to apply a case switch on a single script so that i dont need to create different scripts or redesign my OUs.

    Is it possible to do that?

    Sorry for i am not a programmer and thanks a lot for you help

    • Hi,

      I added this to my script to solve your issue,

      ‘#User Input boxes and questions

      Dim Input
      Dim Input1
      Dim Input2
      Dim Input3
      Dim Input4
      Input = InputBox(“What Is Your Current Position Within ****?”)
      Input1 = InputBox(“What Is Your Current Mobile Number?” & vbLf & “” & vbLf & “If you dont have a mobile number just press Enter Or Cancel”)
      Input2 = InputBox(“Do you have a internal number?” & vbLf & “” & vbLf & “If you dont have a internal number just press Enter Or Cancel”)
      Input3 = InputBox(“Do you have a fax number?” & vbLf & “” & vbLf & “If you dont have a fax number just press Enter Or Cancel”)
      ‘# follow the same if you want more questions.

      once all questions are asked then put this:

      ‘#Users input results

      if input1=”” Then
      objSelection.TypeText “Mobile: ” & Input1
      objSelection.TypeText Chr(11)
      End if
      if Input2=”” Then
      objSelection.TypeText “DDI: ” & Input2
      End if
      if Input3=”” Then
      objSelection.Font.Color = RGB
      objSelection.TypeText “Fax: ” & Input3
      End if

      objSelection.TypeText “Web: ”
      Set objLink = objSelection.Hyperlinks.Add(objSelection.Range,”www.***.com”)
      objLink.Range.Font.Name = “tahoma”
      objLink.Range.Font.Size = 10
      objLink.Range.Font.Bold = false
      ‘#objSelection.Font.Color = RGB (000,045,154)

      The first part brings a user input box so they can fill it in themselves, if they dont have a number, fax ddi then they leave it blank and it will ignore the entry.

      The second part takes what the user has add in and puts it into the signature.

      Hope this helps,


      James P Clegg

  17. Hi,

    The script really works very well, but I notice that if the logo or image changes, outlook need to be reinitiated to take the new image. ¿There is any way to indicate outlook to take those changes when occurs?

    thank you in advance!!

  18. Hi Sujeeth,

    Is there a way to make the signature default for specified email accounts if there are multiple emails configured in outlook? Or at least how to make it the default signature for all accounts configured in Outlook.

    As far as I know, in registry to make it default for other accounts I have to copy the Binary values “New Signature” and “Reply-Forward Signature” from the default account to the rest of the accounts. The key were are located those accounts is “HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676”

    Thank you,

    • objSelection.TypeText “Web: ”
      Set objLink = objSelection.Hyperlinks.Add(objSelection.Range,””)
      objLink.Range.Font.Name = “tahoma”
      objLink.Range.Font.Size = 10
      objLink.Range.Font.Bold = false
      ‘#objSelection.Font.Color = RGB (000,045,154)

      Just change these options.

  19. i.e.

    Set objShape = objSelection.InlineShapes.AddPicture(strlogo)
    objDoc.Hyperlinks.Add objShape.Range, “”

    how to convert WrapFormat.Type = wdWrapBehind

  20. Pingback: Backlinkfreies Artikelverzeichnis

  21. Pingback: active directory kullanıcı bilgisini outlook imzasında kullanın - Önder NET

  22. Pingback: clutch

  23. Hi sujit I had a look at your outlook message. I have few doubts.. in it.

    I have introduced the logo as given by you. My logo is on the left side. my table has 2 rows and 2 cells..

    example….Logo should be seated between two rows in the right.. how can I do that…

  24. limp penis during sex sex story blowjob from mommy gyno porn forced exam animal sex video to buy full 3d hentai movies fathers sex with dauhters xxx stories forced 69 romantic sex novels naked women haven sex home vidio clips porn sex site tamil muscaler girls having sex nguyen sex tila video hairy bears naked sex how do wombats have sex sexy blonde milf intercourse hostile porn vides fresno girls in porn how do snails have sex sex washer

  25. Pingback: small business telephone systems

  26. Pingback: Logo Design Galaxy

  27. Pingback: ecig

  28. I am working on a signature VBS pretty much like this, but would like to set the default formating to be a company standard at the same time.
    font, line spaceing etc for the email body.
    any ideas?


  29. Hi, I already has my signature create with Html and can open with Ms Word, my question is if can I convert it in vb script code. My signature has an special design with table and formatting and I don’t have skills with vb scripts. Anybody can help me to convert my signature to vb scripts.

  30. Hi I am setting image in my signature file from URL. How to set ALT tag in this case so that anyone view signature (mail sent of yaho or gmail) with ALt message

  31. Hi There,

    First of all this post was infinitely useful and I thank you for it. I have got it working and customised perfectly. My Issue is that for some reason it will force a prompt to save the or normal.dotm file. I have checked the office installation for the option to “Prompt before saving Normal template” and it is off and this only happens when I run this script. It only happens on a couple of users, everyone else is perfect.

    Any Ideas?

    Thanks in advance

  32. hmm, as long as the font.color hasn’t been set all text is using the automatic font color from outlook. but once the font color has been set all following text has the same font color.
    How do you reset the font color to automatic again? (i mean the automatic font color of Outlook, when replying to an e-mail the automatic color for text in Outlook is blueish, a new mail is black)

  33. Hello !
    I need to put :
    strName = objUser.FullName
    strTitle = objUser.Title

    on the same line in outlook but Fullname in BOLD and the Title not in bold

    Possible ?

    Thanks !!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s