Help adding signature file to outlook users with script and GPO

acenyc 81 Reputation points
2022-07-09T15:58:50.463+00:00

I am trying to add a signature file to all outlook users on the network with a GPO. I am using the information from this website:

https://www.codetwo.com/admins-blog/active-directory-outlook-signature-vbs-script/

I think I have all the steps done correctly. I have added the corresponding user properties in AD. When I run gpupdate, I get this error message:

219181-script-sigerror.png

I think the script GPO is running but there is an error in the script. I also get this error message on the client computer when the user logs on, opens outlook and creates a new email.

This is the script:

On Error Resume Next

Set objSysInfo = CreateObject("ADInformation")

strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
If objUser Is Empty Then _
MsgBox "No connection with LDAP information.", _
vbCritical, "Error": Exit Sub

strName = objUser.FullName
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
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

' Beginning of signature block

objSelection.TypeText strName & ", " & strTitle
objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone

' End of signature block

Set objSelection = objDoc.Range()

objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"

objDoc.Saved = True
objWord.Quit

You can also see the script from the website also. It's the first one.

I have also added a screen capture with narration so you can see the problem. The video quality is not good. I recorded at the wrong frame rate.

This is a gdrive link:

https://drive.google.com/file/d/1f65lEUT5jk4t2syGOtitZtM6zj1Omsgo/view?usp=sharing

Can someone help me to understand the error message and correct the script? I will provide any additional information.

Thank you.

Exchange Exchange Server Management
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.