@if "%_echo%" == "" echo off

setlocal

REM set up the parameters
echo **** Retrieving parameters
call Setup.cmd

echo.
echo **** Stop the Service
net stop NS$%InstanceName%

echo.
echo **** Delete the instance databases
call %NSControlPath%\NSControl.exe delete -force -name %InstanceName% -s %SqlServer%

call RunCreate.cmd 
if %ERRORLEVEL% GEQ 1 goto Error

:End
exit /B 0

:Error
exit /B 1

