From 3f030f8c888564d0b5c29945c1ccbb35d80f5ef2 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 2 Apr 2015 18:31:05 +0200 Subject: [PATCH] Add support for Outlook signature deployment --- .../shares/tools/files/scripts/wpkg/conf.bat/10All | 4 ++ .../tools/files/scripts/session/010signature.bat | 69 +++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/wpkg/conf.bat/10All b/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/wpkg/conf.bat/10All index 9fd111d..26c640a 100644 --- a/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/wpkg/conf.bat/10All +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/wpkg/conf.bat/10All @@ -8,6 +8,8 @@ my $name = $SystemName; my $url = "https://auth." . $DomainName; my $comp = $ldap{'defaultCompany'}; my $mozbackup = (($wpkg{'MozillaBackup'} || 'no') =~ m/^yes|enabled|on|1$/) ? 'yes':'no'; +my $olsig = (($wpkg{'OutlookSignatures'} || 'no') =~ m/^yes|enabled|on|1$/) ? 'yes':'no'; +my $tbsig = (($wpkg{'ThunderbirdSignatures'} || 'yes') =~ m/^yes|enabled|on|1$/) ? 'yes':'no'; $OUT .=<<"EOF"; @@ -21,6 +23,8 @@ SET SOFTWARE=\\\\%IPASSERELLE_IP%\\wpkg\\softwares SET SETTINGS=\\\\%IPASSERELLE_IP%\\wpkg\\settings SET WPKGLOGS=\\\\%IPASSERELLE_IP%\\wpkglogs SET MOZBACKUP=$mozbackup +SET TBSIG=$tbsig +SET OLSIG=$olsig EOF diff --git a/root/home/e-smith/files/shares/tools/files/scripts/session/010signature.bat b/root/home/e-smith/files/shares/tools/files/scripts/session/010signature.bat index 267d482..7433916 100644 --- a/root/home/e-smith/files/shares/tools/files/scripts/session/010signature.bat +++ b/root/home/e-smith/files/shares/tools/files/scripts/session/010signature.bat @@ -1,3 +1,70 @@ -if exist "\\%IPASSERELLE_IP%\tools\signatures\%USERNAME%" ( +@echo off +REM gestion des signatures de mail + +if not exist "\\%IPASSERELLE_IP%\tools\signatures\%USERNAME%" GOTO :EOF + +REM Pour Thunderbird, simple copie, le resrte étant fait par MCD +if "%TBSIG%" EQU "yes" ( + if exist "\\%IPASSERELLE_IP%\tools\signatures\%USERNAME%" ( xcopy /E /I /Y \\%IPASSERELLE_IP%\tools\signatures\%USERNAME% "%USERPROFILE%\signature" + ) +) + +if "%OLSIG%" EQU "yes" ( + REM premier deploiement ? + if not exist "%APPDATA%\Microsoft\Signatures\email.htm" ( + SET OV="unknown" + REM Detection version Outlook + REM 2013 = 15.0 + reg query "HKLM\Software\Microsoft\Office\15.0\Outlook" >NUL 2>NUL + if %errorlevel% EQU 0 ( + SET OV=15.0 + GOTO :MODREG + ) + REM 2010 = 14.0 + reg query "HKLM\Software\Microsoft\Office\14.0\Outlook" >NUL 2>NUL + if %errorlevel% EQU 0 ( + SET OV=14.0 + GOTO :MODREG + ) + REM 2007 = 12.0 + reg query "HKLM\Software\Microsoft\Office\12.0\Outlook" >NUL 2>NUL + if %errorlevel% EQU 0 ( + SET OV=12.0 + GOTO :MODREG + ) + REM Version inconnue d'office, on arrete + IF "%OV%" EQU "unknown" GOTO :EOF + echo "Office %OV%" + :MODREG + REM Supprimer First Run pour que Outlook prenne en compte les signatures au prochain lancement + reg delete "HKEY_CURRENT_USER\Software\Microsoft\Office\%OV%\Outlook\Setup" /v "First-Run" /f + REM TODO: selection de la signature via le serveur + SET SIG="email" + if exist "\\%IPASSERELLE_IP%\tools\signatures\%USERNAME%\email_modif.html" ( + SET SIG="email_modif" + ) + REM Configurer la signature pour les nouveaux mails et les reponses + reg add "HKEY_CURRENT_USER\Software\Microsoft\Office\%OV%\Common\MailSettings" /t REG_EXPAND_SZ /v NewSignature /d "%SIG%" /f + reg add "HKEY_CURRENT_USER\Software\Microsoft\Office\%OV%\Common\MailSettings" /t REG_EXPAND_SZ /v ReplySignature /d "%SIG%" /f + REM Les images des signatures doivent etre inline pour s'afficher + reg add "HKEY_CURRENT_USER\Software\Microsoft\Office\%OV%\Outlook\Options\Mail" /t REG_DWORD /v "Send Pictures With Document" /d 1 /f + ) + + REM Copie des signatures + xcopy /E /I /Y "\\%IPASSERELLE_IP%\tools\signatures\%USERNAME%\*" "%APPDATA%\Microsoft\Signatures\" + del /Q /F "%APPDATA%\Microsoft\Signatures\email.htm" + rename "%APPDATA%\Microsoft\Signatures\email.html" "email.htm" + echo -- > "%APPDATA%\Microsoft\Signatures\email.rtf" + type "%APPDATA%\Microsoft\Signatures\email.txt" >> "%APPDATA%\Microsoft\Signatures\email.rtf" + copy /Y "%APPDATA%\Microsoft\Signatures\email.rtf" "%APPDATA%\Microsoft\Signatures\email.txt" + if exist "%APPDATA%\Microsoft\Signatures\email_modif.html" ( + del /Q /F "%APPDATA%\Microsoft\Signatures\email_modif.htm" + rename "%APPDATA%\Microsoft\Signatures\email_modif.html" "email_modif.htm" + ) + if exist "%APPDATA%\Microsoft\Signatures\email_modif.txt" ( + echo -- > "%APPDATA%\Microsoft\Signatures\email_modif.rtf" + type "%APPDATA%\Microsoft\Signatures\email_modif.txt" >> "%APPDATA%\Microsoft\Signatures\email_modif.rtf" + copy /Y "%APPDATA%\Microsoft\Signatures\email_modif.rtf" "%APPDATA%\Microsoft\Signatures\email_modif.txt" + ) )