Criando assinatura de email automática com GPO

Bom dia, hoje vamos criar a assinatura automática via GPO.
Eu já fiz aqui na empresa e funcionou perfeito mas vamos lá. O script buscara os dados no AD então vamos no que importa.


REM CRIA ASSINATURA DE EMAIL
REM ESTE SCRIPT BUSCA AS INFORMAÇÕES DO AD '
REM LINK PARA VERIFICAR OS CAMPOS NO AD
REM http://www.selfadsi.org/user-attributes-w2k8.htm
REM CRIADO POR RAIMUNDO JUNIOR

On Error Resume Next
Set objSysInfo = CreateObject(“ADSystemInfo”)
strUser = objSysInfo.UserName
Set objUser = GetObject(“LDAP://” & strUser)

With objUser
strName = .DisplayName
strTitle = .Description
End With

REM VARIAVEIS PARA GUARDAR AS INFORMACOES
strFunc = objUser.Title
strCompany = objUser.Company
strAddress = objUser.streetAddress
strpostalCode = objUser.postalCode
strl = objUser.l
strco = objUser.co
strPhone = objUser.TelephoneNumber
strCell = objUser.mobile
strMail = objuser.mail
strWeb = objuser.wWWHomePage

Set objword = CreateObject(“Word.Application”)
With objword
Set objDoc = .Documents.Add()
Set objSelection = .Selection
Set objEmailOptions = .EmailOptions
End With

Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
With objSelection

.ParagraphFormat.Alignment = wdAlignParagraphRight
.TypeParagraph

REM NOME DO DO USUARIO
With .Font
.Name = “Arial”
.Size = 10
.Bold = true
.Color = RGB(0,0,0)
End With
strNameComp = Split(strName, “, “)
strNameP = strNameComp(1)
strNameS = strNameComp(0)
.TypeText strNameP & ” ” & strNameS & Chr(11)

REM FUNCAO DO USUARIO
With .Font
.Name = “Arial”
.Size = 10
.Bold = false
.Color = RGB(0,0,0)
End With
.TypeText strFunc & Chr(11)

REM GRUPO NAME
With .Font
.Name = “Arial”
.Size = 10
.Bold = False
.Italic = False
.Color = RGB(0,0,0)
End With
.TypeText strTitle & Chr(11)
.TypeText Chr(11)

REM LEGAL ENTITY NAME
objSelection.Font.Size = “8”
objSelection.Font.Name = “Arial”
objSelection.Font.Bold = True
objSelection.Font.Color = RGB(0,0,0)
objSelection.TypeText strCompany
.TypeText Chr(11)

REM ENDEREÇO
With .Font
.Name = “Arial”
.Size = 8
.Bold = false
.Color = RGB(0,0,0)
End With
.Font.Italic = False
.TypeText replace(strAddress,”{ENTER}”,Chr(11)) & Chr(11)

REM TELEFONE
With .Font
.Name = “Arial”
.Size = 8
.Bold = false
.Color = RGB(0,0,0)
End With
.Font.Italic = False
.TypeText “OFFICE ” & strPhone & Chr(11)

REM CELULAR
With .Font
.Name = “Arial”
.Size = 8
.Bold = false
.Color = RGB(0,0,0)
End With
.Font.Italic = False
If strCell & “” <> “” then
.TypeText “CELL ” & strCell & Chr(11)
End If

REM MAIL
With .Font
.Name = “Arial”
.Size = 8
.Bold = false
.Color = RGB(0,0,0)
End With
.Font.Italic = False
.TypeText “” & strMail & Chr(11)

REM FINE PRINT
.TypeText Chr(11)
objSelection.Font.Size = “6”
objSelection.Font.italic = False
objSelection.Font.Color = RGB(118,130,133)
objSelection.Font.Bold = False
objSelection.TypeText “Aqui voce coloca o texto que quizer, para primeira linha.”&Chr(11)&”Aqui voce coloca o texto que quizer, para segunda linha.”
REM O &Chr(11)& –> Serve para dar ENTER
End With

REM Cria o assinatura no Outlook
Set objSelection = objDoc.Range()
objSignatureEntries.Add “Assinatura de email automatica”, objSelection
objSignatureObject.NewMessageSignature = “Assinatura de email automatica”
objSignatureObject.ReplyMessageSignature = “Assinatura de email automatica”
objDoc.Saved = True
objword.Quit

Salve este script em vbs, um exemplo: assinatura.vbs

Estes são os campos de onde eu busca as informações dentro do AD e o modelo de como ficara a assinatura.

script_assim_gpo_3

Então vamos lá, criar a GPO

script_assim_gpo_1 script_assim_gpo_2

Esta pronto, espero que possa ajudar a todos.

 

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

About Gradiant

It is a long established fact that reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum