AD Based Outlook Email Signature for 2003 and 2007
There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text based signatures these days with the quick connections and cheap data costs. So I went on the look out for a Email signature that could be modified to how I desire, or how the company desires. Funnily enough there was not that many scripts I could find, there does seem to be a few third party applications. But who wants to pay… I hate paying for something that can be scripted.
Anyway I came across a script that did exactly want I wanted, it removes the old signatures and creates a new one (which you have designed) making it the default signature.
http://cwashington.netreach.net/depo/view.asp?Index=1123 written by Peter Aarts
So I took the base of the script (thanks a million Peter Aarts) then modified the ‘objfile.write’ objects with the HTML parts that I required to make the signature conform to the company standard.
It worked perfectly. But the issue is the above link / script only works with outlook 2003. the fix for 2007 is super simple…
All that needs to be done to make it 2007 compliant is:
Where it says
“HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General”
change the 11.0 to a 12.0
“HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General”
That’s it so simple….
Well its not that easy… if you have a mixed environment like we do then its defiantly not that easy… I have done the hard work for you, all you have to do is a copy and paste… and take the credit
'==================== ' ' VBScript: <Signatures.vbs> ' AUTHOR: Peter Aarts ' Contact Info: peter.aarts@l1.nl ' Version 2.04 ' Date: January 20, 2006 ' Moddified By Brad Marsh Now works with both 2003 and 2007 outlook ' Contact: gentex@tpg.com.au ' Date 19 feb 08 ' Tested on Vista, XP, XP64 and office 2003 and 2007. ' NOTE will not work that well with various email accounts '==================== 'Option Explicit On Error Resume Next Dim qQuery, objSysInfo, objuser Dim FullName, EMail, Title, PhoneNumber, MobileNumber, FaxNumber, OfficeLocation, Department Dim web_address, FolderLocation, HTMFileString, StreetAddress, Town, State, Company Dim ZipCode, PostOfficeBox, UserDataPath ' Read LDAP(Active Directory) information to asigns the user's info to variables. '==================== Set objSysInfo = CreateObject("ADSystemInfo") objSysInfo.RefreshSchemaCache qQuery = "LDAP://" & objSysInfo.Username Set objuser = GetObject(qQuery) FullName = objuser.displayname EMail = objuser.mail Company = objuser.Company Title = objuser.title PhoneNumber = objuser.TelephoneNumber FaxNumber = objuser.FaxNumber OfficeLocation = objuser.physicalDeliveryOfficeName StreetAddress = objuser.streetaddress PostofficeBox = objuser.postofficebox Department = objUser.Department ZipCode = objuser.postalcode Town = objuser.l MobileNumber = objuser.TelephoneMobile web_address = "http://www.elcom.com.au" ' This section creates the signature files names and locations. '==================== ' Corrects Outlook signature folder location. Just to make sure that ' Outlook is using the purposed folder defined with variable : FolderLocation ' Example is based on Dutch version. ' Changing this in a production enviremont might create extra work ' all employees are missing their old signatures '==================== Dim objShell, RegKey, RegKey07, RegKeyParm Set objShell = CreateObject("WScript.Shell") RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General" RegKey07 = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General" RegKey07 = RegKey07 & "\Signatures" RegKey = RegKey & "\Signatures" objShell.RegWrite RegKey , "AD_elcom" objShell.RegWrite RegKey07 , "AD_elcom" UserDataPath = ObjShell.ExpandEnvironmentStrings("%appdata%") FolderLocation = UserDataPath &"\Microsoft\AD_elcom\" HTMFileString = FolderLocation & "Elcom.htm" ' This section disables the change of the signature by the user. '==================== 'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\NewSignature" , "L1-Handtekening" 'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\ReplySignature" , "L1-Handtekening" 'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD" ' This section checks if the signature directory exits and if not creates one. '==================== Dim objFS1 Set objFS1 = CreateObject("Scripting.FileSystemObject") If (objFS1.FolderExists(FolderLocation)) Then Else Call objFS1.CreateFolder(FolderLocation) End if ' The next section builds the signature file '==================== Dim objFSO Dim objFile,afile Dim aQuote aQuote = chr(34) ' This section builds the HTML file version '==================== Set objFSO = CreateObject("Scripting.FileSystemObject") ' This section deletes to other signatures. ' These signatures are automaticly created by Outlook 2003. '==================== Set AFile = objFSO.GetFile(Folderlocation&"Elcom.rtf") aFile.Delete Set AFile = objFSO.GetFile(Folderlocation&"Elcom.txt") aFile.Delete Set objFile = objFSO.CreateTextFile(HTMFileString,True) objFile.Close Set objFile = objFSO.OpenTextFile(HTMFileString, 2) objfile.write "<!DOCTYPE HTML PUBLIC " & aQuote & "-//W3C//DTD HTML 4.0 Transitional//EN" & aQuote & ">" & vbCrLf objfile.write "<HTML><HEAD><TITLE>Microsoft Office Outlook Signature</TITLE>" & vbCrLf objfile.write "<META http-equiv=Content-Type content=" & aQuote & "text/html; charset=windows-1252" & aQuote & ">" & vbCrLf objfile.write "<META content=" & aQuote & "MSHTML 6.00.3790.186" & aQuote & " name=GENERATOR></HEAD>" & vbCrLf objfile.write "<body>" & vbCrLf objfile.write "<font color=696969 face=" & aQuote & "Arial" & aQuote & "><h6> "& FullName & " | " & title & " | "& Company & " | Australian Technology Park <br>"& vbCrLf objfile.write "T +612 " & PhoneNumber & " | F +612 9209 4423 | <a href=http://www.elcom.com.au><font color=#696969>www.elcom.com.au</font></a> |<a href=mailto:" & Email &" > <font color=#696969>" & Email &" " & vbCrLf objfile.write "</h6></font></a></B>" & vbCrLf objfile.write "</font>" & vbCrLf objfile.write "<font color=696969 face=arial><A href=http://www.elcom.com.au/> <img src=http://www.elcom.com.au/images/elcom-logo-web-175x70.gif border=0></a>" & vbCrLf objfile.write "<br>" & vbCrLf objfile.write "<img src=http://www.elcom.com.au/images/mspartner.jpg>" & vbCrLf objfile.write "<br>" & vbCrLf objfile.write "</font><font color=696969 size=1 face=arial><br>" & vbCrLf objfile.write "<hr size=1 align=left width=465 color=696969>" & vbCrLf objfile.write " This email is intended for the intended recipients(s) and may contain confidential information. <br> Reproduction, dissemination or distribution of this message is prohibited unless authorised by the sender.<br> If you are not the intended recipient, please notify the sender immediately and you must not read,<br> keep, use, disclose, copy or distribute this email without the sender's prior permission.<br> The views expressed by the sender are not necessarily those of Elcom Technology Pty Ltd</font>" & vbCrLf objfile.write "</FONT></BODY></HTML>" & vbCrLf objFile.Close ' =========================== ' This section readsout the current Outlook profile and then sets the name of the default Signature ' =========================== ' Use this version to set all accounts ' in the default mail profile ' to use a previously created signature Call SetDefaultSignature("Elcom","") ' Use this version (and comment the other) to ' modify a named profile. 'Call SetDefaultSignature _ ' ("Signature Name", "Profile Name") Sub SetDefaultSignature(strSigName, strProfile) Const HKEY_CURRENT_USER = &H80000001 strComputer = "." If Not IsOutlookRunning Then Set objreg = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\default:StdRegProv") strKeyPath = "Software\Microsoft\Windows NT\" & _ "CurrentVersion\Windows " & _ "Messaging Subsystem\Profiles\" ' get default profile name if none specified If strProfile = "" Then objreg.GetStringValue HKEY_CURRENT_USER, _ strKeyPath, "DefaultProfile", strProfile End If ' build array from signature name myArray = StringToByteArray(strSigName, True) strKeyPath = strKeyPath & strProfile & _ "\9375CFF0413111d3B88A00104B2A6676" objreg.EnumKey HKEY_CURRENT_USER, strKeyPath, _ arrProfileKeys For Each subkey In arrProfileKeys strsubkeypath = strKeyPath & "\" & subkey objreg.SetBinaryValue HKEY_CURRENT_USER, _ strsubkeypath, "New Signature", myArray objreg.SetBinaryValue HKEY_CURRENT_USER, _ strsubkeypath, "Reply-Forward Signature", myArray Next Else strMsg = "Please shut down Outlook before " & _ "running this script." MsgBox strMsg, vbExclamation, "SetDefaultSignature" End If End Sub Function IsOutlookRunning() strComputer = "." strQuery = "Select * from Win32_Process " & _ "Where Name = 'Outlook.exe'" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery(strQuery) For Each objProcess In colProcesses If UCase(objProcess.Name) = "OUTLOOK.EXE" Then IsOutlookRunning = True Else IsOutlookRunning = False End If Next End Function Public Function StringToByteArray _ (Data, NeedNullTerminator) Dim strAll strAll = StringToHex4(Data) If NeedNullTerminator Then strAll = strAll & "0000" End If intLen = Len(strAll) \ 2 ReDim arr(intLen - 1) For i = 1 To Len(strAll) \ 2 arr(i - 1) = CByte _ ("&H" & Mid(strAll, (2 * i) - 1, 2)) Next StringToByteArray = arr End Function Public Function StringToHex4(Data) ' Input: normal text ' Output: four-character string for each character, ' e.g. "3204" for lower-case Russian B, ' "6500" for ASCII e ' Output: correct characters ' needs to reverse order of bytes from 0432 Dim strAll For i = 1 To Len(Data) ' get the four-character hex for each character strChar = Mid(Data, i, 1) strTemp = Right("00" & Hex(AscW(strChar)), 4) strAll = strAll & Right(strTemp, 2) & Left(strTemp, 2) Next StringToHex4 = strAll End Function
Enjoy
NOTE: I have now posted a how to implement article on this topic find it here
February 20th, 2008 at 1:56 pm
Hi,
i’ve found the same script… and i faced the same problem in a mixed environment…
so i found the following solution to insert just before the LDAP stuf :
[code]
'First, get the outlook main version
'--------------------------------------------------
Dim Outlook
Dim OutlookVer
set Outlook = createobject("outlook.application")
OutlookVer = Left(Outlook.Version, InStr(Outlook.Version, ".")-1)
if Err.Number0 then
strMsg = CStr(Err.Number)& " - "& Err.Description
MsgBox strMsg, vbExclamation, "Outlook"
WScript.Quit
End if
set Outlook = Nothing
' As the rest of the script needs outlook to be closed,
' we do a small time-based loop (5 sec) to wait for Outlook to quit (5sec on my computer, check for the computers the script will be running)
'----------------------------------------------------------------------------
CheckTime = timer
while (timer - checktime) < 5
' do nothing... just wait...
Wend
[/code]
Then, when setting the registry keys :
[code]
RegKey = “HKEY_CURRENT_USER\Software\Microsoft\Office\"&OutlookVer&".0\Common\General”
[/code]
And this worked perfectly for me
i’m actually still modifying the script for a finer use…
HTH,
Best regards,
Guillaume MAISON
February 20th, 2008 at 9:42 pm
Cheers Seems to work well for me also.
Only one problem with both scripts if trying on an account with muilpe accounts (not profiles email accounts) it dosent seem to set the signature as the default, whilst i can see it put the signature into outlook and when you go to your tool options and then signatures you can see it there, you have you click on APPLY, and then seems to work. But the problem is it needs manual intervention. I will be looking at this in the near future.
Cheers
Brad
May 13th, 2008 at 8:43 am
this script is interesting, before i implement this, are there any preview how the output looks like after running this script?
also, please assist me where to run this script, is it in the AD server?
thanks
May 13th, 2008 at 10:43 am
Hi Derrick,
I dont know how I can show you how it works with out going into great detail, I can tell you you must pay attention to
objfile.write “” & vbCrLf
objfile.write “Microsoft Office Outlook Signature” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “ “& FullName & ” | “ & title & ” | “& Company & ” | Australian Technology Park ”& vbCrLf
objfile.write “T +612 “ & PhoneNumber & ” | F +612 9209 4423 | http://www.elcom.com.au | ” & Email &” “ & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “ ” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write “” & vbCrLf
objfile.write ” This email is intended for the intended recipients(s) and may contain confidential information. Reproduction, dissemination or distribution of this message is prohibited unless authorised by the sender. If you are not the intended recipient, please notify the sender immediately and you must not read, keep, use, disclose, copy or distribute this email without the sender’s prior permission. The views expressed by the sender are not necessarily those of Elcom Technology Pty Ltd” & vbCrLf
objfile.write “” & vbCrLf
objFile.Close
this is where the HTML is written, as you can see this is specfic to where I work as you can see.
You just need to change the signature to suit your requrements.
As for the AD part yes you would typiclly run this on your AD server, I run this on the domain controllers, within the group policy I run this in the login scripts. I do this because we want our signatues to be forced to be standardized and this way if any one does change it the changes are overwitten at next login.
If you stay tuned I will create another post tomorrow and out line everything i have listed above in more detail with screen shots.
Cheers
May 13th, 2008 at 10:54 am
Hi Brad, thanks for the fast reply. I’m about to implement this, but I’ll wait for your post tomorrow.
Thanks in advance
Regards
May 14th, 2008 at 3:17 am
Hi Brad,
I carefully follow the advise above, I integrate it in GPO as Logon Script, however an error appears during login like error in Line 1, etc etc.
May 14th, 2008 at 4:05 am
[...] earlier on in the year I blogged about AD based signatures for 2003 and 2007 outlook (find the post here), It seems I am not the only person that needs this, I have been getting rather high stats on this [...]
May 14th, 2008 at 4:09 am
Derrick find the new post here
http://bradmarsh.wordpress.com/2008/05/14/ad-based-outlook-email-signature-for-2003-and-2007-continued/
May 14th, 2008 at 6:37 am
Derrick,
Have your tried running the file as a straight VBS file rather then intergrating it into AD? If so what where the results? If they were the same please send the script to gentex@tpg.com.au I will take a quick look this evening for you!
May 21st, 2008 at 11:38 pm
[...] you have run the original script previously you will have find that just running the new script I am about to paste below is [...]
July 4th, 2008 at 2:36 am
Fantastic! This was exactly what was needed. Same ‘basic’ editing of the script and WALLA!
Moving this further along, can this method be applied for OWA? I am doing some further checking on this and haven’t found anything yet but if you know something that could assist..?
Thanks Again! Great work.
July 31st, 2008 at 12:54 am
Great article! We further modified this to exclude values if they are blank. E.g. if there is nothing listed for the Telephone, Fax & mobile, it will not show. This ensures unnecessary blank lines.
Name
Title
Company Name
A Address1
Address2
T xxx xxx xxx
F xxx xxx xxx
M xxx xxx xxx
E name@domain.com.au
Name
Title
Company Name
A Address1
Address2
E name@domain.com.au
A sample of how we did this for the fax is below (but it is the same for all fields):
‘Fax
If LEN(FaxNumber) > 1 Then
objfile.write “…F…” & FaxNumber & vbCrLf
End If
July 31st, 2008 at 6:28 am
Brad good one!
top idea.
August 4th, 2008 at 3:17 pm
Hi Guys, brilliant articles. Do any of you know how to apply a .jpg as a signature through a Vbscript, or is there another way besides buying a 3rd party software
August 4th, 2008 at 10:18 pm
Hi Johan,
in this script I am actully appling 1 .JPG and 1 .gif image
look at where the objfile.write starts and then work your way toward then end of the objfile.write and you will find images inserted using plan old HTML.
September 10th, 2008 at 12:37 am
Hi Brad,
How have you overcome the problem of blank signatures when replying to Rich Text or Plain Text email messages? Composing new messages are fine… just replies are blank when the format isn’t HTML.
Brad.
September 10th, 2008 at 12:25 pm
Hi Brad,
I have overcome this, the standard script should cater for this
‘Set AFile = objFSO.GetFile(Folderlocation&”Elcom.rtf”)
aFile.Delete
Set AFile = objFSO.GetFile(Folderlocation&”Elcom.txt”)
aFile.Delete ‘
as you can see it creates both a RTF and TXT, however I also have had problems with this notbeing created, primarly on a 07 outlook box. But in saything that I havent spent much time troubleshooting this as we dont use signatures in the reply / forward, so this never really pose an issue for us.
However over the comming days if gets a little quiter I will see what I can do for you…
Brad
October 8th, 2008 at 6:40 am
Hi,
Great script, but I have a problem…When creating a new mail after implementing the signature file, the first mail is OK! But #2 reduses the size of the logo to a very small size. Restart Outlook – same result 1. = OK
2. = small logo
We are running Outlook 2007
Regards, Bjorn
October 9th, 2008 at 12:15 am
hi Bjorn,
where is the image located? have you git t hosted on a server some where or embeddng it? have you giving the image spcific height and width within the HTML part?
hope this helps
Brad
October 9th, 2008 at 5:34 pm
I found out that the sollution was, as you described – to place the logo on our web server, not embedded.
Bjorn
October 10th, 2008 at 8:43 am
Hi again,
regarding the post prior to mine:
“I have overcome this, the standard script should cater for this
‘Set AFile = objFSO.GetFile(Folderlocation&”Elcom.rtf”)
aFile.Delete
Set AFile = objFSO.GetFile(Folderlocation&”Elcom.txt”)
aFile.Delete ‘
as you can see it creates both a RTF and TXT, however I also have had problems with this notbeing created, primarly on a 07 outlook box.”
The problem is that the *.rtf and *.txt is not created.
Have you come up with a sollution?
I have tried to create them in the script, but how do I get info into the files? This should be done automatically – right?
Regards,
Bjorn
October 13th, 2008 at 12:21 am
Hi Bjorn,
Your spot on it should create those 2 files, And i also have the same experiance with it not creating under 2007 / vista, I am yet to work this out. I just have not had the time. I will see what I can do over the comming week.
Cheers
Brad
October 20th, 2008 at 7:02 pm
Wow, thanks for the script. This is very helpful. One question though, I would like to have an abbreviated signature for replies. How could I extend this script to do that?
Thanks again!
(Also, I’m interested if you find a solution to the no signature problem when replying to RTF and TXT messages.)
October 21st, 2008 at 10:39 pm
Hi Jonathan,
Really havent had time too look at this rtf/txt issue and going awa on holidays for a little so onc I get back I should have a clear mind and should be able to nut it out for us all…
as for your abbreviated you could modify the script, but you would be better off having 2 scripts with some modification
remove referance to things like this objreg.SetBinaryValue HKEY_CURRENT_USER, _
strsubkeypath, “New Signature”, myArray
and the other one remove referance to
objreg.SetBinaryValue HKEY_CURRENT_USER, _
strsubkeypath, “Reply-Forward Signature”, myArray
and change the HTML and the file names (obvoulsy cant have the same fine name)
that should do it for you
If you have run the orginal file then you will have to go to the registry and clean out where it has made its entrys, you find enough info on the 3 blogs I have made about this script.
If you need mail me.
Thanks
November 11th, 2008 at 3:16 pm
Thanks. I was able to set it up to use a separate signature for replies. It works great! (I just need to figure out how to get text replies.)
Also, I noticed that the state object from active directory was never called. Would this just be state=objuser.state …?
Thanks again.
November 18th, 2008 at 4:38 pm
Can this script be adapted for Outlook XP as well as 2003 and 2007. i have a mixed outlook for all versions.
Cheers
November 18th, 2008 at 10:55 pm
sure it could be used for XP, you would just need to find the corrasonding registry enties and add them
November 19th, 2008 at 7:03 am
Brad, I am really keen to see whether you are able to resolve the reply to plain text email problem.
We are running a mixed environment of XP/Outlook 2003 and Vista/2007. The script works flawlessly on Outlook 2003, but fails to create the .rtf and .txt files on Outlook 2007.
I am almost ready to deploy this script across our network, and really this is the only flaw I can see to an exceptionally worked script.
A pat on the back also for sharing your knowledge and continuing to assist others.
November 19th, 2008 at 9:06 am
Hi Adrian,
Thanks for the praise.
Yes I know I have this same problem really need to put sometime aside for this. I promise I will try this over this week at some stage – things have been so hectic of late
November 20th, 2008 at 12:53 am
Ok here is the fix for 07, not the best but it seems to work
http://bradmarsh.wordpress.com/2008/11/20/ad-based-outlook-email-signature-for-2003-and-2007-part-4-now-writes-txt-and-rtf-as-well-as-html/
November 20th, 2008 at 12:32 pm
Brad,
I’ve taken the new code and propagated it through our network and it works brilliantly.
Thanks for the assistance!
November 21st, 2008 at 1:58 am
Adrian,
Your most welcome.
January 20th, 2009 at 7:17 am
[...] http://bradmarsh.net/index.php/2008/02/18/ad-based-outlook-email-signature-for-2003-and-2007 [...]
January 23rd, 2009 at 9:36 pm
Thanx, for the information
i’ve added
‘ This section checks if the signature directory exits and if not creates one.
‘====================
Dim objFS1
Set objFS1 = CreateObject(“Scripting.FileSystemObject”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
If objFSO.FileExists(HTMFilestring) Then
Wscript.Quit
End If
If (objFS1.FolderExists(FolderLocation)) Then
Else
Call objFS1.CreateFolder(FolderLocation)
End if
and it works
since we replace the signatures withv version numbers the old ones get deleted when updated by the script
April 15th, 2009 at 2:29 am
Slightly unrelated, but I’ve recently started using Exclaimer to manage our email signatures – so far I have been really impressed with this tool – I highly recommend it.
September 16th, 2009 at 12:17 am
Hi Brad,
Thx for the script, it works perfectly here!
I have one question, I would love to have a separete reply signature. I read your post from oktober 21 at 10:39pm (up here) but it does’nt work for me.
Can you explain it a little further?
Thx for the answer
September 21st, 2009 at 1:56 pm
You could have a seprate one for reply, resonably easily by simply re-using the script and also running it at login. But this time comment out any section that pertains to ‘new signature’.
Maybe if I find time (things are just really busy at the moment) I might be able to create the VBS to create 2 different items one for reply and one for new..
April 21st, 2010 at 6:07 pm
Hi Brad,
Nice Script, since i am not from a scripting background, is it possible that i send you my Format and you could prbably change the script based on how i want the signature to look???
April 21st, 2010 at 6:07 pm
Hi Brad,
Nice Script, since i am not from a scripting background, is it possible that i send you my Format and you could prbably change the script based on how i want the signature to look???
April 23rd, 2010 at 4:26 am
Brad,
The script works great when all users are in the users OU in AD. I have users in a bunch of different ou’s and if I move people around the script does not work for those people. How can I get it to query all of AD no matter the OU?
May 6th, 2010 at 2:17 pm
Thank you that script works perfectly.
May 17th, 2010 at 2:41 pm
[...] AD Based Outlook Email Signature for 2003 and 2007 [...]
June 7th, 2010 at 8:44 pm
Haha; cannot believe this… I spent 4 days writing this almost exact script… except mine writes hundereds of reg entries and several signature files (basic and full sig, and one per client of ours)..
absolutely gutted;
worth looking for a HTML2RTF vb function; write the HTML file, write a RTF file and then TXT file for all of the signatures..
not everyone communicates in HTML
slightly gutted I had to do this; but good to know i’m not the only one.
July 2nd, 2010 at 1:45 am
Hey, i have been working on a similar project recently for my company, i came up with a VB solution and ran it from the logon script. It works with 2003 and 2007, i have included the code below.
On Error Resume Next
Set objSysInfo = CreateObject(“ADSystemInfo”)
strUser = objSysInfo.UserName
Set objUser = GetObject(“LDAP://” & strUser)
strTitle = objUser.Title
strName = objUser.givenName & ” ” & objUser.sn
strDesc = objUser.description
strDepartment = objUser.Department
strCompany = objUser.Company
if objUser.telephoneNumber=”" Then
strPhone = “T: +44 (0)1670 39 3811″
Else
strPhone = “T: +44 ” & objUser.telephoneNumber
End If
if objUser.mobile=”" Then
Else
strMob = ” M: +44 ” & objUser.mobile
End If
if objUser.facsimileTelephoneNumber=”" Then
If objUser.physicaldeliveryofficename=”Lynemouth Smelter” Then
strFax = “F: +44 (0)1670 39 3956″
ElseIf objUser.physicaldeliveryofficename=”Lynemouth Power Station” Then
strFax = “F: +44 (0)1670 39 3970″
End If
Else
strFax = ” F: +44 ” & objUser.facsimileTelephoneNumber
End If
strTelecom = strPhone & ” ” & strMob & ” ” & strFax
strAddress = objUser.streetAddress & “, ” & objUser.l & “, ” & objUser.st & “, ” & objUser.postalCode & “,”
strEmail = objUser.mail
strWeb = “company web address”
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
objWord.UserName = objUser.givenName & ” ” & objUser.SN
objWord.UserInitials = Left(objUser.givenName, 1) & Left(objUser.SN, 1)
objSelection.Font.Name = “Georgia”
objSelection.Font.Size = “12″
objSelection.TypeText strName &”,”
objSelection.TypeText Chr(11)
objSelection.TypeText strTitle &”, Alcan Aluminium UK Limited”
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.Font.Color = “000,000,255″
objSelection.TypeText strCompany
objSelection.TypeText Chr(11)
objSelection.Font.Name = “Arial”
objSelection.Font.Size = “10″
objSelection.Font.Color = “000,000,000″
objSelection.TypeText strAddress &” England”
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.TypeText strTelecom
objSelection.TypeText Chr(11)
objSelection.TypeText strEmail & “, ”
objSelection.Hyperlinks.Add objSelection.Range, strWeb, “”, “”, strWeb
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.TypeText “Company registered Office”
Set objSelection = objDoc.Range()
objSignatureEntries.Add “RTA “& strName, objSelection
objSignatureObject.NewMessageSignature = “RTA ” & strName
objSignatureObject.ReplyMessageSignature = “RTA ” & strName
objDoc.Saved = True
objWord.Quit
WScript.Echo “The Footer ‘RTA “& strName &”‘ was created. Please create a new email and verify that your details are correct”
wscript.quit
August 16th, 2010 at 11:34 pm
Hey folks,
greate script, works like a charm, but I had issues implementing it in a mixed client/terminal server enviroment. the script kept on failing for our terminal server users due to the fact that the function IsOutlookRunning always returned “true” since other outlook instances were running on the TS within other users session context. So I modified the funktion “IsOutlookRunning” which now compares the Process owner of outlook.exe with the logon user and gives back true only if the condition is true. Before, of course, the logon user must be defined:
############### get Logonuser################
Set oShell = CreateObject(“Wscript.Shell”)
strLogonUser = oShell.ExpandEnvironmentStrings(“%USERNAME%”)
#############################################
Function IsOutlookRunning()
strComputer = “.”
strQuery = “Select * from Win32_Process ” & _
“Where Name = ‘outlook.exe’”
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” _
& strComputer & “\root\cimv2″)
Set colProcesses = objWMIService.ExecQuery(strQuery)
For Each objProcess In colProcesses
procusername = objProcess.GetOwner(strNameOfUser)
proc = objProcess.Name
If UCase(objProcess.Name) = “OUTLOOK.EXE” and (strLogonUser) = (strNameOfUser) Then
IsOutlookRunning = True
Else
IsOutlookRunning = False
End If
Next
End Function
############################################
This modification works fine on both XP/Windows 7 and TerminalServer 2008 R2
hope that helps you out.
regards
Chris
August 18th, 2010 at 8:04 am
VERY NICE, thanks a bunch Chris, I am sure this is going to help a bunch of people out.
August 28th, 2010 at 6:52 am
Hi, my english isnt very best but I think by regulary visits of this blog it will likely be better inside next time. You have a beneficial wrting style that is effortless to understand and can assists men and women like me to learn english. I will be now a regulary visitor of your blog.
August 24th, 2011 at 3:31 pm
I used to be suggested this blog via my cousin. I am not certain whether this put up is written through him as nobody else recognise such particular approximately my difficulty. You’re amazing! Thanks!
December 30th, 2020 at 6:52 am
Buy Fast Proxies…
There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text…
December 30th, 2020 at 6:47 pm
Jolie Pilato…
There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text…
January 6th, 2021 at 7:16 pm
Quality Proxies…
There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text…
January 15th, 2021 at 1:12 am
Tommy Ford…
There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text…
January 27th, 2021 at 10:34 am
Proxies For Scrapebox…
There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text…