;'====================
;'
;' VBScript: <Signatures.vbs>
;' AUTHOR: Peter Aarts
;' Contact Info: peter.aarts@l1.nl
;' Version 2.04
;' Date: January 20, 2006
;'
;'====================
;Option Explicit
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.
;====================
$objSysInfo = CreateObject("ADSystemInfo")
$objSysInfo.RefreshSchemaCache
$qQuery = "LDAP://" + $objSysInfo.Username
$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.l1.nl"
; 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, $RegKeyParm
$objShell = CreateObject("WScript.Shell")
$RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General"
$RegKey = $RegKey + "\Signatures"
$objShell.RegWrite $RegKey , "Handtekeningen"
$UserDataPath = $ObjShell.ExpandEnvironmentStrings("%appdata%")
$FolderLocation = $UserDataPath +"\Microsoft\Handtekeningen\"
$HTMFileString = $FolderLocation + "prc-new.htm"
; This section checks if the signature directory exits and if not creates one.
;====================
$objFS1
$objFS1 = CreateObject("Scripting.FileSystemObject")
If ($objFS1.FolderExists($FolderLocation))
Else
Call $objFS1.CreateFolder($FolderLocation)
Endif
; The next section builds the signature file
;====================
Dim $objFSO
Dim $objFile, $afile
Dim $aQuote
$aQuote = chr(34)
; This section builds the HTML file version
;====================
$objFSO = CreateObject("Scripting.FileSystemObject")
; This section deletes to other signatures.
; These signatures are automaticly created by Outlook 2003.
;====================
$AFile = $objFSO.GetFile($Folderlocation+"prc-new.rtf")
$aFile.Delete
$AFile = $objFSO.GetFile($Folderlocation+"prc-new.txt")
$aFile.Delete
$objFile = $objFSO.CreateTextFile($HTMFileString,"True")
$objFile.Close
$objFile = $objFSO.OpenTextFile($HTMFileString, 2)