Sophos
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: PureMessage for Exchange removal script
::
::
:: The best method of uninstalling PureMessage
:: is to use the uninstall from add remove programs.
::
:: This may help the official uninstaller to run to completion
::
:: Usage:
::
:: This is a batch file it requires a “.bat” extension
::
:: Please rename this file to “PMremove.bat”
::
:: This is not sutable for use in conjunction with cluster servers !
::
:: If there are problems with Add-Remove programs
::
:: – Install the Windows Installer Cleanup tool
:: – uncomment the last line of this script
:: – then run this script
::
:: Link to Microsoft support Windows Installer CleanUp Utility
:: http://support.microsoft.com/default.aspx?scid=kb;en-us;290301
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::PureMesasge working directory.
::
set PMdir=”%ProgramFiles%\Sophos\PureMessage”
::
::Is the PureMessage folder is on another drive ?
::uncomment the line below and amend accordingly.
::
REM set PMdir=”E:\Program Files\Sophos\PureMessage”
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
cls
@echo off
color f0
::create copy of the MMEx registry key
SET MMExBak=”MMEx_PureMessage_REG.txt”
if not exist %MMExBak% regedit /e/a %MMExBak% “HKEY_LOCAL_MACHINE\SOFTWARE\SOPHOS\MMEx”
::stop IIS services
iisreset /stop
::stop related Sophos services
taskkill /F /IMÂ almon.exe /T
CLS
taskkill /F /IMÂ alsvc.exe /T
CLS
taskkill /F /IMÂ alupdate.exe /T
CLS
net stop “Sophos AutoUpdate Service”
CLS
taskkill /F /IMÂ almon.exe /T
CLS
taskkill /F /IMÂ alsvc.exe /T
CLS
taskkill /F /IMÂ alupdate.exe /T
CLS
net stop “Sophos PureMessage”
CLS
net stop mmrot
CLS
net stop “Sophos PureMessage Web Agent”
CLS
::unregister the PureMessage services
%PMdir%\bin\savexsrvc.exe” /unregserver
%PMdir%\bin\mmrot2.exe” /unregserver
%PMdir%\bin\SAVExclude.exe” /unregserver
%PMdir%\bin\SavexWebAgent.exe” /unregserver
CLS
::build registry file to delete and import keys/values
SET pmregtmp=%tmp%\pmregtmp.reg
::
echo REGEDIT4 > %pmregtmp%
echo. >> %pmregtmp%
 ::remove transformpath
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\19962AEDA63B38A4088FEB3F88B80202] >> %pmregtmp%
echo “transforms”=- >> %pmregtmp%
 ::delete MMEX key
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\SOPHOS\MMEx] >> %pmregtmp%
 ::enables installer logging below
echo [HKEY_LOCAL_MACHINE\SOFTWARE\SOPHOS\MMExOld\DebugLogs\ISInstaller]>> %pmregtmp%
echo “Enabled”=”dword:00000001″>> %pmregtmp%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer]>> %pmregtmp%
echo “Logging”=”voicewarmup”>> %pmregtmp%
echo. >> %pmregtmp%
 ::import registry file
regedit /s %pmregtmp%
CLS
::drop the PureMessage Databases
osql -S .\sophos -E -Q “drop database savexquar”
osql -S .\sophos -E -Q “drop database savexrprt”
CLS
::delete database files
net stop mssql$sophos
CLS
del /q “%ProgramFiles%\Microsoft SQL Server\MSSQL$SOPHOS\Data\SavexQuar.mdf”
del /q “%ProgramFiles%\Microsoft SQL Server\MSSQL$SOPHOS\Data\SavexQuar_log.LDF”
del /q “%ProgramFiles%\Microsoft SQL Server\MSSQL$SOPHOS\Data\SavexRprt.mdf”
del /q “%ProgramFiles%\Microsoft SQL Server\MSSQL$SOPHOS\Data\SavexRprt_log.LDF”
CLS
net start mssql$sophos
CLS
::now windows installer
echo _________________________________________________________
echo.
echo Please try removing PureMessage from Add-Remove programs.
echo.
echo Press any key to open Add-Remove Programs.
echo.
echo Then close the Add-remove programs window to finish.
echo.
echo _________________________________________________________
echo.
pause
:: Open the add remove programs applet.
appwiz.cpl
CLS
echo _________________________________________________________
echo.
echo If there are still problems relating to windows installer.
echo.
echo Open this script with notepad
echo.
echo Then read the instructions at the top.
echo.
echo _________________________________________________________
pause
CLS
echo REGEDIT4 > %pmregtmp%
echo. >> %pmregtmp%
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\19962AEDA63B38A4088FEB3F88B80202] >> %pmregtmp%
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Features\19962AEDA63B38A4088FEB3F88B80202] >> %pmregtmp%
echo [-HKEY_CLASSES_ROOT\Installer\Products\19962AEDA63B38A4088FEB3F88B80202] >> %pmregtmp%
echo [-HKEY_CLASSES_ROOT\Installer\Features\19962AEDA63B38A4088FEB3F88B80202] >> %pmregtmp%
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\VirusScan] >> %pmregtmp%
echo “Enabled”=dword:00000000 >> %pmregtmp%
echo [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\sophos] >> %pmregtmp%
::import registry file
regedit /s %pmregtmp%
::delete other files
rmdir /q /s %temp%\{DEA26991-B36A-4A83-80F8-BEF3888B2020}
rmdir /q /s %temp%\{67E4931A-A51F-4462-BB48-261D8E0E0BE7}
rmdir /q /s %temp%\{F8E83814-84A0-4DE0-BADB-F7845EC0FFAF}
rmdir /q /s %windir%\installer\{DEA26991-B36A-4A83-80F8-BEF3888B2020}
rmdir /q /s “%ProgramFiles%\InstallShield Installation Information\{DEA26991-B36A-4A83-80F8-BEF3888B2020}”
CLS
net start “Sophos AutoUpdate Service”
echo starting IIS services
iisreset /start
:: Uncomment the following line if you have the windows installer cleanup tool installed
REM “%ProgramFiles%\windows installer clean up\msizap.exe” tw {DEA26991-B36A-4A83-80F8-BEF3888B2020}
echo Finished.
pause