rem @echo off
rem set SAVCleanWipe=con
rem set WARN_FIRST=1
rem mkdir .\logs
rem mkdir .\logs\SAVCleanWipe_MSI_Logs
rem set APPCode={10A405D8-AE5D-408D-AB09-43601D38E4EF}
rem if exist CurrDir.txt del /q CurrDir.txt
rem set CurrDir=
rem cd > CurrDir.txt
rem for /f "delims=$" %%a in (CurrDir.txt) do set CurrDir=%%a
rem echo CleanWipe is running from "%CurrDir%" >> %SAVCleanWipe%
rem if exist CurrDir.txt del /q CurrDir.txt
rem
rem Note: Uncomment above settings to run this code standalone
rem
rem       The above APPCode is for the Hamlet version of SAV.
rem
rem       If doing so, you must run with one of the cmdline switches decribed as follows:
rem 
rem *************************************************************************************
rem Call the MSI Uninstall for the found MSI Product.
rem
rem  Note: All these products have MSI based install/uninstalls which can be located with "esugmsi /search [Name]" logic.
rem
rem *************************************************************************************

rem This code expects that FindApp.bat has already been called

if not "%APPCode%"=="" goto :FoundProduct

echo No Symantec Product code found.  Skipping Uninstall.>> %SAVCleanWipe% & goto :eof

:FoundProduct
rem
rem clear any required uninstall password
rem
if not exist "%CurrDir%\logs\SAVCleanWipe_MSI_Logs\" MD "%CurrDir%\logs\SAVCleanWipe_MSI_Logs"
if exist NoPWD.Reg del /q NoPWD.reg
echo.REGEDIT4>>NoPWD.reg
echo.[HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion\AdministratorOnly\Security]>>NoPWD.reg
echo."UseVPUninstallPassword"=dword:00000000>>NoPWD.reg
ESUGUnEn2 /LF"%SAVCleanWipe%" /DELREG"NoPWD.reg"
if exist NoPWD.Reg del /q NoPWD.reg

echo.>>%SAVCleanWipe%

:UseMSI
if %WARN_FIRST%==0 goto :DoSilent
rem
rem the first APPCode may actually be for SPM, if so skip to APPCode2
rem
if "%APPCode%"=="{DAE05E18-1549-4B01-8A2C-973519A86404}" goto :testAPPCode2
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct%
echo 1-Calling MSIExec to uninstall product code %APPCode%. >> %SAVCleanWipe%
if "%APPCode%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI_SSC

MsiExec.exe /i "%APPCode%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_%TimeStamp%.Log /qb-
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode2
:UseMSI_SSC
MsiExec.exe /i "%APPCode%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode2

:DoSilent
rem
rem the first APPCode may actually be for SPM, if so skip to APPCode2
rem
if "%APPCode%"=="{DAE05E18-1549-4B01-8A2C-973519A86404}" goto :testAPPCode2
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct%
echo 2-Calling MSIExec to uninstall product code %APPCode%. >> %SAVCleanWipe%
if "%APPCode%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI_SSC_DoSilent
MsiExec.exe /i "%APPCode%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_%TimeStamp%.Log /qn
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode2
:UseMSI_SSC_DoSilent
MsiExec.exe /i "%APPCode%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode2

:testAPPCode2
if "%APPCode2%"=="" goto :eof

echo.>>%SAVCleanWipe%

:UseMSI2
if %WARN_FIRST%==0 goto :DoSilent2
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct2%
echo 3-Calling MSIExec to uninstall product code %APPCode2%. >> %SAVCleanWipe%
if "%APPCode2%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI_SSC2
MsiExec.exe /i "%APPCode2%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_2_%TimeStamp%.Log /qb-
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode3
:UseMSI_SSC2
MsiExec.exe /i "%APPCode2%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_2_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode3

:DoSilent2
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct2%
echo 4-Calling MSIExec to uninstall product code %APPCode2%. >> %SAVCleanWipe%
if "%APPCode2%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI_SSC2_DoSilent
MsiExec.exe /i "%APPCode2%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_2_%TimeStamp%.Log /qn
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode3
:UseMSI_SSC2_DoSilent
MsiExec.exe /i "%APPCode2%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_2_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode3

:testAPPCode3
if "%APPCode3%"=="" goto :eof

echo.>>%SAVCleanWipe%

