rem @echo off
rem set SAVCleanWipe=con
rem
rem Note: Uncomment above settings to run this code standalone
rem
rem       If doing so, you must run with one of the cmdline switches decribed as follows:
rem
rem  cmdline switches:
rem
rem    -search     - search for SCS\SAV\NAV uninstall, if found set %SAVMSICode% environment variable, but exit without doing anything
rem    -uninstall  - search for SCS\SAV\NAV uninstall, if found set %SAVMSICode% environment variable and run the uninstaller
rem
rem  Note: All these products have MSI based install/uninstalls which can be located with "esugmsi /search [Name]" logic.
rem
rem *************************************************************************************

:TestForSPM51
if exist SPMUnst2.bat del /q SPMUnst2.bat
esugreg HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DAE05E18-1549-4B01-8A2C-973519A86404}" "UninstallString" >>SPMUnst2.bat
if %errorlevel%==0 goto :FoundProduct

echo SPM 5.1 product was not found.  Skipping Symantec Policy Manager uninstall.>> %SAVCleanWipe% & goto :exit

:FoundProduct
call SPMUnst2.bat

:exit
if exist SPMUnst2.bat del /q SPMUnst2.bat
