ipasserelle-gp/root/home/e-smith/files/shares/tools/files/scripts/session/010signature.bat
2015-04-02 18:31:05 +02:00

71 lines
3.1 KiB
Batchfile

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