:UseMSI3
if %WARN_FIRST%==0 goto :DoSilent
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct3%
echo 5-Calling MSIExec to uninstall product code %APPCode3%. >> %SAVCleanWipe%
if "%APPCode3%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI3_SSC
MsiExec.exe /i "%APPCode3%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_3_%TimeStamp%.Log /qb-
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode4
:UseMSI3_SSC
MsiExec.exe /i "%APPCode3%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_3_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode4

:DoSilent3
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct3%
echo 6-Calling MSIExec to uninstall product code %APPCode3%. >> %SAVCleanWipe%
if "%APPCode3%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI3_SSC_DoSilent
MsiExec.exe /i "%APPCode3%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_3_%TimeStamp%.Log /qn
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :eof
:UseMSI3_SSC_DoSilent
MsiExec.exe /i "%APPCode3%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_3_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode4

:testAPPCode4
if "%APPCode4%"=="" goto :eof

echo.>>%SAVCleanWipe%

:UseMSI4
if %WARN_FIRST%==0 goto :DoSilent
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct4%
echo 7-Calling MSIExec to uninstall product code %APPCode4%. >> %SAVCleanWipe%
if "%APPCode4%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI4_SSC
MsiExec.exe /i "%APPCode4%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_4_%TimeStamp%.Log /qb-
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode5
:UseMSI4_SSC
MsiExec.exe /i "%APPCode4%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_4_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode5

:DoSilent4
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct4%
echo 8-Calling MSIExec to uninstall product code %APPCode4%. >> %SAVCleanWipe%
if "%APPCode4%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI4_SSC_DoSilent
MsiExec.exe /i "%APPCode4%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_4_%TimeStamp%.Log /qn
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :eof
:UseMSI4_SSC_DoSilent
MsiExec.exe /i "%APPCode4%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_4_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode5

:testAPPCode5
if "%APPCode5%"=="" goto :eof

echo.>>%SAVCleanWipe%

:UseMSI5
if %WARN_FIRST%==0 goto :DoSilent
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct5%
echo 9-Calling MSIExec to uninstall product code %APPCode5%. >> %SAVCleanWipe%
if "%APPCode5%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI5_SSC
MsiExec.exe /i "%APPCode5%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_5_%TimeStamp%.Log /qb-
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode6
:UseMSI5_SSC
MsiExec.exe /i "%APPCode5%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_5_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode6

:DoSilent5
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct5%
echo 10-Calling MSIExec to uninstall product code %APPCode5%. >> %SAVCleanWipe%
if "%APPCode5%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI5_SSC_DoSilent
MsiExec.exe /i "%APPCode5%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_5_%TimeStamp%.Log /qn
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :eof
:UseMSI5_SSC_DoSilent
MsiExec.exe /i "%APPCode5%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_5_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode6

:testAPPCode6
if "%APPCode6%"=="" goto :eof

echo.>>%SAVCleanWipe%

:UseMSI6
if %WARN_FIRST%==0 goto :DoSilent
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct6%
echo 11-Calling MSIExec to uninstall product code %APPCode6%. >> %SAVCleanWipe%
if "%APPCode6%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI6_SSC
MsiExec.exe /i "%APPCode6%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_6_%TimeStamp%.Log /qb-
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode6
:UseMSI6_SSC
MsiExec.exe /i "%APPCode6%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_6_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode6

:DoSilent6
if %WARN_FIRST%==1 echo External step - Uninstall %SAVProduct6%
echo 12-Calling MSIExec to uninstall product code %APPCode6%. >> %SAVCleanWipe%
if "%APPCode6%"=="{B32A6E90-74BB-4C54-941A-A85FD596E576}" goto :UseMSI6_SSC_DoSilent
MsiExec.exe /i "%APPCode6%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_6_%TimeStamp%.Log /qn
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :eof
:UseMSI6_SSC_DoSilent
MsiExec.exe /i "%APPCode6%" /norestart REBOOT=ReallySuppress SYMREBOOT=ReallySuppress REMOVE=ALL /l*v .\logs\SAVCleanWipe_MSI_Logs\SAVCleanWipe_MSI_6_%TimeStamp%.Log /qr
echo MSIExec finished with an errorlevel of %errorlevel%. >> %SAVCleanWipe%
goto :testAPPCode7

:testAPPCode7