|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
SIGNATURE STANDARDISÉE DANS OUTLOOK VIA PARAMÈTRES ACTIVE DIRECTORY DE L'UTILISATEUR
Information sur la source
Description
Ecriture d'une signature pour Outlook (2002 et 2003 testés) afin que tous les utilisateur d'une même organisation Active Directory aient la même forme.
Source
- '---------------------------------------------------------------------------------------------------------
- 'Définition de la signature Outlook via paramètres utilisateur Active Directory
- '
- ' ### PREMIER SCRIPT ### LE SECOND SE TROUVE A LA FIN DE CELUI-CI ###
- '---------------------------------------------------------------------------------------------------------
- '
- '
- 'Définition des variables et vérification de l'existance du dossier ....\Microsoft\Signatures
- set netw=createobject("wscript.network")
- Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
- set oshell = createobject("wscript.shell")
- if not FileSystem.folderexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures") then
- FileSystem.CreateFolder(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures")
- End If
- Set OutPutFileTxt = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.txt", True)
- Set OutPutFileHtml = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.htm", True)
- 'Suppression du fichier RTF si existant
- if FileSystem.fileexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.rtf") then
- FileSystem.DeleteFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.rtf")
- End If
- 'Send START Message
- WScript.Echo "Creation signature Outlook en cours ... Veuillez patientez, s'il vous plait"
- 'Définition des OU Active Directory
- '
- '
- '
- '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- '!!!! xxxx = A définir suivant votre configuration AD !!!!!
- '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- '
- '
- '
- Set oContainer=GetObject("LDAP:// ou=xxxx,dc=xxxx,dc=xxxx,dc=com")
- EnumerateUsers oContainer
- '
- '
- '
- '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- '!!!! xxxx = A définir suivant votre configuration AD !!!!!
- '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- '
- ' Si plusieurs OU de recherche
- '
- '
- ' Set oContainer=GetObject("LDAP:// ou=xxxx,dc=xxxx,dc=xxxx,dc=com")
- ' EnumerateUsers oContainer
- '
- '
- '
- '
- 'Message de fin de procédure sur Erreur
- WScript.Echo "Erreur: utilisateur inconnu ou mauvaise definition Active Directory ..."
- WScript.Quit(0)
- 'Sub Programme de recherche "EnumerateUsers"
- Sub EnumerateUsers(oCont)
- Dim oUser
- For Each oUser In oCont
- Select Case LCase(oUser.Class)
- Case "user"
- If oUser.sAMAccountName=netw.username Then
- 'Affichage des paramètres de l'utilisateur
- BtnCode = oshell.Popup("Nom: " & oUser.description & chr(13) & "Title: " &oUser.title & chr(13) & "Departement: " & oUser.department & chr(13) & "Adresse: " & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & chr(13) & "Phone: " & oUser.telephoneNumber & chr(13) & "Mobil: " & oUser.mobile & chr(13) & "Fax: " & oUser.facsimileTelephoneNumber & chr(13) & "Mail: " & oUser.mail & chr(13) & chr(13), 0, "Voulez-vous continuer: ?", 4 + 64)
- If BtnCode=6 then
- ' Création du fichier au format TXT
- OutPutFileTxt.WriteLine "Salutations / Best regards"
- OutPutFileTxt.WriteLine " "
- OutPutFileTxt.WriteLine oUser.description
- OutPutFileTxt.WriteLine "--"
- OutPutFileTxt.WriteLine oUser.title
- OutPutFileTxt.WriteLine oUser.department
- OutPutFileTxt.WriteLine oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l
- If Not IsEmpty(oUser.telephoneNumber) Then
- OutPutFileTxt.WriteLine "Phone " & oUser.telephoneNumber
- End If
- If Not IsEmpty(oUser.mobile) Then
- OutPutFileTxt.WriteLine "Mobile " & oUser.mobile
- End If
- If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
- OutPutFileTxt.WriteLine "Fax " & oUser.facsimileTelephoneNumber
- End If
- OutPutFileTxt.WriteLine "Mailto:" & oUser.mail
- OutPutFileTxt.WriteLine "http://VotresiteWEB"
- OutPutFileTxt.Close
- 'Création du fichier au format HTML
- OutPutFileHtml.WriteLine "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
- OutPutFileHtml.WriteLine "<HTML><HEAD>"
- OutPutFileHtml.WriteLine "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">"
- OutPutFileHtml.WriteLine "<META content=""MSHTML 6.00.2800.1459"" name=GENERATOR></HEAD>"
- OutPutFileHtml.WriteLine "<BODY>"
- OutPutFileHtml.WriteLine "<DIV align=left>"
- OutPutFileHtml.WriteLine "<TABLE id=table1"
- OutPutFileHtml.WriteLine "style=""BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"""
- OutPutFileHtml.WriteLine "height=194 width=500 border=1>"
- OutPutFileHtml.WriteLine " <TBODY>"
- OutPutFileHtml.WriteLine " <TR>"
- OutPutFileHtml.WriteLine " <TD"
- OutPutFileHtml.WriteLine " style=""BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; "
- OutPutFileHtml.WriteLine " BORDER-LEFT: medium none; PADDING-TOP: 0px; BORDER-BOTTOM: medium none"""
- OutPutFileHtml.WriteLine " vAlign=bottom><SPAN lang=fr><FONT face=Arial size=2>Salutations / Best regards<BR>"
- OutPutFileHtml.WriteLine "<BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.description & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>--</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.title & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.department & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & "</FONT><BR>"
- If Not IsEmpty(oUser.telephoneNumber) Then
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Phone " & oUser.telephoneNumber & "</FONT><BR>"
- End If
- If Not IsEmpty(oUser.mobile) Then
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2><FONT face=Arial size=2>Mobile " & oUser.mobile & "</FONT><BR>"
- End If
- If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Fax " & oUser.facsimileTelephoneNumber & "</FONT><BR>"
- End If
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2><A href=""mailto:"
- OutPutFileHtml.WriteLine oUser.mail
- OutPutFileHtml.WriteLine """>mailto:" & oUser.mail & "</A></FONT><BR>"
- OutPutFileHtml.WriteLine " </SPAN><A href=""http://votresiteWEB""><SPAN"
- OutPutFileHtml.WriteLine " lang=fr><U><FONT face=Arial color=#0000ff"
- OutPutFileHtml.WriteLine " size=2>http://votresiteWEB</FONT></U></SPAN></A></P></TD>"
- OutPutFileHtml.WriteLine " </TR></TBODY></TABLE></DIV></BODY></HTML>"
- OutPutFileHtml.Close
- 'Message de FIN normale de la procédure
- WScript.Echo "Définition signature terminée"
- WScript.Quit(0)
- else
- 'Message de d'ABANDON de la procédure
- WScript.Echo "Procédure annulée"
- WScript.Quit(0)
- End If
- End If
- Case "organizationalunit", "container"
- EnumerateUsers oUser
- End Select
- Next
- End Sub
- '
- ' Fin de la première version
- '
-
-
-
- '########################################################################
- '# #
- '# Automatic Outlook Signature with LDAP Parameters #
- '# #
- '########################################################################
- '
- 'Find the current LDAP Name
- '
- '#############################
- Set oRootDSE = GetObject("LDAP://RootDSE")
- Set oShell = WScript.CreateObject("WScript.Shell")
- sUserName = oShell.Environment("PROCESS").Item("username")
- Const ADS_PROPERTY_CLEAR = 1
- Const ADS_NAME_INITTYPE_GC = 3
- Const ADS_NAME_TYPE_NT4 = 3
- Const ADS_NAME_TYPE_1779 = 1
- strDNSDomain = oRootDSE.Get("defaultNamingContext")
- Set objTrans = CreateObject("NameTranslate")
- objTrans.Init ADS_NAME_INITTYPE_GC, ""
- objTrans.Set ADS_NAME_TYPE_1779, strDNSDomain
- strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4)
- strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
- strUserNTName = Trim(LogonAccount)
- objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strUserNTName
- If Err.Number <> 0 Then
- On Error GoTo 0
- Wscript.Echo "ERROR: Login not found in Active Directory: " & strUserNTName
- Else
- On Error GoTo 0
- strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
- LDAP_Name = "LDAP://" & strUserDN
- End If
- '#############################
- '
- 'Find the current User in this LDAP
- '
- '#############################
- On error resume next
- Set objConnection = CreateObject("ADODB.Connection")
- objConnection.Open "Provider=ADsDSOObject;"
- Set objCommand = CreateObject("ADODB.Command")
- objCommand.ActiveConnection = objConnection
- objCommand.CommandText = "SELECT adspath FROM '" & LDAP_Name & "' WHERE objectCategory='user' AND sAMAccountName='" & sUserName & "'"
- Set objRecordSet = objCommand.Execute
- if (objRecordset.Fields("adspath") <> "") then
- GetAdsPath = objRecordset.Fields("adspath")
- end if
- objConnection.Close
- LDAP_Path_User = GetAdsPath
- '#############################
- '
- 'Wrtite files for this Outlook Signature
- '
- '#############################
- Set oUser=GetObject(LDAP_Path_User)
- Set oShell = WScript.CreateObject("WScript.Shell")
- Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
- if not FileSystem.folderexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures") then
- FileSystem.CreateFolder(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures")
- End If
- Set OutPutFileTxt = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.txt", True)
- Set OutPutFileHtml = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.htm", True)
- if FileSystem.fileexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.rtf") then
- FileSystem.DeleteFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.rtf")
- End If
- '=============================
- 'File with extension .TXT
- '=============================
- OutPutFileTxt.WriteLine " "
- OutPutFileTxt.WriteLine "Salutations / Best regards"
- OutPutFileTxt.WriteLine " "
- OutPutFileTxt.WriteLine oUser.description
- OutPutFileTxt.WriteLine "--"
- OutPutFileTxt.WriteLine oUser.company
- OutPutFileTxt.WriteLine oUser.title
- OutPutFileTxt.WriteLine oUser.department
- OutPutFileTxt.WriteLine oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l
- If Not IsEmpty(oUser.telephoneNumber) Then
- OutPutFileTxt.WriteLine "Phone " & oUser.telephoneNumber
- End If
- If Not IsEmpty(oUser.mobile) Then
- OutPutFileTxt.WriteLine "Mobile " & oUser.mobile
- End If
- If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
- OutPutFileTxt.WriteLine "Fax " & oUser.facsimileTelephoneNumber
- End If
- OutPutFileTxt.WriteLine "Mailto:" & oUser.mail
- '
- '
- 'Put your WEB Site instead of www.xxxxxxxxx.com
- '
- '
- OutPutFileTxt.WriteLine "http://www.xxxxxxxxx.com.com"
- OutPutFileTxt.Close
- '=============================
- 'File with extension .HTM
- '=============================
- OutPutFileHtml.WriteLine "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
- OutPutFileHtml.WriteLine "<HTML><HEAD>"
- OutPutFileHtml.WriteLine "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">"
- OutPutFileHtml.WriteLine "<META content=""MSHTML 6.00.2800.1459"" name=GENERATOR></HEAD>"
- OutPutFileHtml.WriteLine "<BODY>"
- OutPutFileHtml.WriteLine "<DIV align=left>"
- OutPutFileHtml.WriteLine "<TABLE id=table1"
- OutPutFileHtml.WriteLine "style=""BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"""
- OutPutFileHtml.WriteLine "height=194 width=500 border=1>"
- OutPutFileHtml.WriteLine " <TBODY>"
- OutPutFileHtml.WriteLine " <TR>"
- OutPutFileHtml.WriteLine " <TD"
- OutPutFileHtml.WriteLine " style=""BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; "
- OutPutFileHtml.WriteLine " BORDER-LEFT: medium none; PADDING-TOP: 0px; BORDER-BOTTOM: medium none"""
- OutPutFileHtml.WriteLine " vAlign=bottom><SPAN lang=fr>"
- OutPutFileHtml.WriteLine "<BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Salutations / Best regards<BR>"
- OutPutFileHtml.WriteLine "<BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.description & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>--</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.company & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.title & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.department & "</FONT><BR>"
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & "</FONT><BR>"
- If Not IsEmpty(oUser.telephoneNumber) Then
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Phone " & oUser.telephoneNumber & "</FONT><BR>"
- End If
- If Not IsEmpty(oUser.mobile) Then
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2><FONT face=Arial size=2>Mobile " & oUser.mobile & "</FONT><BR>"
- End If
- If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Fax " & oUser.facsimileTelephoneNumber & "</FONT><BR>"
- End If
- OutPutFileHtml.WriteLine "<FONT face=Arial size=2><A href=""mailto:"
- OutPutFileHtml.WriteLine oUser.mail
- OutPutFileHtml.WriteLine """>mailto:" & oUser.mail & "</A></FONT><BR>"
- '
- '
- 'Put your WEB Site instead of www.xxxxxxxxx.com (twice)
- '
- '
- OutPutFileHtml.WriteLine " </SPAN><A href=""http://www.xxxxxxxxx.com""><SPAN"
- OutPutFileHtml.WriteLine " lang=fr><U><FONT face=Arial color=#0000ff"
- OutPutFileHtml.WriteLine " size=2>http://www.xxxxxxxxx.com</FONT></U></SPAN></A></P></TD>"
- OutPutFileHtml.WriteLine " </TR></TBODY></TABLE></DIV></BODY></HTML>"
- OutPutFileHtml.Close
- WScript.Quit(0)
-
-
'---------------------------------------------------------------------------------------------------------
'Définition de la signature Outlook via paramètres utilisateur Active Directory
'
' ### PREMIER SCRIPT ### LE SECOND SE TROUVE A LA FIN DE CELUI-CI ###
'---------------------------------------------------------------------------------------------------------
'
'
'Définition des variables et vérification de l'existance du dossier ....\Microsoft\Signatures
set netw=createobject("wscript.network")
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
set oshell = createobject("wscript.shell")
if not FileSystem.folderexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures") then
FileSystem.CreateFolder(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures")
End If
Set OutPutFileTxt = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.txt", True)
Set OutPutFileHtml = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.htm", True)
'Suppression du fichier RTF si existant
if FileSystem.fileexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.rtf") then
FileSystem.DeleteFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\Ma_Signature.rtf")
End If
'Send START Message
WScript.Echo "Creation signature Outlook en cours ... Veuillez patientez, s'il vous plait"
'Définition des OU Active Directory
'
'
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!! xxxx = A définir suivant votre configuration AD !!!!!
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'
'
'
Set oContainer=GetObject("LDAP:// ou=xxxx,dc=xxxx,dc=xxxx,dc=com")
EnumerateUsers oContainer
'
'
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!! xxxx = A définir suivant votre configuration AD !!!!!
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'
' Si plusieurs OU de recherche
'
'
' Set oContainer=GetObject("LDAP:// ou=xxxx,dc=xxxx,dc=xxxx,dc=com")
' EnumerateUsers oContainer
'
'
'
'
'Message de fin de procédure sur Erreur
WScript.Echo "Erreur: utilisateur inconnu ou mauvaise definition Active Directory ..."
WScript.Quit(0)
'Sub Programme de recherche "EnumerateUsers"
Sub EnumerateUsers(oCont)
Dim oUser
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
If oUser.sAMAccountName=netw.username Then
'Affichage des paramètres de l'utilisateur
BtnCode = oshell.Popup("Nom: " & oUser.description & chr(13) & "Title: " &oUser.title & chr(13) & "Departement: " & oUser.department & chr(13) & "Adresse: " & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & chr(13) & "Phone: " & oUser.telephoneNumber & chr(13) & "Mobil: " & oUser.mobile & chr(13) & "Fax: " & oUser.facsimileTelephoneNumber & chr(13) & "Mail: " & oUser.mail & chr(13) & chr(13), 0, "Voulez-vous continuer: ?", 4 + 64)
If BtnCode=6 then
' Création du fichier au format TXT
OutPutFileTxt.WriteLine "Salutations / Best regards"
OutPutFileTxt.WriteLine " "
OutPutFileTxt.WriteLine oUser.description
OutPutFileTxt.WriteLine "--"
OutPutFileTxt.WriteLine oUser.title
OutPutFileTxt.WriteLine oUser.department
OutPutFileTxt.WriteLine oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l
If Not IsEmpty(oUser.telephoneNumber) Then
OutPutFileTxt.WriteLine "Phone " & oUser.telephoneNumber
End If
If Not IsEmpty(oUser.mobile) Then
OutPutFileTxt.WriteLine "Mobile " & oUser.mobile
End If
If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
OutPutFileTxt.WriteLine "Fax " & oUser.facsimileTelephoneNumber
End If
OutPutFileTxt.WriteLine "Mailto:" & oUser.mail
OutPutFileTxt.WriteLine "http://VotresiteWEB"
OutPutFileTxt.Close
'Création du fichier au format HTML
OutPutFileHtml.WriteLine "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
OutPutFileHtml.WriteLine "<HTML><HEAD>"
OutPutFileHtml.WriteLine "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">"
OutPutFileHtml.WriteLine "<META content=""MSHTML 6.00.2800.1459"" name=GENERATOR></HEAD>"
OutPutFileHtml.WriteLine "<BODY>"
OutPutFileHtml.WriteLine "<DIV align=left>"
OutPutFileHtml.WriteLine "<TABLE id=table1"
OutPutFileHtml.WriteLine "style=""BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"""
OutPutFileHtml.WriteLine "height=194 width=500 border=1>"
OutPutFileHtml.WriteLine " <TBODY>"
OutPutFileHtml.WriteLine " <TR>"
OutPutFileHtml.WriteLine " <TD"
OutPutFileHtml.WriteLine " style=""BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; "
OutPutFileHtml.WriteLine " BORDER-LEFT: medium none; PADDING-TOP: 0px; BORDER-BOTTOM: medium none"""
OutPutFileHtml.WriteLine " vAlign=bottom><SPAN lang=fr><FONT face=Arial size=2>Salutations / Best regards<BR>"
OutPutFileHtml.WriteLine "<BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.description & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>--</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.title & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.department & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & "</FONT><BR>"
If Not IsEmpty(oUser.telephoneNumber) Then
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Phone " & oUser.telephoneNumber & "</FONT><BR>"
End If
If Not IsEmpty(oUser.mobile) Then
OutPutFileHtml.WriteLine "<FONT face=Arial size=2><FONT face=Arial size=2>Mobile " & oUser.mobile & "</FONT><BR>"
End If
If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Fax " & oUser.facsimileTelephoneNumber & "</FONT><BR>"
End If
OutPutFileHtml.WriteLine "<FONT face=Arial size=2><A href=""mailto:"
OutPutFileHtml.WriteLine oUser.mail
OutPutFileHtml.WriteLine """>mailto:" & oUser.mail & "</A></FONT><BR>"
OutPutFileHtml.WriteLine " </SPAN><A href=""http://votresiteWEB""><SPAN"
OutPutFileHtml.WriteLine " lang=fr><U><FONT face=Arial color=#0000ff"
OutPutFileHtml.WriteLine " size=2>http://votresiteWEB</FONT></U></SPAN></A></P></TD>"
OutPutFileHtml.WriteLine " </TR></TBODY></TABLE></DIV></BODY></HTML>"
OutPutFileHtml.Close
'Message de FIN normale de la procédure
WScript.Echo "Définition signature terminée"
WScript.Quit(0)
else
'Message de d'ABANDON de la procédure
WScript.Echo "Procédure annulée"
WScript.Quit(0)
End If
End If
Case "organizationalunit", "container"
EnumerateUsers oUser
End Select
Next
End Sub
'
' Fin de la première version
'
'########################################################################
'# #
'# Automatic Outlook Signature with LDAP Parameters #
'# #
'########################################################################
'
'Find the current LDAP Name
'
'#############################
Set oRootDSE = GetObject("LDAP://RootDSE")
Set oShell = WScript.CreateObject("WScript.Shell")
sUserName = oShell.Environment("PROCESS").Item("username")
Const ADS_PROPERTY_CLEAR = 1
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
strDNSDomain = oRootDSE.Get("defaultNamingContext")
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_1779, strDNSDomain
strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4)
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
strUserNTName = Trim(LogonAccount)
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strUserNTName
If Err.Number <> 0 Then
On Error GoTo 0
Wscript.Echo "ERROR: Login not found in Active Directory: " & strUserNTName
Else
On Error GoTo 0
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
LDAP_Name = "LDAP://" & strUserDN
End If
'#############################
'
'Find the current User in this LDAP
'
'#############################
On error resume next
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = "SELECT adspath FROM '" & LDAP_Name & "' WHERE objectCategory='user' AND sAMAccountName='" & sUserName & "'"
Set objRecordSet = objCommand.Execute
if (objRecordset.Fields("adspath") <> "") then
GetAdsPath = objRecordset.Fields("adspath")
end if
objConnection.Close
LDAP_Path_User = GetAdsPath
'#############################
'
'Wrtite files for this Outlook Signature
'
'#############################
Set oUser=GetObject(LDAP_Path_User)
Set oShell = WScript.CreateObject("WScript.Shell")
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
if not FileSystem.folderexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures") then
FileSystem.CreateFolder(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures")
End If
Set OutPutFileTxt = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.txt", True)
Set OutPutFileHtml = FileSystem.CreateTextFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.htm", True)
if FileSystem.fileexists (oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.rtf") then
FileSystem.DeleteFile(oshell.expandenvironmentstrings("%userprofile%") & "\Application Data\Microsoft\Signatures\efqm.rtf")
End If
'=============================
'File with extension .TXT
'=============================
OutPutFileTxt.WriteLine " "
OutPutFileTxt.WriteLine "Salutations / Best regards"
OutPutFileTxt.WriteLine " "
OutPutFileTxt.WriteLine oUser.description
OutPutFileTxt.WriteLine "--"
OutPutFileTxt.WriteLine oUser.company
OutPutFileTxt.WriteLine oUser.title
OutPutFileTxt.WriteLine oUser.department
OutPutFileTxt.WriteLine oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l
If Not IsEmpty(oUser.telephoneNumber) Then
OutPutFileTxt.WriteLine "Phone " & oUser.telephoneNumber
End If
If Not IsEmpty(oUser.mobile) Then
OutPutFileTxt.WriteLine "Mobile " & oUser.mobile
End If
If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
OutPutFileTxt.WriteLine "Fax " & oUser.facsimileTelephoneNumber
End If
OutPutFileTxt.WriteLine "Mailto:" & oUser.mail
'
'
'Put your WEB Site instead of www.xxxxxxxxx.com
'
'
OutPutFileTxt.WriteLine "http://www.xxxxxxxxx.com.com"
OutPutFileTxt.Close
'=============================
'File with extension .HTM
'=============================
OutPutFileHtml.WriteLine "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
OutPutFileHtml.WriteLine "<HTML><HEAD>"
OutPutFileHtml.WriteLine "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">"
OutPutFileHtml.WriteLine "<META content=""MSHTML 6.00.2800.1459"" name=GENERATOR></HEAD>"
OutPutFileHtml.WriteLine "<BODY>"
OutPutFileHtml.WriteLine "<DIV align=left>"
OutPutFileHtml.WriteLine "<TABLE id=table1"
OutPutFileHtml.WriteLine "style=""BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"""
OutPutFileHtml.WriteLine "height=194 width=500 border=1>"
OutPutFileHtml.WriteLine " <TBODY>"
OutPutFileHtml.WriteLine " <TR>"
OutPutFileHtml.WriteLine " <TD"
OutPutFileHtml.WriteLine " style=""BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; "
OutPutFileHtml.WriteLine " BORDER-LEFT: medium none; PADDING-TOP: 0px; BORDER-BOTTOM: medium none"""
OutPutFileHtml.WriteLine " vAlign=bottom><SPAN lang=fr>"
OutPutFileHtml.WriteLine "<BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Salutations / Best regards<BR>"
OutPutFileHtml.WriteLine "<BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.description & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>--</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.company & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.title & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.department & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>" & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & "</FONT><BR>"
If Not IsEmpty(oUser.telephoneNumber) Then
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Phone " & oUser.telephoneNumber & "</FONT><BR>"
End If
If Not IsEmpty(oUser.mobile) Then
OutPutFileHtml.WriteLine "<FONT face=Arial size=2><FONT face=Arial size=2>Mobile " & oUser.mobile & "</FONT><BR>"
End If
If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
OutPutFileHtml.WriteLine "<FONT face=Arial size=2>Fax " & oUser.facsimileTelephoneNumber & "</FONT><BR>"
End If
OutPutFileHtml.WriteLine "<FONT face=Arial size=2><A href=""mailto:"
OutPutFileHtml.WriteLine oUser.mail
OutPutFileHtml.WriteLine """>mailto:" & oUser.mail & "</A></FONT><BR>"
'
'
'Put your WEB Site instead of www.xxxxxxxxx.com (twice)
'
'
OutPutFileHtml.WriteLine " </SPAN><A href=""http://www.xxxxxxxxx.com""><SPAN"
OutPutFileHtml.WriteLine " lang=fr><U><FONT face=Arial color=#0000ff"
OutPutFileHtml.WriteLine " size=2>http://www.xxxxxxxxx.com</FONT></U></SPAN></A></P></TD>"
OutPutFileHtml.WriteLine " </TR></TBODY></TABLE></DIV></BODY></HTML>"
OutPutFileHtml.Close
WScript.Quit(0)
Fichier Zip
Historique
- 10 janvier 2007 20:22:17 :
- Désolé, mais j'ai oublié l'extension du fichier Ma_Signature.HTM
- 12 janvier 2007 08:38:10 :
- Après quelques recherches à droite et à gauche, j'ai trouvé le moyen de réduire le temps de recherche et de rendre ce script exécutable dans tous les domaines LDAP (demande pour nos collègues des autres sites).
Seul l'écriture des fichiers reste à paramétrer suivant vos besoins (exemple, votre site WWW).
Sources du même auteur
Sources de la même categorie
Sources en rapport avec celle ci
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Outlook Public Folder [ par Briaeros ]
En ce bon mercredi, j'aimerai soliciter votre aide. Voila j'aimerai savoir comment faire le lien entre des contacts contenu dans active directory et l
Problème script LDAP [ par william the new ]
Bonjour à tousje voudrais créer des utilisateurs dans active directory avec un script LDAP ( en vbs)mais g l'erreur suivante à la ligne
utilisation d'active directory ldap [ par moyou ]
bonjour,j'ai besoin de savoir le nom et le prénom d'un utilisateur apartir de son login, et pour ça j'ai besoin de développer un script
impasse : droit AD et connexion ldap [ par Cybertat ]
Bonjour à tous,Il y a deux choses que je cherche à faire sans y parvenir complétement : J'ai trouvé sur le site de microsoft un script permettant d'af
Comment répertorier active directory dans une list box? [ par morpheus22170 ]
Bonjour, je voudrais répertorier les ordinateurs se trouvant dansmon active directory (CN=Computers) dans une ListBox.Merci de bien vouloir m'aider.
IDENTIFICATION USER DANS ACTIVE DIRECTORY (VB6) [ par cosimo ]
Je désire restreindre l'accès à une application X.pour cela je désir créer une userform sur laquelle j'offre à l'utilisateur le moyen de s'identifier
Travailler avec l'active Directory [ par FrostByte ]
Bonjour, actuellement je cherche des informations relatives à l'active directory, et surtout la possibilité de récupérer des informations (plus préci
Comment créer un mail Outlook avec la signature et le papier à lettre en OLE ? [ par rdevel ]
Bonjour,Je repose ma question car je ne la vois pas dans le forum.Je créé et j'envoie des email avec Outlook via une liaison Ole mais je n'a
Signature Outlook [ par jejelb ]
Bonjour,Je voudrais savoir si quelqu'un sait comment ajouter la signature par défaut dans un mail envoyer via VB sous outlook?J'utilise un objet
Lister les users de l'Active Directory [ par drakkard ]
Bonjour, je souhaiterai sous VB6 lister tout les utilisateurs de l'Active Directory sans être forcément sur un serveur AD. Je souhaite pouvoir le fai
|
Téléchargements
Logiciels à télécharger sur le même thème :
Comparez les prix Nouvelle version
|