@echo off
verify on
echo.
tasklist /FI "IMAGENAME eq noris.exe" /FI "USERNAME eq %username%" | find /i "noris.exe">nul
if "%ERRORLEVEL%"=="0" (
echo Ukoncujem spusteny noris.exe...
taskkill /FI "IMAGENAME eq noris.exe" /FI "USERNAME eq %username%" /f)

tasklist /FI "IMAGENAME eq noris.start.exe" /FI "USERNAME eq %username%" | find /i "noris.start.exe">nul
if "%ERRORLEVEL%"=="0" (
echo Ukoncujem spusteny noris.start.exe...
taskkill /FI "IMAGENAME eq noris.start.exe" /FI "USERNAME eq %username%" /f)

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{68E9D354-A89F-4B48-A7C2-97996D06466E}"1>nul 2>nul
if %ERRORLEVEL% EQU 0 (
echo Odinstalujem Noris.Next...
MsiExec.exe /qb! /x {68E9D354-A89F-4B48-A7C2-97996D06466E})

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{437B227D-4CC7-4DCB-A897-CEF2D1BF036A}"1>nul 2>nul
if %ERRORLEVEL% EQU 0 (
echo Odinstalujem Noris.Next...
MsiExec.exe /qb! /x {437B227D-4CC7-4DCB-A897-CEF2D1BF036A})

reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{AD80C25D-C77F-44CF-B097-613D01F7E5F0}"1>nul 2>nul
if %ERRORLEVEL% EQU 0 (
echo Odinstalujem Noris.Next...
MsiExec.exe /qb! /x {AD80C25D-C77F-44CF-B097-613D01F7E5F0})

echo Instalujem Noris.Next...
msiexec /qb! /i "\\server\Noris.Next\klient_support_2.1.0.msi" CONFIGPATH="\\server\Noris.Next"