@echo off
setlocal

rem *******************************************************
rem *** Create the WebSphere profile for Fiper.
rem *** This will remove any existing profile with that name first 
rem *******************************************************
rem *** Configuration Settings.  Edit these before running this script
rem *******************************************************

set user=fiperacs
set pw=fiperacs
set profile=AppSrv01
set WAS_HOME=C:\IBM\WebSphere7\AppServer\

rem *******************************************************
rem *** End of user-configurable settings
rem *******************************************************

set DOT=%~dp0
set profilePath=%WAS_HOME%profiles\%profile%
set templatePath=%WAS_HOME%profileTemplates\default

set PROF_ARGS=-profileName %profile% -profilePath %profilePath% -templatePath %templatePath%
set ADMIN_ARGS=-isDefault true -enableAdminSecurity true -adminUserName %user% -adminPassword %pw%
set SVC_ARGS=-winserviceCheck true -winserviceAccountType localsystem -winserviceStartupType automatic

call %WAS_HOME%bin\manageProfiles.bat -getPath -profileName %profile%
if ERRORLEVEL 1 GOTO skipDelete
echo on
call %WAS_HOME%bin\manageProfiles.bat -delete -profileName %profile% -username %user% -password %pw%
@echo off

:skipDelete
echo on
rmdir /s/q %profilePath%
call %WAS_HOME%bin\manageProfiles.bat -create %PROF_ARGS% %ADMIN_ARGS%
call %WAS_HOME%bin\startServer.bat server1 -profileName %profile%
