Add support for Outlook signature deployment

This commit is contained in:
Daniel Berteaud 2015-04-02 18:31:05 +02:00
parent 34f7a00a12
commit 3f030f8c88
2 changed files with 72 additions and 1 deletions

View File

@ -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

View File

@ -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"
)
)