1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| '---------------------------------------------------------------------------------------------------------
' Signature Outlook via paramètres utilisateur Active Directory
'---------------------------------------------------------------------------------------------------------
'
'
'
'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 ... Cliquer sur OK pour continuer."
'Définition des OU Active Directory
'
'
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!! xxxx = A définir suivant votre configuration AD !!!!!
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'
'
'
Set oContainer=GetObject("notre OU")
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.givenname & " " & ucase(oUser.sn) & chr(13) & "Titre: " &oUser.title & chr(13) & "Service: " & oUser.department & chr(13) & "Adresse: " & oUser.postOfficeBox & ", " & oUser.streetAddress & ", " & oUser.postalCode & " " & oUser.l & chr(13) & "Tel: " & oUser.telephoneNumber & chr(13) & "GSM: " & oUser.mobile & chr(13) & "Fax: " & oUser.facsimileTelephoneNumber & chr(13) & "Email: " & 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 " "
OutPutFileTxt.WriteLine oUser.givenname & " " & ucase(oUser.sn)
If not IsEmpty(oUser.title) then
OutPutFileTxt.WriteLine oUser.title
Else
OutPutFileTxt.WriteLine oUser.department
End If
OutPutFileTxt.WriteLine oUser.physicalDeliveryOfficeName
OutPutFileTxt.WriteLine oUser.streetAddress
OutPutFileTxt.WriteLine "F - " & oUser.postalCode & " " & oUser.l
If Not IsEmpty(oUser.telephoneNumber) Then
OutPutFileTxt.WriteLine "Tél : + 33 (0)" & right(oUser.telephoneNumber,13)
End If
If Not IsEmpty(oUser.mobile) Then
OutPutFileTxt.WriteLine "Port. : + 33 (0)" & right(oUser.mobile,13)
End If
If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
OutPutFileTxt.WriteLine "Fax : + 33 (0)" & right(oUser.facsimileTelephoneNumber,13)
End If
OutPutFileTxt.WriteLine "Nos infos"
OutPutFileTxt.WriteLine lcase(oUser.mail)
OutPutFileTxt.WriteLine oUser.wwwhomepage
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 "<BR>"
OutPutFileHtml.WriteLine "<B><FONT face=Verdana size=2>" & oUser.givenname & " " & ucase(oUser.sn) & "</FONT><BR></B>"
If Not IsEmpty(oUser.title) then
OutPutFileHtml.WriteLine "<B><I><FONT face=Verdana size=2>" & oUser.title & "</FONT><BR></I></B>"
Else
OutPutFileHtml.WriteLine "<B><I><FONT face=Verdana size=2>" & oUser.department & "</FONT><BR></I></B>"
End If
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1>" & oUser.physicalDeliveryOfficeName & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1>" & oUser.streetAddress & "</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1>F - " & oUser.postalCode & " " & oUser.l & "</FONT><BR>"
If Not IsEmpty(oUser.telephoneNumber) Then
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1>Tél : + 33 (0)" & right(oUser.telephoneNumber,13) & "</FONT><BR>"
End If
If Not IsEmpty(oUser.mobile) Then
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1><FONT face=Verdana size=1>Port. : + 33 (0)" & right(oUser.mobile,13) & "</FONT><BR>"
End If
If Not IsEmpty(oUser.facsimileTelephoneNumber) Then
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1>Fax : + 33 (0)" & right(oUser.facsimileTelephoneNumber,13) & "</FONT><BR>"
End If
OutPutFileHtml.WriteLine "<FONT face=Verdana size=1>nos infos</FONT><BR>"
OutPutFileHtml.WriteLine "<FONT face=verdana size=1><A href=""mailto:"
OutPutFileHtml.WriteLine oUser.mail
OutPutFileHtml.WriteLine """>" & lcase(oUser.mail) & "</A></FONT><BR>"
OutPutFileHtml.WriteLine " </SPAN><A href=" & oUser.wWWHomePage & "><SPAN"
OutPutFileHtml.WriteLine " lang=fr><U><FONT face=Verdana"
OutPutFileHtml.WriteLine " size=1>" & oUser.wWWHomePage & "</U></SPAN></A></P>"
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
'
WScript.Quit(0) |
Partager